Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp974596rwb; Fri, 28 Jul 2023 02:49:37 -0700 (PDT) X-Google-Smtp-Source: APBJJlHMl0ies4iRYl389msHsMUabs79bJ8GP6el4iKgEJEnU7YsCCh4nbf65K2UAIs39yLVhtHi X-Received: by 2002:aa7:d8d1:0:b0:522:1b93:4cf3 with SMTP id k17-20020aa7d8d1000000b005221b934cf3mr1276655eds.27.1690537777422; Fri, 28 Jul 2023 02:49:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690537777; cv=none; d=google.com; s=arc-20160816; b=N9Ye6qB4lyCnHwpOOtXeTy42TfImHo6manowC/J/spksnEQQbqj2oh4wIgtOrKxGBC RjQCvjrGuiN2HahhfeJuLw8yUDoA2rI+Nn1LCBPblqMe6s9YLUZQWqJbhmno42cvVowG OD420d21XFxPYvNfv5fuXi7gOaPOKqAXJHTDUoiB5/oajuApQ42S7uyh/xlec7gK1IRW XxcS+m50lLL5vmymzwj9dpDIcdFmU2WFGpTYD/ag6QITxkXlv5WEkSJH1a3ZPTHgDjBT xKoVxQBQ6Fa+C4+MVadTubfizCWUbqb2naaxGhJpl3nfG+iDf8O6wbgZplMzybELzENR 30bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=UWJy8hgdg7MGBp78aMCO7DIMTYsNfSIsqU2q7ssU6PQ=; fh=1ihIjx8Ss6X9VnxrVoJPLG8PLBqnUuF1sgANIlENvSw=; b=z6mstALaAYyUiOJ+So60XbethjVuvcbGj8RdV97yFreQM1lWwb5nrz5K44Ciny7kcF Nn/EULP7/Dh2Ub2VA69n0ngl5cAlgknxm+jBo9UNNZICXX7Wd4zvfxWw23cWx7CLH3mr 6nVoYOdEBcAGoZhJlEL8I406P9roVBZsYRG2Rps3wHSMH7iNvWlsf20bIVCYjKZk5VHY 5Crajcvs9diEkh3xiCS5KAFXncgdshBFzRja0Nnm3i/j/iuxSr2cmF0WmXn8oYBa918l 3tVSh/nGL5ak4P7l+D47kZpBUunYYrCtXUPDHXpjaAbWmgWkiYpQMC4jOotkXd5FRiCI mSBA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n26-20020a056402515a00b0052255161ea1si2182421edd.45.2023.07.28.02.49.12; Fri, 28 Jul 2023 02:49:37 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234960AbjG1Io1 convert rfc822-to-8bit (ORCPT + 99 others); Fri, 28 Jul 2023 04:44:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234957AbjG1IoH (ORCPT ); Fri, 28 Jul 2023 04:44:07 -0400 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.85.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6CB03A93 for ; Fri, 28 Jul 2023 01:44:03 -0700 (PDT) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with both STARTTLS and AUTH (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-66-QuWuNYGHMBmrzfdm4fjM8A-1; Fri, 28 Jul 2023 09:44:01 +0100 X-MC-Unique: QuWuNYGHMBmrzfdm4fjM8A-1 Received: from AcuMS.Aculab.com (10.202.163.4) by AcuMS.aculab.com (10.202.163.4) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Fri, 28 Jul 2023 09:43:58 +0100 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Fri, 28 Jul 2023 09:43:58 +0100 From: David Laight To: 'Aleksa Sarai' , Alexey Gladkov CC: 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() Thread-Topic: [PATCH v4 2/5] fs: Add fchmodat2() Thread-Index: AQHZwLFLeKGBJJpK+0qJRy2agWp2qK/O266A Date: Fri, 28 Jul 2023 08:43:58 +0000 Message-ID: References: <20230727.041348-imposing.uptake.velvet.nylon-712tDwzCAbCCoSGx@cyphar.com> <20230727.173441-loving.habit.lame.acrobat-V6VTPe8G4FRI@cyphar.com> In-Reply-To: <20230727.173441-loving.habit.lame.acrobat-V6VTPe8G4FRI@cyphar.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 ... > FWIW, I agree with Christian that these behaviours are not ideal (and > I'm working on a series that might allow for these things to be properly > blocked in the future) but there's also the consistency argument -- I > don't think fchownat() is much safer to allow in this way than > fchmodat() and (again) this behaviour is already possible through > procfs. If the 'through procfs' involves readlink("/proc/self/fd/n") and accessing through the returned path then the permission checks are different. Using the returned path requires search permissions on all the directories. This is all fine for xxxat() functions where a real open directory fd is supplied. But other cases definitely need a lot of thought to ensure they don't let programs acquire permissions they aren't supposed to have. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)