From nobody Fri Nov 29 15:24:43 2024 X-Original-To: dev-commits-src-all@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 4Y0H6k0sL4z5fK1W; Fri, 29 Nov 2024 15:25:02 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y0H6j3Wsxz4RWy; Fri, 29 Nov 2024 15:25:01 +0000 (UTC) (envelope-from kostikbel@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: from tom.home (kib@localhost [127.0.0.1] (may be forged)) by kib.kiev.ua (8.18.1/8.18.1) with ESMTP id 4ATFOhOG038492; Fri, 29 Nov 2024 17:24:46 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 4ATFOhOG038492 Received: (from kostik@localhost) by tom.home (8.18.1/8.18.1/Submit) id 4ATFOhij038491; Fri, 29 Nov 2024 17:24:43 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 29 Nov 2024 17:24:43 +0200 From: Konstantin Belousov To: Edward Tomasz Napierala Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: b165e9e3ea4e - main - Add fchroot(2) Message-ID: References: <202411291222.4ATCMG8Y068265@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202411291222.4ATCMG8Y068265@gitrepo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on tom.home X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] X-Rspamd-Queue-Id: 4Y0H6j3Wsxz4RWy X-Spamd-Bar: ---- On Fri, Nov 29, 2024 at 12:22:16PM +0000, Edward Tomasz Napierala wrote: > The branch main has been updated by trasz: > > URL: https://cgit.FreeBSD.org/src/commit/?id=b165e9e3ea4e327fc421d81c2a89242bd8720780 > > commit b165e9e3ea4e327fc421d81c2a89242bd8720780 > Author: Edward Tomasz Napierala > AuthorDate: 2024-11-29 07:46:07 +0000 > Commit: Edward Tomasz Napierala > CommitDate: 2024-11-29 12:10:02 +0000 > > Add fchroot(2) > > This is similar to chroot(2), but takes a file descriptor instead > of path. Same syscall exists in NetBSD and Solaris. It is part of a larger > patch to make absolute pathnames usable in Capsicum mode, but should > be useful in other contexts too. I wonder if it should be fchrootat(fd, path, flags) with the support for AT_EMPTY_PATH instead. Then fchroot() becomes the libc wrapper. I can see arguments both pro and contra. Main argument against is that the immediate semantic is easily emulated by openat() + fchroot(). But the freedom of adding the fchroot-specific flags might be worth considering.