RE: [PATCH v5 3/7] fs: Add fd_install_received() wrapper for __fd_install_received()

2020-06-19 Thread David Laight
From: Kees Cook > Sent: 18 June 2020 21:13 > On Thu, Jun 18, 2020 at 05:49:19AM +, Sargun Dhillon wrote: > > On Wed, Jun 17, 2020 at 03:03:23PM -0700, Kees Cook wrote: > > > [...] > > > static inline int fd_install_received_user(struct file *file, int __user > > > *ufd, > > >

Re: [PATCH v5 3/7] fs: Add fd_install_received() wrapper for __fd_install_received()

2020-06-18 Thread Kees Cook
On Thu, Jun 18, 2020 at 05:49:19AM +, Sargun Dhillon wrote: > On Wed, Jun 17, 2020 at 03:03:23PM -0700, Kees Cook wrote: > > [...] > > static inline int fd_install_received_user(struct file *file, int __user > > *ufd, > >unsigned int o_flags) > > { > >

Re: [PATCH v5 3/7] fs: Add fd_install_received() wrapper for __fd_install_received()

2020-06-17 Thread Sargun Dhillon
On Wed, Jun 17, 2020 at 03:03:23PM -0700, Kees Cook wrote: > For both pidfd and seccomp, the __user pointer is not used. Update > __fd_install_received() to make writing to ufd optional via a NULL check. > However, for the fd_install_received_user() wrapper, ufd is NULL checked > so an -EFAULT can

[PATCH v5 3/7] fs: Add fd_install_received() wrapper for __fd_install_received()

2020-06-17 Thread Kees Cook
For both pidfd and seccomp, the __user pointer is not used. Update __fd_install_received() to make writing to ufd optional via a NULL check. However, for the fd_install_received_user() wrapper, ufd is NULL checked so an -EFAULT can be returned to avoid changing the SCM_RIGHTS interface behavior. Ad