From: Eric Biggers <ebiggers3@gmail.com>
To: syzbot
<bot+2797c18fc195e3e240c3c3e7837a14130e157fb0@syzkaller.appspotmail.com>
Cc: adobriyan@gmail.com, akpm@linux-foundation.org, arnd@arndb.de,
dan.carpenter@oracle.com, dave.jiang@intel.com,
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com,
viro@zeniv.linux.org.uk, linux-block@vger.kernel.org
Subject: Re: WARNING in kmalloc_slab (3)
Date: Sun, 3 Dec 2017 12:16:08 -0800 [thread overview]
Message-ID: <20171203201608.GC844@zzz.localdomain> (raw)
In-Reply-To: <f403043d11ccfea019055f705d18@google.com>
+Cc linux-block
On Sun, Dec 03, 2017 at 06:25:01AM -0800, syzbot wrote:
> WARNING: CPU: 0 PID: 3081 at mm/slab_common.c:971 kmalloc_slab+0x5d/0x70
> mm/slab_common.c:971
> Kernel panic - not syncing: panic_on_warn set ...
>
[...]
> __do_kmalloc mm/slab.c:3706 [inline]
> __kmalloc+0x25/0x760 mm/slab.c:3720
> kmalloc include/linux/slab.h:504 [inline]
> relay_create_buf kernel/relay.c:172 [inline]
> relay_open_buf.part.10+0xc8/0x9b0 kernel/relay.c:449
> relay_open_buf kernel/relay.c:446 [inline]
> relay_open+0x57a/0xa40 kernel/relay.c:596
> do_blk_trace_setup+0x4a4/0xcd0 kernel/trace/blktrace.c:544
> __blk_trace_setup+0xb6/0x140 kernel/trace/blktrace.c:589
> blk_trace_ioctl+0x1d5/0x2a0 kernel/trace/blktrace.c:728
> blkdev_ioctl+0x1845/0x1e00 block/ioctl.c:587
> block_ioctl+0xea/0x130 fs/block_dev.c:1860
> vfs_ioctl fs/ioctl.c:46 [inline]
> do_vfs_ioctl+0x1b1/0x1530 fs/ioctl.c:686
> SYSC_ioctl fs/ioctl.c:701 [inline]
> SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692
> entry_SYSCALL_64_fastpath+0x1f/0x96
Looks like BLKTRACESETUP doesn't limit the '.buf_nr' parameter, allowing anyone
who can open a block device to cause an extremely large kmalloc. Here's a
simplified reproducer:
#include <fcntl.h>
#include <linux/blktrace_api.h>
#include <linux/fs.h>
#include <sys/ioctl.h>
int main()
{
int fd;
struct blk_user_trace_setup setup = {
.buf_size = 100,
.buf_nr = 1000000,
};
fd = open("/dev/loop0", O_RDWR);
ioctl(fd, BLKTRACESETUP, &setup);
}
next prev parent reply other threads:[~2017-12-03 20:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-03 14:25 syzbot
2017-12-03 20:16 ` Eric Biggers [this message]
2017-12-04 8:14 ` Dan Carpenter
2017-12-04 8:18 ` Dmitry Vyukov
2017-12-04 9:26 ` Dan Carpenter
2017-12-12 15:50 ` Dmitry Vyukov
2017-12-12 21:22 ` Eric Biggers
2018-02-07 4:58 ` Dmitry Vyukov
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=20171203201608.GC844@zzz.localdomain \
--to=ebiggers3@gmail.com \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=bot+2797c18fc195e3e240c3c3e7837a14130e157fb0@syzkaller.appspotmail.com \
--cc=dan.carpenter@oracle.com \
--cc=dave.jiang@intel.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®