From: Eric Sandeen <sandeen@sandeen.net>
To: Luis Chamberlain <mcgrof@kernel.org>,
axboe@kernel.dk, viro@zeniv.linux.org.uk, bvanassche@acm.org,
gregkh@linuxfoundation.org, rostedt@goodmis.org,
mingo@redhat.com, jack@suse.cz, ming.lei@redhat.com,
nstange@suse.de, akpm@linux-foundation.org
Cc: mhocko@suse.com, yukuai3@huawei.com, linux-block@vger.kernel.org,
linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, Omar Sandoval <osandov@fb.com>,
Hannes Reinecke <hare@suse.com>, Michal Hocko <mhocko@kernel.org>,
syzbot+603294af2d01acfdd6da@syzkaller.appspotmail.com
Subject: Re: [PATCH 2/5] blktrace: fix debugfs use after free
Date: Wed, 15 Apr 2020 12:38:26 -0500 [thread overview]
Message-ID: <55401e02-f61c-25eb-271c-3ec7baf35e28@sandeen.net> (raw)
In-Reply-To: <20200414041902.16769-3-mcgrof@kernel.org>
On 4/13/20 11:18 PM, Luis Chamberlain wrote:
> On commit 6ac93117ab00 ("blktrace: use existing disk debugfs directory")
> merged on v4.12 Omar fixed the original blktrace code for request-based
> drivers (multiqueue). This however left in place a possible crash, if you
> happen to abuse blktrace in a way it was not intended.
>
> Namely, if you loop adding a device, setup the blktrace with BLKTRACESETUP,
> forget to BLKTRACETEARDOWN, and then just remove the device you end up
> with a panic:
I think this patch makes this all cleaner anyway, but - without the apparent
loop bug mentioned by Bart which allows removal of the loop device while blktrace
is active (if I read that right), can this still happen?
-Eric
> [ 107.193134] debugfs: Directory 'loop0' with parent 'block' already present!
> [ 107.254615] BUG: kernel NULL pointer dereference, address: 00000000000000a0
> [ 107.258785] #PF: supervisor write access in kernel mode
> [ 107.262035] #PF: error_code(0x0002) - not-present page
> [ 107.264106] PGD 0 P4D 0
> [ 107.264404] Oops: 0002 [#1] SMP NOPTI
> [ 107.264803] CPU: 8 PID: 674 Comm: kworker/8:2 Tainted: G E 5.6.0-rc7-next-20200327 #1
> [ 107.265712] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1 04/01/2014
> [ 107.266553] Workqueue: events __blk_release_queue
> [ 107.267051] RIP: 0010:down_write+0x15/0x40
> [ 107.267488] Code: eb ca e8 ee a5 8d ff cc cc cc cc cc cc cc cc cc cc cc cc cc cc 0f 1f 44 00 00 55 48 89 fd e8 52 db ff ff 31 c0 ba 01 00 00 00 <f0> 48 0f b1 55 00 75 0f 65 48 8b 04 25 c0 8b 01 00 48 89 45 08 5d
> [ 107.269300] RSP: 0018:ffff9927c06efda8 EFLAGS: 00010246
> [ 107.269841] RAX: 0000000000000000 RBX: ffff8be7e73b0600 RCX: ffffff8100000000
> [ 107.270559] RDX: 0000000000000001 RSI: ffffff8100000000 RDI: 00000000000000a0
> [ 107.271281] RBP: 00000000000000a0 R08: ffff8be7ebc80fa8 R09: ffff8be7ebc80fa8
> [ 107.272001] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
> [ 107.272722] R13: ffff8be7efc30400 R14: ffff8be7e0571200 R15: 00000000000000a0
> [ 107.273475] FS: 0000000000000000(0000) GS:ffff8be7efc00000(0000) knlGS:0000000000000000
> [ 107.274346] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [ 107.274968] CR2: 00000000000000a0 CR3: 000000042abee003 CR4: 0000000000360ee0
> [ 107.275710] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> [ 107.276465] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> [ 107.277214] Call Trace:
> [ 107.277532] simple_recursive_removal+0x4e/0x2e0
> [ 107.278049] ? debugfs_remove+0x60/0x60
> [ 107.278493] debugfs_remove+0x40/0x60
> [ 107.278922] blk_trace_free+0xd/0x50
> [ 107.279339] __blk_trace_remove+0x27/0x40
> [ 107.279797] blk_trace_shutdown+0x30/0x40
> [ 107.280256] __blk_release_queue+0xab/0x110
> [ 107.280734] process_one_work+0x1b4/0x380
> [ 107.281194] worker_thread+0x50/0x3c0
> [ 107.281622] kthread+0xf9/0x130
> [ 107.281994] ? process_one_work+0x380/0x380
> [ 107.282467] ? kthread_park+0x90/0x90
> [ 107.282895] ret_from_fork+0x1f/0x40
> [ 107.283316] Modules linked in: loop(E) <etc>
> [ 107.288562] CR2: 00000000000000a0
> [ 107.288957] ---[ end trace b885d243d441bbce ]---
next prev parent reply other threads:[~2020-04-15 17:38 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-14 4:18 [PATCH 0/5] blktrace: fix use after free Luis Chamberlain
2020-04-14 4:18 ` [PATCH 1/5] block: move main block debugfs initialization to its own file Luis Chamberlain
2020-04-14 7:35 ` Greg KH
2020-04-15 2:44 ` Bart Van Assche
2020-04-14 4:18 ` [PATCH 2/5] blktrace: fix debugfs use after free Luis Chamberlain
2020-04-14 7:37 ` Greg KH
2020-04-14 15:38 ` Christoph Hellwig
2020-04-15 2:46 ` Bart Van Assche
2020-04-15 17:38 ` Eric Sandeen [this message]
2020-04-15 21:48 ` Bart Van Assche
2020-04-16 0:56 ` Luis Chamberlain
2020-04-16 1:02 ` Eric Sandeen
2020-04-16 1:20 ` Luis Chamberlain
2020-04-16 2:10 ` Ming Lei
2020-04-16 5:25 ` Luis Chamberlain
2020-04-16 5:47 ` Ming Lei
2020-04-16 6:09 ` Ming Lei
2020-04-16 6:22 ` Luis Chamberlain
2020-04-16 6:20 ` Luis Chamberlain
2020-04-16 6:28 ` Ming Lei
2020-04-17 4:09 ` Luis Chamberlain
2020-04-14 4:19 ` [PATCH 3/5] blktrace: refcount the request_queue during ioctl Luis Chamberlain
2020-04-14 15:40 ` Christoph Hellwig
2020-04-15 6:16 ` Luis Chamberlain
2020-04-15 7:14 ` Christoph Hellwig
2020-04-15 12:34 ` Luis Chamberlain
2020-04-15 12:39 ` Christoph Hellwig
2020-04-15 13:25 ` Luis Chamberlain
2020-04-15 14:18 ` Bart Van Assche
2020-04-16 1:12 ` Luis Chamberlain
2020-04-16 3:43 ` Bart Van Assche
2020-04-16 5:29 ` Luis Chamberlain
2020-04-15 14:45 ` Bart Van Assche
2020-04-16 1:17 ` Luis Chamberlain
2020-04-16 2:31 ` Ming Lei
2020-04-16 5:36 ` Luis Chamberlain
2020-04-14 4:19 ` [PATCH 4/5] mm/swapfile: refcount block and queue before using blkcg_schedule_throttle() Luis Chamberlain
2020-04-14 15:44 ` Christoph Hellwig
2020-04-15 5:42 ` Luis Chamberlain
2020-04-15 7:27 ` Christoph Hellwig
2020-04-15 7:34 ` Christoph Hellwig
2020-04-15 13:19 ` Luis Chamberlain
2020-04-16 6:10 ` Christoph Hellwig
2020-04-16 6:22 ` Ming Lei
2020-04-16 6:25 ` Luis Chamberlain
2020-04-16 6:34 ` Ming Lei
2020-04-14 4:19 ` [PATCH 5/5] block: revert back to synchronous request_queue removal Luis Chamberlain
2020-04-14 15:47 ` Christoph Hellwig
2020-04-14 20:58 ` Luis Chamberlain
2020-04-15 6:46 ` Christoph Hellwig
2020-04-15 13:20 ` Luis Chamberlain
2020-04-16 2:36 ` Ming Lei
2020-04-14 7:38 ` [PATCH 0/5] blktrace: fix use after free Greg KH
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=55401e02-f61c-25eb-271c-3ec7baf35e28@sandeen.net \
--to=sandeen@sandeen.net \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=gregkh@linuxfoundation.org \
--cc=hare@suse.com \
--cc=jack@suse.cz \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mcgrof@kernel.org \
--cc=mhocko@kernel.org \
--cc=mhocko@suse.com \
--cc=ming.lei@redhat.com \
--cc=mingo@redhat.com \
--cc=nstange@suse.de \
--cc=osandov@fb.com \
--cc=rostedt@goodmis.org \
--cc=syzbot+603294af2d01acfdd6da@syzkaller.appspotmail.com \
--cc=viro@zeniv.linux.org.uk \
--cc=yukuai3@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).