Re: [PATCH] vfs: Check fd has read access in kernel_read_file_from_fd()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 07, 2021 at 11:01:10PM +0100, Matthew Wilcox (Oracle) wrote:
> If we open a file without read access and then pass the fd to a syscall
> whose implementation calls kernel_read_file_from_fd(), we get a warning
> from __kernel_read():
> 
>         if (WARN_ON_ONCE(!(file->f_mode & FMODE_READ)))
> 
> This currently affects both finit_module() and kexec_file_load(), but
> it could affect other syscalls in the future.
> 
> Reported-by: Hao Sun <sunhao.th@xxxxxxxxx>
> Fixes: b844f0ecbc56 ("vfs: define kernel_copy_file_from_fd()")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>

Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>

Thanks for chasing this down!

-- 
Kees Cook



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux