All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
	Mimi Zohar <zohar@linux.ibm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-fsdevel@vger.kernel.org, Hao Sun <sunhao.th@gmail.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH] vfs: Check fd has read access in kernel_read_file_from_fd()
Date: Thu, 7 Oct 2021 16:39:16 -0700	[thread overview]
Message-ID: <202110071639.1CBFCF1@keescook> (raw)
In-Reply-To: <20211007220110.600005-1-willy@infradead.org>

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@gmail.com>
> Fixes: b844f0ecbc56 ("vfs: define kernel_copy_file_from_fd()")
> Cc: stable@vger.kernel.org
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Reviewed-by: Kees Cook <keescook@chromium.org>

Thanks for chasing this down!

-- 
Kees Cook

  reply	other threads:[~2021-10-07 23:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-07 22:01 [PATCH] vfs: Check fd has read access in kernel_read_file_from_fd() Matthew Wilcox (Oracle)
2021-10-07 23:39 ` Kees Cook [this message]
2021-10-11  8:54 ` Christian Brauner

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=202110071639.1CBFCF1@keescook \
    --to=keescook@chromium.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=sunhao.th@gmail.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    --cc=zohar@linux.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.