[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJfpeguhAfLiTi0DdYzU-y98TCJZn2GuHBJhkXGLWRCBU2GfSg@mail.gmail.com>
Date: Thu, 25 Mar 2021 15:52:28 +0100
From: Miklos Szeredi <miklos@...redi.hu>
To: Eric Biggers <ebiggers@...nel.org>
Cc: Miklos Szeredi <mszeredi@...hat.com>,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
Al Viro <viro@...iv.linux.org.uk>,
Andreas Dilger <adilger@...ger.ca>,
Andreas Gruenbacher <agruenba@...hat.com>,
Christoph Hellwig <hch@....de>,
"Darrick J . Wong" <djwong@...nel.org>,
Dave Kleikamp <shaggy@...nel.org>,
David Sterba <dsterba@...e.com>,
Jaegeuk Kim <jaegeuk@...nel.org>, Jan Kara <jack@...e.cz>,
Joel Becker <jlbec@...lplan.org>,
Matthew Garrett <matthew.garrett@...ula.com>,
Mike Marshall <hubcap@...ibond.com>,
Richard Weinberger <richard@....at>,
Ryusuke Konishi <konishi.ryusuke@...il.com>,
"Theodore Ts'o" <tytso@....edu>, Tyler Hicks <code@...icks.com>
Subject: Re: [PATCH 01/18] vfs: add miscattr ops
On Tue, Mar 23, 2021 at 1:24 AM Eric Biggers <ebiggers@...nel.org> wrote:
> > +int vfs_miscattr_set(struct dentry *dentry, struct miscattr *ma)
> > +{
> > + struct inode *inode = d_inode(dentry);
> > + struct miscattr old_ma = {};
> > + int err;
> > +
> > + if (d_is_special(dentry))
> > + return -ENOTTY;
> > +
> > + if (!inode->i_op->miscattr_set)
> > + return -ENOIOCTLCMD;
> > +
> > + if (!inode_owner_or_capable(inode))
> > + return -EPERM;
>
> Shouldn't this be EACCES, not EPERM?
$ git diff master.. | grep -C1 inode_owner_or_capable | grep
"^-.*\(EPERM\|EACCES\)" | cut -d- -f3 | sort | uniq -c
12 EACCES;
4 EPERM;
So EACCES would win if this was a democracy. However:
"[EACCES]
Permission denied. An attempt was made to access a file in a way
forbidden by its file access permissions."
"[EPERM]
Operation not permitted. An attempt was made to perform an operation
limited to processes with appropriate privileges or to the owner of a
file or other resource."
The EPERM description matches the semantics of
inode_owner_or_capable() exactly. It's a pretty clear choice.
Thanks,
Miklos
Powered by blists - more mailing lists