All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: David Laight <David.Laight@aculab.com>,
	Christoph Hellwig <hch@lst.de>,
	Eric Biggers <ebiggers@kernel.org>,
	"syzbot+51177e4144d764827c45@syzkaller.appspotmail.com" 
	<syzbot+51177e4144d764827c45@syzkaller.appspotmail.com>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"syzkaller-bugs@googlegroups.com"
	<syzkaller-bugs@googlegroups.com>,
	"viro@zeniv.linux.org.uk" <viro@zeniv.linux.org.uk>
Subject: Re: WARNING in __kernel_read (2)
Date: Tue, 29 Sep 2020 12:21:52 +0200	[thread overview]
Message-ID: <20200929102152.GA14610@lst.de> (raw)
In-Reply-To: <CACT4Y+ax5YN5r=zL1NaxB_9S_7e6aUiL3tmBc6-8UMwuJpnn_Q@mail.gmail.com>

On Tue, Sep 29, 2020 at 10:21:19AM +0200, Dmitry Vyukov wrote:
> On Tue, Sep 29, 2020 at 10:06 AM David Laight <David.Laight@aculab.com> wrote:
> >
> > From: Christoph Hellwig
> > > Sent: 29 September 2020 07:56
> > >
> > > On Mon, Sep 28, 2020 at 11:46:48PM -0700, Eric Biggers wrote:
> > > > > Linus asked for it.  What is the call chain that we hit it with?
> > > >
> > > > Call Trace:
> > > >  kernel_read+0x52/0x70 fs/read_write.c:471
> > > >  kernel_read_file fs/exec.c:989 [inline]
> > > >  kernel_read_file+0x2e5/0x620 fs/exec.c:952
> > > >  kernel_read_file_from_fd+0x56/0xa0 fs/exec.c:1076
> > > >  __do_sys_finit_module+0xe6/0x190 kernel/module.c:4066
> > > >  do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
> > > >  entry_SYSCALL_64_after_hwframe+0x44/0xa9
> > > >
> > > > See the email from syzbot for the full details:
> > > > https://lkml.kernel.org/linux-fsdevel/000000000000da992305b02e9a51@google.com
> > >
> > > Passing a fs without read permissions definitively looks bogus for
> > > the finit_module syscall.  So I think all we need is an extra check
> > > to validate the fd.
> >
> > The sysbot test looked like it didn't even have a regular file.
> > I thought I saw a test for that - but it might be in a different path.
> >
> > You do need to ensure that 'exec' doesn't need read access.
> 
> The test tried to load a module from /dev/input/mouse
> 
> r2 = syz_open_dev$mouse(&(0x7f0000000000)='/dev/input/mouse#\x00',
> 0x101, 0x109887)
> finit_module(r2, 0x0, 0x0)
> 
> because... why not? Everything is a file! :)

Yes, syzbot is fine here.  It is the modules code that needs to better
verify the fd.

      reply	other threads:[~2020-09-29 10:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-26  2:58 WARNING in __kernel_read (2) syzbot
2020-09-26 11:15 ` David Laight
2020-09-26 13:17   ` David Laight
2020-09-28 22:14     ` Eric Biggers
2020-09-29  6:38       ` Christoph Hellwig
2020-09-29  6:46         ` Eric Biggers
2020-09-29  6:56           ` Christoph Hellwig
2020-09-29  8:06             ` David Laight
2020-09-29  8:21               ` Dmitry Vyukov
2020-09-29 10:21                 ` Christoph Hellwig [this message]

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=20200929102152.GA14610@lst.de \
    --to=hch@lst.de \
    --cc=David.Laight@aculab.com \
    --cc=dvyukov@google.com \
    --cc=ebiggers@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+51177e4144d764827c45@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=viro@zeniv.linux.org.uk \
    /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.