linux-hardening.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: NeilBrown <neil@brown.name>
Cc: Eric Van Hensbergen <ericvh@kernel.org>,
	Latchesar Ionkov <lucho@ionkov.net>,
	 Dominique Martinet <asmadeus@codewreck.org>,
	Christian Schoenebeck <linux_oss@crudebyte.com>,
	David Sterba	 <dsterba@suse.com>,
	David Howells <dhowells@redhat.com>,
	Marc Dionne	 <marc.dionne@auristor.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	 Christian Brauner	 <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
	"Tigran A. Aivazian"	 <aivazian.tigran@gmail.com>,
	Chris Mason <clm@fb.com>, Xiubo Li	 <xiubli@redhat.com>,
	Ilya Dryomov <idryomov@gmail.com>,
	Jan Harkes	 <jaharkes@cs.cmu.edu>,
	coda@cs.cmu.edu, Tyler Hicks <code@tyhicks.com>,
	Jeremy Kerr <jk@ozlabs.org>, Ard Biesheuvel <ardb@kernel.org>,
	Namjae Jeon <linkinjeon@kernel.org>,
	 Sungjong Seo <sj1557.seo@samsung.com>,
	Yuezhang Mo <yuezhang.mo@sony.com>, Theodore Ts'o <tytso@mit.edu>,
	 Andreas Dilger <adilger.kernel@dilger.ca>,
	Jaegeuk Kim <jaegeuk@kernel.org>, Chao Yu <chao@kernel.org>,
	OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>,
	Miklos Szeredi <miklos@szeredi.hu>,
	Andreas Gruenbacher	 <agruenba@redhat.com>,
	Viacheslav Dubeyko <slava@dubeyko.com>,
	John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,
	Yangtao Li <frank.li@vivo.com>,
	Richard Weinberger <richard@nod.at>,
	 Anton Ivanov <anton.ivanov@cambridgegreys.com>,
	Johannes Berg <johannes@sipsolutions.net>,
	Mikulas Patocka	 <mikulas@artax.karlin.mff.cuni.cz>,
	Muchun Song <muchun.song@linux.dev>,
	 Oscar Salvador <osalvador@suse.de>,
	David Hildenbrand <david@redhat.com>,
	David Woodhouse <dwmw2@infradead.org>,
	 Dave Kleikamp <shaggy@kernel.org>,
	Trond Myklebust <trondmy@kernel.org>,
	Anna Schumaker <anna@kernel.org>,
	 Ryusuke Konishi <konishi.ryusuke@gmail.com>,
	Konstantin Komarov <almaz.alexandrovich@paragon-software.com>,
	 Mark Fasheh <mark@fasheh.com>, Joel Becker <jlbec@evilplan.org>,
	Joseph Qi <joseph.qi@linux.alibaba.com>,
	 Bob Copeland <me@bobcopeland.com>,
	Mike Marshall <hubcap@omnibond.com>,
	Martin Brandenburg	 <martin@omnibond.com>,
	Amir Goldstein <amir73il@gmail.com>,
	Steve French	 <sfrench@samba.org>,
	Paulo Alcantara <pc@manguebit.org>,
	Ronnie Sahlberg	 <ronniesahlberg@gmail.com>,
	Shyam Prasad N <sprasad@microsoft.com>,
	Tom Talpey	 <tom@talpey.com>,
	Bharath SM <bharathsm@microsoft.com>,
	Zhihao Cheng	 <chengzhihao1@huawei.com>,
	Hans de Goede <hansg@kernel.org>,
	Carlos Maiolino	 <cem@kernel.org>,
	Hugh Dickins <hughd@google.com>,
	Baolin Wang	 <baolin.wang@linux.alibaba.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	 Kees Cook <kees@kernel.org>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
		linux-kernel@vger.kernel.org, v9fs@lists.linux.dev,
		linux-fsdevel@vger.kernel.org, linux-afs@lists.infradead.org,
		linux-btrfs@vger.kernel.org, ceph-devel@vger.kernel.org,
		codalist@coda.cs.cmu.edu, ecryptfs@vger.kernel.org,
	linux-efi@vger.kernel.org,  linux-ext4@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net,  gfs2@lists.linux.dev,
	linux-um@lists.infradead.org, linux-mm@kvack.org,
	 linux-mtd@lists.infradead.org,
	jfs-discussion@lists.sourceforge.net,  linux-nfs@vger.kernel.org,
	linux-nilfs@vger.kernel.org, ntfs3@lists.linux.dev,
		ocfs2-devel@lists.linux.dev,
	linux-karma-devel@lists.sourceforge.net,
		devel@lists.orangefs.org, linux-unionfs@vger.kernel.org,
		linux-cifs@vger.kernel.org, samba-technical@lists.samba.org,
		linux-xfs@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH] vfs: remove the excl argument from the ->create() inode_operation
Date: Thu, 06 Nov 2025 13:01:20 -0500	[thread overview]
Message-ID: <f5927a9bb985b9ad241bc5f9fc32acfd35340222.camel@kernel.org> (raw)
In-Reply-To: <6758176514cdd6e2ceacb3bd0e4d63fb8784b7c6.camel@kernel.org>

On Thu, 2025-11-06 at 07:07 -0500, Jeff Layton wrote:
> On Thu, 2025-11-06 at 08:23 +1100, NeilBrown wrote:
> > On Thu, 06 Nov 2025, Jeff Layton wrote:
> > > Since ce8644fcadc5 ("lookup_open(): expand the call of vfs_create()"),
> > > the "excl" argument to the ->create() inode_operation is always set to
> > > true. Remove it, and fix up all of the create implementations.
> > 
> > nonono
> > 
> > 
> > > @@ -3802,7 +3802,7 @@ static struct dentry *lookup_open(struct nameidata *nd, struct file *file,
> > >  		}
> > >  
> > >  		error = dir_inode->i_op->create(idmap, dir_inode, dentry,
> > > -						mode, open_flag & O_EXCL);
> > > +						mode);
> > 
> > "open_flag & O_EXCL" is not the same as "true".
> > 
> > It is true that "all calls to vfs_create() pass true for 'excl'"
> > The same is NOT true for inode_operations.create.
> > 
> 
> I don't think this is a problem, actually:
> 
> Almost all of the existing ->create() operations ignore the "excl"
> bool. There are only two that I found that do not: NFS and GFS2. Both
> of those have an ->atomic_open() operation though, so lookup_open()
> will never call ->create() for those filesystems. This means that -
> > create() _is_ always called with excl == true.

How about this for a revised changelog, which makes the above clear:

    vfs: remove the excl argument from the ->create() inode_operation
    
    Since ce8644fcadc5 ("lookup_open(): expand the call of vfs_create()"),
    the "excl" argument to the ->create() inode_operation is always set to
    true in vfs_create().
    
    There is another call to ->create() in lookup_open() that can set it to
    either true or false. All of the ->create() operations in the kernel
    ignore the excl argument, except for NFS and GFS2. Both NFS and GFS2
    have an ->atomic_open() operation, however so lookup_open() will never
    call ->create() on those filesystems.
    
    Remove the "excl" argument from the ->create() operation, and fix up the
    filesystems accordingly.

Maybe we also need some comments or updates to Documentation/ to make
it clear that ->create() always implies O_EXCL semantics?
-- 
Jeff Layton <jlayton@kernel.org>

  reply	other threads:[~2025-11-06 18:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-05 20:24 [PATCH] vfs: remove the excl argument from the ->create() inode_operation Jeff Layton
2025-11-05 21:23 ` NeilBrown
2025-11-06 12:07   ` Jeff Layton
2025-11-06 18:01     ` Jeff Layton [this message]
2025-11-07  0:00       ` NeilBrown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f5927a9bb985b9ad241bc5f9fc32acfd35340222.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=adilger.kernel@dilger.ca \
    --cc=agruenba@redhat.com \
    --cc=aivazian.tigran@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=almaz.alexandrovich@paragon-software.com \
    --cc=amir73il@gmail.com \
    --cc=anna@kernel.org \
    --cc=anton.ivanov@cambridgegreys.com \
    --cc=ardb@kernel.org \
    --cc=asmadeus@codewreck.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=bharathsm@microsoft.com \
    --cc=brauner@kernel.org \
    --cc=cem@kernel.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=chao@kernel.org \
    --cc=chengzhihao1@huawei.com \
    --cc=clm@fb.com \
    --cc=coda@cs.cmu.edu \
    --cc=codalist@coda.cs.cmu.edu \
    --cc=code@tyhicks.com \
    --cc=david@redhat.com \
    --cc=devel@lists.orangefs.org \
    --cc=dhowells@redhat.com \
    --cc=dsterba@suse.com \
    --cc=dwmw2@infradead.org \
    --cc=ecryptfs@vger.kernel.org \
    --cc=ericvh@kernel.org \
    --cc=frank.li@vivo.com \
    --cc=gfs2@lists.linux.dev \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=gustavoars@kernel.org \
    --cc=hansg@kernel.org \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=hubcap@omnibond.com \
    --cc=hughd@google.com \
    --cc=idryomov@gmail.com \
    --cc=jack@suse.cz \
    --cc=jaegeuk@kernel.org \
    --cc=jaharkes@cs.cmu.edu \
    --cc=jfs-discussion@lists.sourceforge.net \
    --cc=jk@ozlabs.org \
    --cc=jlbec@evilplan.org \
    --cc=johannes@sipsolutions.net \
    --cc=joseph.qi@linux.alibaba.com \
    --cc=kees@kernel.org \
    --cc=konishi.ryusuke@gmail.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-karma-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=linux-nilfs@vger.kernel.org \
    --cc=linux-um@lists.infradead.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=linux_oss@crudebyte.com \
    --cc=lucho@ionkov.net \
    --cc=marc.dionne@auristor.com \
    --cc=mark@fasheh.com \
    --cc=martin@omnibond.com \
    --cc=me@bobcopeland.com \
    --cc=miklos@szeredi.hu \
    --cc=mikulas@artax.karlin.mff.cuni.cz \
    --cc=muchun.song@linux.dev \
    --cc=neil@brown.name \
    --cc=ntfs3@lists.linux.dev \
    --cc=ocfs2-devel@lists.linux.dev \
    --cc=osalvador@suse.de \
    --cc=pc@manguebit.org \
    --cc=richard@nod.at \
    --cc=ronniesahlberg@gmail.com \
    --cc=samba-technical@lists.samba.org \
    --cc=sfrench@samba.org \
    --cc=shaggy@kernel.org \
    --cc=sj1557.seo@samsung.com \
    --cc=slava@dubeyko.com \
    --cc=sprasad@microsoft.com \
    --cc=tom@talpey.com \
    --cc=trondmy@kernel.org \
    --cc=tytso@mit.edu \
    --cc=v9fs@lists.linux.dev \
    --cc=viro@zeniv.linux.org.uk \
    --cc=xiubli@redhat.com \
    --cc=yuezhang.mo@sony.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).