From nobody Fri Dec 10 07:53:12 2021 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E094E18DDD49 for ; Fri, 10 Dec 2021 07:53:41 +0000 (UTC) (envelope-from 6yearold@gmail.com) Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4J9NSj1RSPz4TSF for ; Fri, 10 Dec 2021 07:53:41 +0000 (UTC) (envelope-from 6yearold@gmail.com) Received: by mail-lj1-f176.google.com with SMTP id b19so10744592ljr.12 for ; Thu, 09 Dec 2021 23:53:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QhjE3fPcxg+5t2kWvrOps79t8XG9TfOhO/kVKUcicLs=; b=olPhDmF4CxPQdxLuh2CNxwfKCQ5Y3VoRS+RtW+KMch556SQqkvAIKXuGuK19mCYimc azyeTWoF9pg0sHizZ7NFmAf0YewKT8SIbbjCmlDoMY+XrCsBeNBkjlGf1S2YDvVvUdzu wgDFK8W5YXt06XsFb8tH0nQQ7U/f8aaL9qVEPa/uPgduykhb1sSJBpLgVl8sk1OAQLEe tOoELvFWIY3EjB/aROdRYMRYSwJykmrFzxlyxctiYnf9Yd4xAhwH5HiYujlRl91N5qB0 h7nnvkXx2ExsZee+TFvOXu6pz6rGhsmuxEVzURhpcpJFbbspii7lfwN6KZsLguQs1RsL SgKg== X-Gm-Message-State: AOAM5333lX0yNaPgPZiRboHmlQs3Q9sOtT9YR01oYFIjTv2y1r5tGtYs 2TApVQvJpVzdF0fY8Q8ifmdIL3Z6p26VqQ== X-Google-Smtp-Source: ABdhPJxNi8iarBdD+7wB1+n8vCdTWrSQY8y6yF48wtJ/gF+9F4zLdGnF/ogshfm5V4r+kBtHklW48Q== X-Received: by 2002:a2e:9206:: with SMTP id k6mr11348424ljg.117.1639122819837; Thu, 09 Dec 2021 23:53:39 -0800 (PST) Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com. [209.85.167.50]) by smtp.gmail.com with ESMTPSA id s5sm237418ljg.3.2021.12.09.23.53.39 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Dec 2021 23:53:39 -0800 (PST) Received: by mail-lf1-f50.google.com with SMTP id bi37so16543978lfb.5 for ; Thu, 09 Dec 2021 23:53:39 -0800 (PST) X-Received: by 2002:a05:6512:3050:: with SMTP id b16mr11205514lfb.89.1639122818923; Thu, 09 Dec 2021 23:53:38 -0800 (PST) List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 References: In-Reply-To: From: Gleb Popov Date: Fri, 10 Dec 2021 10:53:12 +0300 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: What to use in place of abstract unix sockets? To: "Daniel O'Connor" , Eugene Grosbein Cc: freebsd-hackers Content-Type: multipart/alternative; boundary="0000000000005d84b505d2c60558" X-Rspamd-Queue-Id: 4J9NSj1RSPz4TSF X-Spamd-Bar: ++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of 6yearold@gmail.com designates 209.85.208.176 as permitted sender) smtp.mailfrom=6yearold@gmail.com X-Spamd-Result: default: False [2.09 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; NEURAL_HAM_LONG(-0.88)[-0.881]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; NEURAL_SPAM_MEDIUM(1.00)[1.000]; NEURAL_SPAM_SHORT(0.97)[0.969]; RCVD_COUNT_THREE(0.00)[4]; SUBJECT_ENDS_QUESTION(1.00)[]; TO_DN_ALL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.167.50:received,209.85.208.176:from]; FORGED_SENDER(0.30)[arrowd@freebsd.org,6yearold@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.208.176:from]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[arrowd@freebsd.org,6yearold@gmail.com]; FREEMAIL_ENVFROM(0.00)[gmail.com] X-ThisMailContainsUnwantedMimeParts: Y --0000000000005d84b505d2c60558 Content-Type: text/plain; charset="UTF-8" On Wed, Dec 8, 2021 at 10:50 AM Eugene Grosbein wrote: > 08.12.2021 13:43, Gleb Popov wrote: > > > Hello hackers. > > > > I'm porting a software that does the following things on Linux: > > > > 1. Binds an abstract UDS (the socket name starts with '\0') > > 2. Launches a "client" process. > > 3. "Client" uses chroot() to constrain itself in a sort of jail. > > 4. "Client" connects to the abstract UDS. > > > >>From what I can tell, this works because abstract UDS's do not use the > > filesystem namespace, which is why "client" can connect out of the > > chroot'ed environment. > > > > What can I do to make this software work for FreeBSD? Simply using > regular > > UDS instead of abstract ones doesn't work for obvious reasons - the > > "client" can't find the socket file. > > > > Thanks in advance. > > If they are parent/child, you could try using socketpair(). > There are actually multiple children. If I understand it right, using socketpair() would lead to N sockets on the server side for the N connected clients. Right now there is a single UDS that handles all connections, so rewriting it with socketpair() would be problematic, I think. On Thu, Dec 9, 2021 at 3:08 AM Daniel O'Connor wrote: > > > > On 8 Dec 2021, at 17:13, Gleb Popov wrote: > > I'm porting a software that does the following things on Linux: > > > > 1. Binds an abstract UDS (the socket name starts with '\0') > > 2. Launches a "client" process. > > 3. "Client" uses chroot() to constrain itself in a sort of jail. > > 4. "Client" connects to the abstract UDS. > > > > From what I can tell, this works because abstract UDS's do not use the > > filesystem namespace, which is why "client" can connect out of the > > chroot'ed environment. > > > > What can I do to make this software work for FreeBSD? Simply using > regular > > UDS instead of abstract ones doesn't work for obvious reasons - the > > "client" can't find the socket file. > > If the parent knows where the child will chroot it could create a unix > domain socket under that directory somewhere. > Same problem as above - there should be a single socket on the server side. --0000000000005d84b505d2c60558--