From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47F54C43461 for ; Wed, 16 Sep 2020 06:17:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 055BA21D7D for ; Wed, 16 Sep 2020 06:17:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600237064; bh=kAkRcZ8M/UW3Dl9iN5zhPGSOU71JhfTvi7/ksXTCTy8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=epusEYs4Zb2GygLniyZkL5QFRwfTHvgV5EBCDEZQKecsH8jRWgTzuzGmwp2dW3gmT 6WJTxU5vn5ebNgaEj46dn9mpQS8zqYJCERMqyvirN0R2pMNZYEwflov15I4oxX563c PuH0fMgsr7PEhs8kO4RudGIE5nME1nfNI/0tMizo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726093AbgIPGRm (ORCPT ); Wed, 16 Sep 2020 02:17:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:42594 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726128AbgIPGRl (ORCPT ); Wed, 16 Sep 2020 02:17:41 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 81814208E4; Wed, 16 Sep 2020 06:17:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600237061; bh=kAkRcZ8M/UW3Dl9iN5zhPGSOU71JhfTvi7/ksXTCTy8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JO7JrnUNreEqXiYcukH57/YA+z9hYDvRoMLGMo9P3ylTlShw+roBNWbKTjsuxvbHW neSfnus98EEC8jps5YQZ1G7AXCq3TxSc1leIbisRx2oepi/79N7Zrqbp4ep3dczm3v 9cYxo6iWGbBfhmjTciE2qBi04mdXOXogWF8FYDyo= Date: Wed, 16 Sep 2020 08:18:15 +0200 From: Greg KH To: Rich Felker Cc: linux-api@vger.kernel.org, Alexander Viro , Christoph Hellwig , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/2] vfs: block chmod of symlinks Message-ID: <20200916061815.GB142621@kroah.com> References: <20200916002157.GO3265@brightrain.aerifal.cx> <20200916002253.GP3265@brightrain.aerifal.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200916002253.GP3265@brightrain.aerifal.cx> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 15, 2020 at 08:22:54PM -0400, Rich Felker wrote: > It was discovered while implementing userspace emulation of fchmodat > AT_SYMLINK_NOFOLLOW (using O_PATH and procfs magic symlinks; otherwise > it's not possible to target symlinks with chmod operations) that some > filesystems erroneously allow access mode of symlinks to be changed, > but return failure with EOPNOTSUPP (see glibc issue #14578 and commit > a492b1e5ef). This inconsistency is non-conforming and wrong, and the > consensus seems to be that it was unintentional to allow link modes to > be changed in the first place. > > Signed-off-by: Rich Felker > --- > fs/open.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/fs/open.c b/fs/open.c > index 9af548fb841b..cdb7964aaa6e 100644 > --- a/fs/open.c > +++ b/fs/open.c > @@ -570,6 +570,12 @@ int chmod_common(const struct path *path, umode_t mode) > struct iattr newattrs; > int error; > > + /* Block chmod from getting to fs layer. Ideally the fs would either > + * allow it or fail with EOPNOTSUPP, but some are buggy and return > + * an error but change the mode, which is non-conforming and wrong. */ > + if (S_ISLNK(inode->i_mode)) > + return -EOPNOTSUPP; I still fail to understand why these "buggy" filesystems can not be fixed. Why are you papering over a filesystem-specific-bug with this core kernel change that we will forever have to keep? thanks, greg k-h