Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp131725rwb; Thu, 27 Jul 2023 10:19:12 -0700 (PDT) X-Google-Smtp-Source: APBJJlH8Lc60Qqoe01e+r3/zRuLN4z9qcLhlvy2PCvQpSDyvQr3EhnXIoTseo0plKR59Q2ngbJ/e X-Received: by 2002:a17:902:f547:b0:1bb:55be:e198 with SMTP id h7-20020a170902f54700b001bb55bee198mr37758plf.0.1690478351948; Thu, 27 Jul 2023 10:19:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690478351; cv=none; d=google.com; s=arc-20160816; b=bQw90foJ9At/1cxBMZcZcH+pISDgScvUpNofKpb+r6AMROYZqOfc4AKT25iGthUMbm Q5w4jknCcZJtdxDBAbI7YFXKba+qndlvQpukQfDJbMXa6tXntGBbzWTBybDpm6VLYAX5 VR5eGQuwieOQ71e6rPnN7SUQnZBCS0zR4JIdaafRRmfEQ9mjYO86MmrmQSh3WqnF3gAf /aO4K6yNff/fSuPHypddWbzHdqyuMhu1bAxdAJVUK9Quc6BPzlE1unJrGhRSlWkD6hUF vnMBd7XC/8f/n139zpRfiDKnWiUNZlH6x54H6d6QpoBrSmZHeiISc936prLkMAc8ZpxY W1+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0pnlsYrWEye5M1ImLz4bQv+hHDkMr7rXA34lGyEPYkk=; fh=tHLeHkxpFvFxAyJSYGaYZ8xJAwYaZXO1k4959sqDmPg=; b=w4BeiFnkgxsRUZLQS6cbAmmH0lDpzCnz8hUR7XRIqU5d3MpsLWWxBqQ8l9vbHmEzxH fg7tMwufGlgK6QJEAz6zTNqRVcHwMXbmPy8gWvpzFu5TGrCBgQjhhGhkqRtuI/q/Ky5O G4vMoVj0Xx4TzLWbna2ULOmgH5Q+TeQxUHfaHzYmPe6vhLqdG519TzKDObydWlXj7AwQ efL+tIvy9x5N55lGMJDkuWtW2AU9DscvxMUr55+le9SA6D6aI6zriYl9Tt1sFEEsGlaZ 2RdsR8aaF8a0ehazYzq9PGVZVJ6nirwcxmo/kKILKgq9cwzJ73W7x6QdTbKA4u1lYWCZ G1Kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sAR5rAZf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b11-20020a170902d50b00b001b9d9b01303si1533013plg.628.2023.07.27.10.18.59; Thu, 27 Jul 2023 10:19:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sAR5rAZf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231986AbjG0RDM (ORCPT + 99 others); Thu, 27 Jul 2023 13:03:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229526AbjG0RDK (ORCPT ); Thu, 27 Jul 2023 13:03:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEBD59E; Thu, 27 Jul 2023 10:03:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6A51761EE5; Thu, 27 Jul 2023 17:03:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F36DC433C7; Thu, 27 Jul 2023 17:02:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690477387; bh=dRinFx40BRIrMwg/8epwp+lbWEUZUugvI2zcPLmbs6o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sAR5rAZfLiN5wJdY9U15gQ+2zoDM6Q7hVZtIHJDTHH3SMwSc6rlEIKvPsqk5cg3Xg AnK5C2Dn3qHE9/zOovZJD+aFBMhlS1NqJawkK5/s4w9i3bPzaSYhofqqqKdEv6EEDb RtYXOrAZMbdXRoYQuKrdmE7RTPcMhBa0fkyPAx5iDnXWgAEVUJ3Aj6CGpfOlUJUxxW 8nidLRiIuhUXXQC5j/4yspRCD2nyMbAbSjNyAqO2bH4dx6cYM4R62nwXAEseaQd5cM YRFCocsOOhANZ2EdBrrnT78bTY++zOkqtL+nF+3DXHIOv3NNTYaDz5jmZh2VKAyKCQ noXRpmWJsxuAA== Date: Thu, 27 Jul 2023 19:02:53 +0200 From: Christian Brauner To: Andreas Schwab Cc: David Laight , 'Aleksa Sarai' , Alexey Gladkov , LKML , Arnd Bergmann , "linux-api@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "viro@zeniv.linux.org.uk" , "James.Bottomley@hansenpartnership.com" , "acme@kernel.org" , "alexander.shishkin@linux.intel.com" , "axboe@kernel.dk" , "benh@kernel.crashing.org" , "borntraeger@de.ibm.com" , "bp@alien8.de" , "catalin.marinas@arm.com" , "christian@brauner.io" , "dalias@libc.org" , "davem@davemloft.net" , "deepa.kernel@gmail.com" , "deller@gmx.de" , "dhowells@redhat.com" , "fenghua.yu@intel.com" , "fweimer@redhat.com" , "geert@linux-m68k.org" , "glebfm@altlinux.org" , "gor@linux.ibm.com" , "hare@suse.com" , "hpa@zytor.com" , "ink@jurassic.park.msu.ru" , "jhogan@kernel.org" , "kim.phillips@arm.com" , "ldv@altlinux.org" , "linux-alpha@vger.kernel.org" , "linux-arch@vger.kernel.org" , "linux-ia64@vger.kernel.org" , "linux-m68k@lists.linux-m68k.org" , "linux-mips@vger.kernel.org" , "linux-parisc@vger.kernel.org" , "linux-s390@vger.kernel.org" , "linux-sh@vger.kernel.org" , "linux@armlinux.org.uk" , "linuxppc-dev@lists.ozlabs.org" , "luto@kernel.org" , "mattst88@gmail.com" , "mingo@redhat.com" , "monstr@monstr.eu" , "mpe@ellerman.id.au" , "namhyung@kernel.org" , "paulus@samba.org" , "peterz@infradead.org" , "ralf@linux-mips.org" , "sparclinux@vger.kernel.org" , "stefan@agner.ch" , "tglx@linutronix.de" , "tony.luck@intel.com" , "tycho@tycho.ws" , "will@kernel.org" , "x86@kernel.org" , "ysato@users.sourceforge.jp" , Palmer Dabbelt Subject: Re: [PATCH v4 2/5] fs: Add fchmodat2() Message-ID: <20230727-zerrt-leitmotiv-9e8b60abf690@brauner> References: <87ila5jp2y.fsf@igel.home> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87ila5jp2y.fsf@igel.home> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 27, 2023 at 06:28:53PM +0200, Andreas Schwab wrote: > On Jul 27 2023, David Laight wrote: > > > From: Aleksa Sarai > >> Sent: 25 July 2023 17:36 > > ... > >> We almost certainly want to support AT_EMPTY_PATH at the same time. > >> Otherwise userspace will still need to go through /proc when trying to > >> chmod a file handle they have. > > > > That can't be allowed. > > IIUC, fchmodat2(fd, "", m, AT_EMPTY_PATH) is equivalent to fchmod(fd, > m). With that, new architectures only need to implement the fchmodat2 > syscall to cover all chmod variants. There's a difference though as fchmod() doesn't work with O_PATH file descriptors while AT_EMPTY_PATH does. Similar to how fchown() doesn't work with O_PATH file descriptors. However, we do allow AT_EMPTY_PATH with fchownat() so there's no reason to not allow it for fchmodat2(). But it's a bit of a shame that O_PATH looks less and less like O_PATH. It came from can-do-barely-anything to can-do-quite-a-lot-of-things over the years. In any case, AT_EMPTY_PATH for fchmodat2() can be an additional patch on top.