linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* WARNING in __flush_work
@ 2019-01-29 16:43 syzbot
  2019-01-30 13:56 ` Tetsuo Handa
  0 siblings, 1 reply; 3+ messages in thread
From: syzbot @ 2019-01-29 16:43 UTC (permalink / raw)
  To: axboe, linux-block, linux-kernel, syzkaller-bugs

Hello,

syzbot found the following crash on:

HEAD commit:    39ad1c1b6bb8 Add linux-next specific files for 20190129
git tree:       linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=135e382f400000
kernel config:  https://syzkaller.appspot.com/x/.config?x=a2b2e9c0bc43c14d
dashboard link: https://syzkaller.appspot.com/bug?extid=ba2a929dcf8e704c180e
compiler:       gcc (GCC) 9.0.0 20181231 (experimental)
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=17cc2298c00000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=176c96ef400000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+ba2a929dcf8e704c180e@syzkaller.appspotmail.com

WARNING: CPU: 1 PID: 3472 at kernel/workqueue.c:2911  
__flush_work+0x880/0xa60 kernel/workqueue.c:2911
Kernel panic - not syncing: panic_on_warn set ...
CPU: 1 PID: 3472 Comm: kworker/1:2 Not tainted 5.0.0-rc4-next-20190129 #21
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
Workqueue: md_misc mddev_delayed_delete
Call Trace:
  __dump_stack lib/dump_stack.c:77 [inline]
  dump_stack+0x1db/0x2d0 lib/dump_stack.c:113
  panic+0x2cb/0x65c kernel/panic.c:214
  __warn.cold+0x20/0x48 kernel/panic.c:571
  report_bug+0x263/0x2b0 lib/bug.c:186
  fixup_bug arch/x86/kernel/traps.c:178 [inline]
  fixup_bug arch/x86/kernel/traps.c:173 [inline]
  do_error_trap+0x11b/0x200 arch/x86/kernel/traps.c:271
  do_invalid_op+0x37/0x50 arch/x86/kernel/traps.c:290
  invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:973
RIP: 0010:__flush_work+0x880/0xa60 kernel/workqueue.c:2911
Code: 74 58 e8 93 54 2e 00 fb 66 0f 1f 44 00 00 45 31 e4 e9 7d fd ff ff e8  
7f 54 2e 00 0f 0b 45 31 e4 e9 6e fd ff ff e8 70 54 2e 00 <0f> 0b 45 31 e4  
e9 5f fd ff ff e8 61 54 2e 00 4c 89 ff 45 31 e4 e8
RSP: 0018:ffff88809acb7558 EFLAGS: 00010293
RAX: ffff88809acc4580 RBX: ffff88809acb76e8 RCX: ffffffff8153bde9
RDX: 0000000000000000 RSI: ffffffff8153c5c0 RDI: 0000000000000001
RBP: ffff88809acb7710 R08: ffff88809acc4580 R09: ffff88809acc4e48
R10: ffff88809acc4580 R11: 0000000000000000 R12: ffff88809dd24628
R13: dffffc0000000000 R14: 0000000000000001 R15: 0000000000000001
  __cancel_work_timer+0x48d/0x810 kernel/workqueue.c:3007
  cancel_work_sync+0x18/0x20 kernel/workqueue.c:3043
  blk_sync_queue+0x33/0x190 block/blk-core.c:234
  blk_cleanup_queue+0x100/0x200 block/blk-core.c:367
  md_free+0xcb/0x1b0 drivers/md/md.c:5215
  kobject_cleanup lib/kobject.c:662 [inline]
  kobject_release lib/kobject.c:691 [inline]
  kref_put include/linux/kref.h:67 [inline]
  kobject_put.cold+0x28f/0x2ec lib/kobject.c:708
  mddev_delayed_delete+0x34/0x40 drivers/md/md.c:5243
  process_one_work+0xd0c/0x1ce0 kernel/workqueue.c:2153
  worker_thread+0x143/0x14a0 kernel/workqueue.c:2296
  kthread+0x357/0x430 kernel/kthread.c:247
  ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:352
Kernel Offset: disabled
Rebooting in 86400 seconds..


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with  
syzbot.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: WARNING in __flush_work
  2019-01-29 16:43 WARNING in __flush_work syzbot
@ 2019-01-30 13:56 ` Tetsuo Handa
  2019-01-30 15:53   ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: Tetsuo Handa @ 2019-01-30 13:56 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, linux-kernel

From fd653e8dd0d5368cd0cd9ccd89cf3001e4584f8a Mon Sep 17 00:00:00 2001
From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Date: Wed, 30 Jan 2019 22:21:45 +0900
Subject: [PATCH] block: pass no-op callback to INIT_WORK().

syzbot is hitting flush_work() warning caused by commit 4d43d395fed12463
("workqueue: Try to catch flush_work() without INIT_WORK().") [1].
Although that commit did not expect INIT_WORK(NULL) case, calling
flush_work() without setting a valid callback should be avoided anyway.
Fix this problem by setting a no-op callback instead of NULL.

[1] https://syzkaller.appspot.com/bug?id=e390366bc48bc82a7c668326e0663be3b91cbd29

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Reported-and-tested-by: syzbot <syzbot+ba2a929dcf8e704c180e@syzkaller.appspotmail.com>
Cc: Tejun Heo <tj@kernel.org>
---
 block/blk-core.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index ab17c05..4673ebe 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -462,6 +462,10 @@ static void blk_rq_timed_out_timer(struct timer_list *t)
 	kblockd_schedule_work(&q->timeout_work);
 }
 
+static void blk_timeout_work(struct work_struct *work)
+{
+}
+
 /**
  * blk_alloc_queue_node - allocate a request queue
  * @gfp_mask: memory allocation flags
@@ -504,7 +508,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
 	timer_setup(&q->backing_dev_info->laptop_mode_wb_timer,
 		    laptop_mode_timer_fn, 0);
 	timer_setup(&q->timeout, blk_rq_timed_out_timer, 0);
-	INIT_WORK(&q->timeout_work, NULL);
+	INIT_WORK(&q->timeout_work, blk_timeout_work);
 	INIT_LIST_HEAD(&q->icq_list);
 #ifdef CONFIG_BLK_CGROUP
 	INIT_LIST_HEAD(&q->blkg_list);
-- 
1.8.3.1





^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: WARNING in __flush_work
  2019-01-30 13:56 ` Tetsuo Handa
@ 2019-01-30 15:53   ` Jens Axboe
  0 siblings, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2019-01-30 15:53 UTC (permalink / raw)
  To: Tetsuo Handa; +Cc: linux-block, linux-kernel

On 1/30/19 6:56 AM, Tetsuo Handa wrote:
> From fd653e8dd0d5368cd0cd9ccd89cf3001e4584f8a Mon Sep 17 00:00:00 2001
> From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> Date: Wed, 30 Jan 2019 22:21:45 +0900
> Subject: [PATCH] block: pass no-op callback to INIT_WORK().
> 
> syzbot is hitting flush_work() warning caused by commit 4d43d395fed12463
> ("workqueue: Try to catch flush_work() without INIT_WORK().") [1].
> Although that commit did not expect INIT_WORK(NULL) case, calling
> flush_work() without setting a valid callback should be avoided anyway.
> Fix this problem by setting a no-op callback instead of NULL.
> 
> [1] https://syzkaller.appspot.com/bug?id=e390366bc48bc82a7c668326e0663be3b91cbd29

Applied, thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-01-30 15:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-29 16:43 WARNING in __flush_work syzbot
2019-01-30 13:56 ` Tetsuo Handa
2019-01-30 15:53   ` Jens Axboe

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).