Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1590271

Re: [PATCH 1/2] vfs: implement fchmodat2() syscall

From Greg Kurz <groug@kaod.org>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] vfs: implement fchmodat2() syscall
Date 2017-03-01 12:50 +0100
Message-ID <tga9d-1UD-29@gated-at.bofh.it> (permalink)
References <tfTrH-7ry-3@gated-at.bofh.it> <tfUH8-8cC-35@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Tue, 28 Feb 2017 12:23:01 -0600
Eric Blake <eblake@redhat.com> wrote:

> On 02/28/2017 11:03 AM, Greg Kurz wrote:
> > According to the POSIX.1-2008 manual page [1], the fchmodat() function has
> > a flag argument which may be passed the following value:
> > 
> > AT_SYMLINK_NOFOLLOW
> >     If path names a symbolic link, then the mode of the symbolic link is
> >     changed.
> > 
> > and the following error may be returned:
> > 
> > [EOPNOTSUPP]
> >     The AT_SYMLINK_NOFOLLOW bit is set in the flag argument, path names a
> >     symbolic link, and the system does not support changing the mode of a
> >     symbolic link.
> > 
> > The linux kernel doesn't support changing the mode of a symbolic link, but
> > the current implementation doesn't even have a flag argument. It is then
> > up to userspace to deal with that. Unfortunately, it is impossible to
> > implement the POSIX behavior in a race-free manner.
> > 
> > This patch introduces a new fchmodat2() syscall with a flag argument to
> > address the issue.
> > 
> > [1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/chmod.html
> > 
> > Signed-off-by: Greg Kurz <groug@kaod.org>
> > ---  
> 
> Might also be worth mentioning that this patch is required in order to
> solve CVE-2016-9602, per discussion at
> https://lists.gnu.org/archive/html/qemu-devel/2017-02/msg06089.html
> 

True. I'll add a reference to it if I have to send a v2.

> > +++ b/include/linux/syscalls.h
> > @@ -775,6 +775,8 @@ asmlinkage long sys_futimesat(int dfd, const char __user *filename,
> >  asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode);
> >  asmlinkage long sys_fchmodat(int dfd, const char __user * filename,
> >  			     umode_t mode);
> > +asmlinkage long sys_fchmodat2(int dfd, const char __user *filename,
> > +			      umode_t mode, int flag);
> >  asmlinkage long sys_fchownat(int dfd, const char __user *filename, uid_t user,
> >  			     gid_t group, int flag);  
> 
> Is the indentation off here?
> 

This is linux style indent with tabs+spaces. FWIW it is displayed correctly
in vi and emacs (I've simply copied the sys_fchmodat() declaration).

> Reviewed-by: Eric Blake <eblake@redhat.com>
> 
> 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] vfs: implement fchmodat2() syscall Greg Kurz <groug@kaod.org> - 2017-02-28 18:10 +0100
  [PATCH 2/2] x86: wire up fchmodat2() syscall Greg Kurz <groug@kaod.org> - 2017-02-28 18:10 +0100
  Re: [PATCH 1/2] vfs: implement fchmodat2() syscall Eric Blake <eblake@redhat.com> - 2017-02-28 19:30 +0100
    Re: [PATCH 1/2] vfs: implement fchmodat2() syscall Eric Blake <eblake@redhat.com> - 2017-03-01 12:00 +0100
    Re: [PATCH 1/2] vfs: implement fchmodat2() syscall Greg Kurz <groug@kaod.org> - 2017-03-01 12:50 +0100
  Re: [PATCH 1/2] vfs: implement fchmodat2() syscall Michael Kerrisk <mtk.manpages@gmail.com> - 2017-03-01 10:10 +0100

csiph-web