From nobody Fri Nov 29 16:44:07 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 4Y0Jt355KBz5fPQX; Fri, 29 Nov 2024 16:44:11 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) (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 "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y0Jt337x2z4btp; Fri, 29 Nov 2024 16:44:11 +0000 (UTC) (envelope-from etnapierala@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2ffa12ad18cso23944421fa.2; Fri, 29 Nov 2024 08:44:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732898649; x=1733503449; darn=freebsd.org; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:sender:from:to :cc:subject:date:message-id:reply-to; bh=EYw5ilNUTdxt42NyFwGaXHBfyAo1i/9DMyD2QXXruA4=; b=czjwC2YwuiN9sob1njl9HxpTbEkPomWNNuY772DjlCt5H2gM8NOa6F0e+lGX5+Ej/c FJfjnNuDGOmnWn1lkzYvyTzRLWWIc2uFmAq3KIAPbR64t4hXIH0Cs3AoTnNnrS1HKdfT Hj99qRSRqfmq8ML+sgkvl47uCXwZKosyaMkg40Wwz2w7OavTj0GF0RkSzYq953CHB0Xw jxNtdyE3dnH7sdVo+Uwuyve/FyegH9n574nWqpIv8fhodPhXAOK6E/gUEeed0l0p8Ilo fmAYlVosphME0CgNkqdbelKaM1JAs8SY5ZDfgyiHfdIp7X6hXCZqU+oMcWH/Xxt3u06m aiSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732898649; x=1733503449; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:sender :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=EYw5ilNUTdxt42NyFwGaXHBfyAo1i/9DMyD2QXXruA4=; b=OPQKygnCm0f7aNrvo6vuBgz1uveu53DKlls7cSIb+mWK8GSNyCAPnoB+K7LC1398cm bqQtjkyTeKQZQYy1npcUxggAmJMBhG3Z8++/fIHOrylJeWG1Bnx0GByeVzuPawtIVMIb xJfsyYS8MmCCdpIEhxipxrbZ5bHegyBmHj2kcF0zxbrj2eHZSqPgmWAwFh8/TGnqIp3V /uQ1wI+5UGp42Rxxs9g3rrQkcoENvkPBKX7ecSTaSUoGUT2y9htEv7dN7LHPyQ6v/IAQ yAvGVYgZEhZd+md/MV1IftjsjqHPnD+fX7ttFJwjhRjYmNLBiaQP81t5wouSKRjV5cCX 524A== X-Forwarded-Encrypted: i=1; AJvYcCVJ1mLL9TGHS4lTn2+Yin8RVlMpPW57JUi5Ln2NBbwLrQYuna9dk2wApPK5Wsf7GvOFdbdqXaDKuXPrhi7PTbycvWclnpg=@freebsd.org, AJvYcCVx1ApYgdy5D5ok0xs/nzPoMDzwD6w/oQICfAOvINJR8ic1MKBVYpdJKWj9wRcwT9BkBEIIwWMqKj+H/zJ4F2m4GqJz@freebsd.org X-Gm-Message-State: AOJu0YwdcLezqQsjFh/YXZtMTPTgvbNJ8Ndj1jzD1MJbX7lSXhRlTjQf CqKHHkdZIRIYLdqBjslkgIP4cuWwmQvkz4HOyJLOdS1R+iaOHEDL X-Gm-Gg: ASbGncv10jPHm6Qe/Ngzt2G4jAHh1i9Ks1DJSNFCMLXb9e0jYXefdA90pnH0xFu3P6z FfpxO7epTPGuqiTYWMECGXOB+gtxFMk29kn0yov7jkHldMQaEz47OUxK56lfNl45vKm9J9Mkhjt zwTYSWE2CPnj3zaqDBRulKjtx/tCtClRyBek2lp4l44SG111I/ywx537i66+8QeFnYDfQiRk73L 7zX1/tygp5E1HZMF9r0DIk45VnbPgeP1mdnvD6ysbfYkoU= X-Google-Smtp-Source: AGHT+IHpWNPvAQVgJ69fwXpugRhW4POllzhwayKbpNDjusd659ezEtcf7I1GdIs1xMRrToB8R4M6ew== X-Received: by 2002:a05:6512:2820:b0:53d:e41a:c1a5 with SMTP id 2adb3069b0e04-53df0115095mr8053865e87.57.1732898649187; Fri, 29 Nov 2024 08:44:09 -0800 (PST) Received: from pustak.ultrahub ([84.68.156.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434aa781200sm88923365e9.25.2024.11.29.08.44.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Nov 2024 08:44:08 -0800 (PST) Date: Fri, 29 Nov 2024 16:44:07 +0000 From: Edward Tomasz Napierala To: Konstantin Belousov 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: Mail-Followup-To: Konstantin Belousov , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org 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: 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:15169, ipnet:2a00:1450::/32, country:US] X-Rspamd-Queue-Id: 4Y0Jt337x2z4btp X-Spamd-Bar: ---- On 1129T1724, Konstantin Belousov wrote: > 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. Yeah, I thought about that too. In the end I decided to go with the simpler API, because I like how it mirrors fchdir(2); both do something fundamentally very similar, they set the default starting points for path lookups. And we never had the need to add fchdirat(2).