All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Theodore Ts'o <tytso@mit.edu>
Cc: Matthew Wilcox <willy@infradead.org>,
	Hao Sun <sunhao.th@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-fsdevel@vger.kernel.org, viro@zeniv.linux.org.uk,
	Christoph Hellwig <hch@lst.de>
Subject: Re: WARNING in __kernel_read
Date: Wed, 6 Oct 2021 15:10:43 -0700	[thread overview]
Message-ID: <202110061510.24208C2@keescook> (raw)
In-Reply-To: <YV2rQnl1kJ84C1RV@mit.edu>

On Wed, Oct 06, 2021 at 09:57:22AM -0400, Theodore Ts'o wrote:
> On Wed, Oct 06, 2021 at 01:17:32PM +0100, Matthew Wilcox wrote:
> > finit_module() is not the only caller of kernel_read_file_from_fd()
> > which passes it a fd that userspace passed in, for example
> > kexec_file_load() doesn't validate the fd either.  We could validate
> > the fd in individual syscalls, in kernel_read_file_from_fd()
> > or just do what vfs_read() does and return -EBADF without warning.
> 
> My suggestion would be to do both, and keep a WARN() in
> __kernel_read(), since that should never happen (and we want a stack
> trace if it does).

Agreed.

-- 
Kees Cook

  reply	other threads:[~2021-10-06 22:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-06  9:33 WARNING in __kernel_read Hao Sun
2021-10-06 12:17 ` Matthew Wilcox
2021-10-06 13:57   ` Theodore Ts'o
2021-10-06 22:10     ` Kees Cook [this message]
2021-10-12  6:21   ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2020-07-13  7:03 syzbot
2020-07-14 11:02 ` Christoph Hellwig
2020-07-23 14:17   ` Cengiz Can
2020-07-23 15:51     ` Eric Biggers

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=202110061510.24208C2@keescook \
    --to=keescook@chromium.org \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sunhao.th@gmail.com \
    --cc=tytso@mit.edu \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    /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.