2021-07-19 14:12:55

by syzbot

[permalink] [raw]
Subject: [syzbot] KASAN: slab-out-of-bounds Read in do_wait_for_common

Hello,

syzbot found the following issue on:

HEAD commit: 8096acd7442e Merge tag 'net-5.14-rc2' of git://git.kernel...
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=167ca94a300000
kernel config: https://syzkaller.appspot.com/x/.config?x=5294764a378649cb
dashboard link: https://syzkaller.appspot.com/bug?extid=cc699626e48a6ebaf295
compiler: Debian clang version 11.0.1-2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14d68024300000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16e4f180300000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: [email protected]

==================================================================
BUG: KASAN: slab-out-of-bounds in debug_spin_lock_before kernel/locking/spinlock_debug.c:83 [inline]
BUG: KASAN: slab-out-of-bounds in do_raw_spin_lock+0x4f5/0x8e0 kernel/locking/spinlock_debug.c:112
Read of size 4 at addr ffff88802b46ce14 by task kworker/0:6/8471

CPU: 0 PID: 8471 Comm: kworker/0:6 Tainted: G W 5.14.0-rc1-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: usb_hub_wq hub_event
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1ae/0x29f lib/dump_stack.c:105
print_address_description+0x66/0x3b0 mm/kasan/report.c:233
__kasan_report mm/kasan/report.c:419 [inline]
kasan_report+0x163/0x210 mm/kasan/report.c:436
debug_spin_lock_before kernel/locking/spinlock_debug.c:83 [inline]
do_raw_spin_lock+0x4f5/0x8e0 kernel/locking/spinlock_debug.c:112
__raw_spin_lock_irq include/linux/spinlock_api_smp.h:129 [inline]
_raw_spin_lock_irq+0xba/0xf0 kernel/locking/spinlock.c:167
do_wait_for_common+0x2e5/0x480 kernel/sched/completion.c:86
__wait_for_common kernel/sched/completion.c:106 [inline]
wait_for_common kernel/sched/completion.c:117 [inline]
wait_for_completion+0x48/0x60 kernel/sched/completion.c:138
r871xu_dev_remove+0x83/0x460 drivers/staging/rtl8712/usb_intf.c:599
usb_unbind_interface+0x1f2/0x860 drivers/usb/core/driver.c:458
__device_release_driver drivers/base/dd.c:1201 [inline]
device_release_driver_internal+0x51e/0x7b0 drivers/base/dd.c:1232
bus_remove_device+0x2fd/0x410 drivers/base/bus.c:529
device_del+0x6e1/0xc10 drivers/base/core.c:3540
usb_disable_device+0x407/0x800 drivers/usb/core/message.c:1419
usb_disconnect+0x33a/0x8a0 drivers/usb/core/hub.c:2221
hub_port_connect+0x297/0x27a0 drivers/usb/core/hub.c:5151
hub_port_connect_change+0x5d0/0xbf0 drivers/usb/core/hub.c:5440
port_event+0xaee/0x1140 drivers/usb/core/hub.c:5586
hub_event+0x48d/0xd80 drivers/usb/core/hub.c:5668
process_one_work+0x833/0x10c0 kernel/workqueue.c:2276
worker_thread+0xac1/0x1320 kernel/workqueue.c:2422
kthread+0x453/0x480 kernel/kthread.c:319
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Allocated by task 10:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track mm/kasan/common.c:46 [inline]
set_alloc_info mm/kasan/common.c:434 [inline]
__kasan_slab_alloc+0x96/0xd0 mm/kasan/common.c:467
kasan_slab_alloc include/linux/kasan.h:253 [inline]
slab_post_alloc_hook mm/slab.h:512 [inline]
slab_alloc_node mm/slub.c:2981 [inline]
kmem_cache_alloc_node+0x200/0x370 mm/slub.c:3017
alloc_task_struct_node kernel/fork.c:171 [inline]
dup_task_struct+0x52/0x980 kernel/fork.c:871
copy_process+0x615/0x5b00 kernel/fork.c:1952
kernel_clone+0x21a/0x7d0 kernel/fork.c:2509
kernel_thread+0x146/0x1c0 kernel/fork.c:2561
call_usermodehelper_exec_work+0x57/0x220 kernel/umh.c:174
process_one_work+0x833/0x10c0 kernel/workqueue.c:2276
worker_thread+0xac1/0x1320 kernel/workqueue.c:2422
kthread+0x453/0x480 kernel/kthread.c:319
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Last potentially related work creation:
kasan_save_stack+0x27/0x50 mm/kasan/common.c:38
kasan_record_aux_stack+0xee/0x120 mm/kasan/generic.c:348
__call_rcu kernel/rcu/tree.c:3029 [inline]
call_rcu+0x1a0/0xa20 kernel/rcu/tree.c:3109
schedule_tail+0xc/0xb0 kernel/sched/core.c:4619
ret_from_fork+0x8/0x30 arch/x86/entry/entry_64.S:280

The buggy address belongs to the object at ffff88802b46b880
which belongs to the cache task_struct of size 6976
The buggy address is located 5524 bytes inside of
6976-byte region [ffff88802b46b880, ffff88802b46d3c0)
The buggy address belongs to the page:
page:ffffea0000ad1a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2b468
head:ffffea0000ad1a00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 dead000000000122 ffff888140006280
raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 10, ts 43802781641, free_ts 43793596145
prep_new_page mm/page_alloc.c:2433 [inline]
get_page_from_freelist+0x779/0xa30 mm/page_alloc.c:4166
__alloc_pages+0x26c/0x5f0 mm/page_alloc.c:5374
alloc_slab_page mm/slub.c:1713 [inline]
allocate_slab+0xf1/0x540 mm/slub.c:1853
new_slab mm/slub.c:1916 [inline]
new_slab_objects mm/slub.c:2662 [inline]
___slab_alloc+0x1cf/0x350 mm/slub.c:2825
__slab_alloc mm/slub.c:2865 [inline]
slab_alloc_node mm/slub.c:2947 [inline]
kmem_cache_alloc_node+0x2ca/0x370 mm/slub.c:3017
alloc_task_struct_node kernel/fork.c:171 [inline]
dup_task_struct+0x52/0x980 kernel/fork.c:871
copy_process+0x615/0x5b00 kernel/fork.c:1952
kernel_clone+0x21a/0x7d0 kernel/fork.c:2509
kernel_thread+0x146/0x1c0 kernel/fork.c:2561
call_usermodehelper_exec_work+0x57/0x220 kernel/umh.c:174
process_one_work+0x833/0x10c0 kernel/workqueue.c:2276
worker_thread+0xac1/0x1320 kernel/workqueue.c:2422
kthread+0x453/0x480 kernel/kthread.c:319
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1343 [inline]
free_pcp_prepare+0xc29/0xd20 mm/page_alloc.c:1394
free_unref_page_prepare mm/page_alloc.c:3329 [inline]
free_unref_page+0x7e/0x550 mm/page_alloc.c:3408
kfree+0x287/0x2d0 mm/slub.c:4292
request_firmware_work_func+0x175/0x250 drivers/base/firmware_loader/main.c:1081
process_one_work+0x833/0x10c0 kernel/workqueue.c:2276
worker_thread+0xac1/0x1320 kernel/workqueue.c:2422
kthread+0x453/0x480 kernel/kthread.c:319
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Memory state around the buggy address:
ffff88802b46cd00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88802b46cd80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88802b46ce00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
ffff88802b46ce80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88802b46cf00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================


---
This report 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 [email protected].

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


2021-07-20 11:12:34

by Pavel Skripkin

[permalink] [raw]
Subject: Re: [syzbot] KASAN: slab-out-of-bounds Read in do_wait_for_common

On Mon, 19 Jul 2021 06:42:25 -0700
syzbot <[email protected]> wrote:

> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 8096acd7442e Merge tag 'net-5.14-rc2' of
> git://git.kernel... git tree: upstream
> console output:
> https://syzkaller.appspot.com/x/log.txt?x=167ca94a300000 kernel
> config: https://syzkaller.appspot.com/x/.config?x=5294764a378649cb
> dashboard link:
> https://syzkaller.appspot.com/bug?extid=cc699626e48a6ebaf295
> compiler: Debian clang version 11.0.1-2 syz repro:
> https://syzkaller.appspot.com/x/repro.syz?x=14d68024300000 C
> reproducer: https://syzkaller.appspot.com/x/repro.c?x=16e4f180300000
>
> IMPORTANT: if you fix the issue, please add the following tag to the
> commit: Reported-by:
> [email protected]
>
> ==================================================================
> BUG: KASAN: slab-out-of-bounds in debug_spin_lock_before
> kernel/locking/spinlock_debug.c:83 [inline] BUG: KASAN:
> slab-out-of-bounds in do_raw_spin_lock+0x4f5/0x8e0
> kernel/locking/spinlock_debug.c:112 Read of size 4 at addr
> ffff88802b46ce14 by task kworker/0:6/8471
>

I don't see any reason behind doing clean up stuff in firmware
callback. In my prevoius patch to this driver I fixed memory leak and, I
believed, that this approach won't trigger anything else...

Let's just call device_release_driver() under parent lock in case of
firmware load failure and see if it works.

#syz test
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master


With regards,
Pavel Skripkin


Attachments:
(No filename) (1.63 kB)
0001-staging-rtl8712-rewrite-error-handling.patch (3.99 kB)
Download all attachments

2021-07-20 15:41:36

by syzbot

[permalink] [raw]
Subject: Re: [syzbot] KASAN: slab-out-of-bounds Read in do_wait_for_common

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
possible deadlock in flush_workqueue

usb 6-1: r8712u: Loading firmware from "rtlwifi/rtl8712u.bin"
usb 6-1: Direct firmware load for rtlwifi/rtl8712u.bin failed with error -2
usb 6-1: Falling back to sysfs fallback for: rtlwifi/rtl8712u.bin
usb 6-1: r8712u: Firmware request failed
============================================
WARNING: possible recursive locking detected
5.14.0-rc2-syzkaller #0 Not tainted
--------------------------------------------
kworker/0:3/3159 is trying to acquire lock:
ffff888011064d38 ((wq_completion)events){+.+.}-{0:0}, at: flush_workqueue+0x15c/0x1750 kernel/workqueue.c:2787

but task is already holding lock:
ffff888011064d38 ((wq_completion)events){+.+.}-{0:0}, at: process_one_work+0x7aa/0x10c0 kernel/workqueue.c:2249

other info that might help us debug this:
Possible unsafe locking scenario:

CPU0
----
lock((wq_completion)events);
lock((wq_completion)events);

*** DEADLOCK ***

May be due to missing lock nesting notation

5 locks held by kworker/0:3/3159:
#0: ffff888011064d38 ((wq_completion)events){+.+.}-{0:0}, at: process_one_work+0x7aa/0x10c0 kernel/workqueue.c:2249
#1: ffffc900021d7d20 ((work_completion)(&fw_work->work)){+.+.}-{0:0}, at: process_one_work+0x7e8/0x10c0 kernel/workqueue.c:2251
#2: ffff8881467d4220 (&dev->mutex){....}-{3:3}, at: device_lock include/linux/device.h:754 [inline]
#2: ffff8881467d4220 (&dev->mutex){....}-{3:3}, at: rtl871x_load_fw_fail drivers/staging/rtl8712/hal_init.c:43 [inline]
#2: ffff8881467d4220 (&dev->mutex){....}-{3:3}, at: rtl871x_load_fw_cb+0x102/0x130 drivers/staging/rtl8712/hal_init.c:56
#3: ffff8880363da220 (&dev->mutex){....}-{3:3}, at: device_lock include/linux/device.h:754 [inline]
#3: ffff8880363da220 (&dev->mutex){....}-{3:3}, at: __device_driver_lock drivers/base/dd.c:1028 [inline]
#3: ffff8880363da220 (&dev->mutex){....}-{3:3}, at: device_release_driver_internal+0xc1/0x7b0 drivers/base/dd.c:1229
#4: ffff8880308211a8 (&dev->mutex){....}-{3:3}, at: device_lock include/linux/device.h:754 [inline]
#4: ffff8880308211a8 (&dev->mutex){....}-{3:3}, at: __device_driver_lock drivers/base/dd.c:1028 [inline]
#4: ffff8880308211a8 (&dev->mutex){....}-{3:3}, at: device_release_driver_internal+0xc1/0x7b0 drivers/base/dd.c:1229

stack backtrace:
CPU: 0 PID: 3159 Comm: kworker/0:3 Not tainted 5.14.0-rc2-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events request_firmware_work_func
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1ae/0x29f lib/dump_stack.c:105
__lock_acquire+0x2615/0x6100 kernel/locking/lockdep.c:4853
lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625
flush_workqueue+0x178/0x1750 kernel/workqueue.c:2787
flush_scheduled_work include/linux/workqueue.h:597 [inline]
r871xu_dev_remove+0x159/0x420 drivers/staging/rtl8712/usb_intf.c:604
usb_unbind_interface+0x1f2/0x860 drivers/usb/core/driver.c:458
__device_release_driver drivers/base/dd.c:1201 [inline]
device_release_driver_internal+0x51e/0x7b0 drivers/base/dd.c:1232
bus_remove_device+0x2fd/0x410 drivers/base/bus.c:529
device_del+0x6e1/0xc10 drivers/base/core.c:3540
usb_disable_device+0x407/0x800 drivers/usb/core/message.c:1419
usb_set_configuration+0x42b/0x2100 drivers/usb/core/message.c:2027
usb_unbind_device+0x6b/0x170 drivers/usb/core/driver.c:309
__device_release_driver drivers/base/dd.c:1201 [inline]
device_release_driver_internal+0x51e/0x7b0 drivers/base/dd.c:1232
rtl871x_load_fw_fail drivers/staging/rtl8712/hal_init.c:45 [inline]
rtl871x_load_fw_cb+0x10a/0x130 drivers/staging/rtl8712/hal_init.c:56
request_firmware_work_func+0x175/0x250 drivers/base/firmware_loader/main.c:1081
process_one_work+0x833/0x10c0 kernel/workqueue.c:2276
worker_thread+0xac1/0x1320 kernel/workqueue.c:2422
kthread+0x453/0x480 kernel/kthread.c:319
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295


Tested on:

commit: 8cae8cd8 seq_file: disallow extremely large seq buffer..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=149905f2300000
kernel config: https://syzkaller.appspot.com/x/.config?x=300aea483211c875
dashboard link: https://syzkaller.appspot.com/bug?extid=cc699626e48a6ebaf295
compiler: Debian clang version 11.0.1-2, GNU ld (GNU Binutils for Debian) 2.35.1
patch: https://syzkaller.appspot.com/x/patch.diff?x=15737b4a300000

2021-07-20 19:16:57

by Pavel Skripkin

[permalink] [raw]
Subject: Re: [syzbot] KASAN: slab-out-of-bounds Read in do_wait_for_common

On Tue, 20 Jul 2021 08:21:06 -0700
syzbot <[email protected]> wrote:

> Hello,
>
> syzbot has tested the proposed patch but the reproducer is still
> triggering an issue: possible deadlock in flush_workqueue
>
> usb 6-1: r8712u: Loading firmware from "rtlwifi/rtl8712u.bin"
> usb 6-1: Direct firmware load for rtlwifi/rtl8712u.bin failed with
> error -2 usb 6-1: Falling back to sysfs fallback for:
> rtlwifi/rtl8712u.bin usb 6-1: r8712u: Firmware request failed
> ============================================
> WARNING: possible recursive locking detected
> 5.14.0-rc2-syzkaller #0 Not tainted
> --------------------------------------------
> kworker/0:3/3159 is trying to acquire lock:
> ffff888011064d38 ((wq_completion)events){+.+.}-{0:0}, at:
> flush_workqueue+0x15c/0x1750 kernel/workqueue.c:2787
>
> but task is already holding lock:
> ffff888011064d38 ((wq_completion)events){+.+.}-{0:0}, at:
> process_one_work+0x7aa/0x10c0 kernel/workqueue.c:2249
>
> other info that might help us debug this:
> Possible unsafe locking scenario:
>
> CPU0
> ----
> lock((wq_completion)events);
> lock((wq_completion)events);
>
> *** DEADLOCK ***
>
> May be due to missing lock nesting notation
>
> 5 locks held by kworker/0:3/3159:
> #0: ffff888011064d38 ((wq_completion)events){+.+.}-{0:0}, at:
> process_one_work+0x7aa/0x10c0 kernel/workqueue.c:2249 #1:
> ffffc900021d7d20 ((work_completion)(&fw_work->work)){+.+.}-{0:0}, at:
> process_one_work+0x7e8/0x10c0 kernel/workqueue.c:2251 #2:
> ffff8881467d4220 (&dev->mutex){....}-{3:3}, at: device_lock
> include/linux/device.h:754 [inline] #2: ffff8881467d4220
> (&dev->mutex){....}-{3:3}, at: rtl871x_load_fw_fail
> drivers/staging/rtl8712/hal_init.c:43 [inline] #2: ffff8881467d4220
> (&dev->mutex){....}-{3:3}, at: rtl871x_load_fw_cb+0x102/0x130
> drivers/staging/rtl8712/hal_init.c:56 #3: ffff8880363da220
> (&dev->mutex){....}-{3:3}, at: device_lock include/linux/device.h:754
> [inline] #3: ffff8880363da220 (&dev->mutex){....}-{3:3}, at:
> __device_driver_lock drivers/base/dd.c:1028 [inline] #3:
> ffff8880363da220 (&dev->mutex){....}-{3:3}, at:
> device_release_driver_internal+0xc1/0x7b0 drivers/base/dd.c:1229 #4:
> ffff8880308211a8 (&dev->mutex){....}-{3:3}, at: device_lock
> include/linux/device.h:754 [inline] #4: ffff8880308211a8
> (&dev->mutex){....}-{3:3}, at: __device_driver_lock
> drivers/base/dd.c:1028 [inline] #4: ffff8880308211a8
> (&dev->mutex){....}-{3:3}, at:
> device_release_driver_internal+0xc1/0x7b0 drivers/base/dd.c:1229
>
> stack backtrace:
> CPU: 0 PID: 3159 Comm: kworker/0:3 Not tainted 5.14.0-rc2-syzkaller #0
> Hardware name: Google Google Compute Engine/Google Compute Engine,
> BIOS Google 01/01/2011 Workqueue: events request_firmware_work_func
> Call Trace:
> __dump_stack lib/dump_stack.c:88 [inline]
> dump_stack_lvl+0x1ae/0x29f lib/dump_stack.c:105
> __lock_acquire+0x2615/0x6100 kernel/locking/lockdep.c:4853
> lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625
> flush_workqueue+0x178/0x1750 kernel/workqueue.c:2787
> flush_scheduled_work include/linux/workqueue.h:597 [inline]
> r871xu_dev_remove+0x159/0x420 drivers/staging/rtl8712/usb_intf.c:604
> usb_unbind_interface+0x1f2/0x860 drivers/usb/core/driver.c:458
> __device_release_driver drivers/base/dd.c:1201 [inline]
> device_release_driver_internal+0x51e/0x7b0 drivers/base/dd.c:1232
> bus_remove_device+0x2fd/0x410 drivers/base/bus.c:529
> device_del+0x6e1/0xc10 drivers/base/core.c:3540
> usb_disable_device+0x407/0x800 drivers/usb/core/message.c:1419
> usb_set_configuration+0x42b/0x2100 drivers/usb/core/message.c:2027
> usb_unbind_device+0x6b/0x170 drivers/usb/core/driver.c:309
> __device_release_driver drivers/base/dd.c:1201 [inline]
> device_release_driver_internal+0x51e/0x7b0 drivers/base/dd.c:1232
> rtl871x_load_fw_fail drivers/staging/rtl8712/hal_init.c:45 [inline]
> rtl871x_load_fw_cb+0x10a/0x130 drivers/staging/rtl8712/hal_init.c:56
> request_firmware_work_func+0x175/0x250
> drivers/base/firmware_loader/main.c:1081
> process_one_work+0x833/0x10c0 kernel/workqueue.c:2276
> worker_thread+0xac1/0x1320 kernel/workqueue.c:2422
> kthread+0x453/0x480 kernel/kthread.c:319 ret_from_fork+0x1f/0x30
> arch/x86/entry/entry_64.S:295
>


Hmm, did't notice this could happen. From my point of view,
flush_scheduled_work() can be replaced with flush_work() for all
scheduled works in this driver.



#syz test
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master




With regards,
Pavel Skripkin


Attachments:
(No filename) (4.56 kB)
0001-staging-rtl8712-rewrite-error-handling.patch (6.42 kB)
Download all attachments

2021-07-20 22:13:38

by syzbot

[permalink] [raw]
Subject: Re: [syzbot] KASAN: slab-out-of-bounds Read in do_wait_for_common

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
BUG: sleeping function called from invalid context in lock_sock_nested

BUG: sleeping function called from invalid context at net/core/sock.c:3161
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 8824, name: syz-executor.2
1 lock held by syz-executor.2/8824:
#0: ffffffff8d89c920 (hci_sk_list.lock){++++}-{2:2}, at: hci_sock_dev_event+0x2b6/0x630 net/bluetooth/hci_sock.c:763
Preemption disabled at:
[<0000000000000000>] 0x0
CPU: 0 PID: 8824 Comm: syz-executor.2 Not tainted 5.14.0-rc2-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1d3/0x29f lib/dump_stack.c:105
___might_sleep+0x4e5/0x6b0 kernel/sched/core.c:9154
lock_sock_nested+0x34/0x110 net/core/sock.c:3161
lock_sock include/net/sock.h:1613 [inline]
hci_sock_dev_event+0x30a/0x630 net/bluetooth/hci_sock.c:765
hci_unregister_dev+0x487/0x19b0 net/bluetooth/hci_core.c:4033
vhci_release+0x73/0xc0 drivers/bluetooth/hci_vhci.c:340
__fput+0x352/0x7b0 fs/file_table.c:280
task_work_run+0x146/0x1c0 kernel/task_work.c:164
exit_task_work include/linux/task_work.h:32 [inline]
do_exit+0x72b/0x2510 kernel/exit.c:825
do_group_exit+0x168/0x2d0 kernel/exit.c:922
__do_sys_exit_group+0x13/0x20 kernel/exit.c:933
__se_sys_exit_group+0x10/0x10 kernel/exit.c:931
__x64_sys_exit_group+0x37/0x40 kernel/exit.c:931
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x4665d9
Code: Unable to access opcode bytes at RIP 0x4665af.
RSP: 002b:00007ffe15e4abc8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 00007ffe15e4b388 RCX: 00000000004665d9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000043
RBP: 0000000000000000 R08: 0000000000000025 R09: 00007ffe15e4b388
R10: 00000000ffffffff R11: 0000000000000246 R12: 00000000004bef54
R13: 0000000000000010 R14: 0000000000000000 R15: 0000000000400538

======================================================


Tested on:

commit: 8cae8cd8 seq_file: disallow extremely large seq buffer..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=161182ea300000
kernel config: https://syzkaller.appspot.com/x/.config?x=300aea483211c875
dashboard link: https://syzkaller.appspot.com/bug?extid=cc699626e48a6ebaf295
compiler: Debian clang version 11.0.1-2, GNU ld (GNU Binutils for Debian) 2.35.1
patch: https://syzkaller.appspot.com/x/patch.diff?x=13c31a5a300000

2021-07-21 10:11:51

by Pavel Skripkin

[permalink] [raw]
Subject: Re: [syzbot] KASAN: slab-out-of-bounds Read in do_wait_for_common

On Tue, 20 Jul 2021 15:10:08 -0700
syzbot <[email protected]> wrote:

> Hello,
>
> syzbot has tested the proposed patch but the reproducer is still
> triggering an issue: BUG: sleeping function called from invalid
> context in lock_sock_nested
>
> BUG: sleeping function called from invalid context at
> net/core/sock.c:3161 in_atomic(): 1, irqs_disabled(): 0, non_block:
> 0, pid: 8824, name: syz-executor.2 1 lock held by syz-executor.2/8824:
> #0: ffffffff8d89c920 (hci_sk_list.lock){++++}-{2:2}, at:
> hci_sock_dev_event+0x2b6/0x630 net/bluetooth/hci_sock.c:763


Ok, it is not related to my fix. Picking up Tetsuo patch to get
Reported-and-tested tag.


#syz test
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master


With regards,
Pavel Skripkin


Attachments:
(No filename) (838.00 B)
2patches.patch (7.43 kB)
Download all attachments

2021-07-21 21:03:23

by syzbot

[permalink] [raw]
Subject: Re: [syzbot] KASAN: slab-out-of-bounds Read in do_wait_for_common

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: [email protected]

Tested on:

commit: 8cae8cd8 seq_file: disallow extremely large seq buffer..
git tree: upstream
kernel config: https://syzkaller.appspot.com/x/.config?x=300aea483211c875
dashboard link: https://syzkaller.appspot.com/bug?extid=cc699626e48a6ebaf295
compiler: Debian clang version 11.0.1-2, GNU ld (GNU Binutils for Debian) 2.35.1
patch: https://syzkaller.appspot.com/x/patch.diff?x=1174d0d4300000

Note: testing is done by a robot and is best-effort only.