KASAN: slab-out-of-bounds Read in lock_sock_nested

15 views
Skip to first unread message

syzbot

unread,
Aug 11, 2020, 12:59:19 PM8/11/20
to da...@davemloft.net, johan....@gmail.com, ku...@kernel.org, linux-b...@vger.kernel.org, linux-...@vger.kernel.org, mar...@holtmann.org, net...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: bfdd5aaa Merge tag 'Smack-for-5.9' of git://github.com/csc..
git tree: net-next
console output: https://syzkaller.appspot.com/x/log.txt?x=167b4d3a900000
kernel config: https://syzkaller.appspot.com/x/.config?x=7bb894f55faf8242
dashboard link: https://syzkaller.appspot.com/bug?extid=9a0875bc1b2ca466b484
compiler: gcc (GCC) 10.1.0-syz 20200507

Unfortunately, I don't have any reproducer for this issue yet.

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

==================================================================
BUG: KASAN: slab-out-of-bounds in __lock_acquire+0x41d0/0x5640 kernel/locking/lockdep.c:4296
Read of size 8 at addr ffff8880497850a0 by task kworker/1:2/23918

CPU: 1 PID: 23918 Comm: kworker/1:2 Not tainted 5.8.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events l2cap_chan_timeout
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x18f/0x20d lib/dump_stack.c:118
print_address_description.constprop.0.cold+0xae/0x436 mm/kasan/report.c:383
__kasan_report mm/kasan/report.c:513 [inline]
kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530
__lock_acquire+0x41d0/0x5640 kernel/locking/lockdep.c:4296
lock_acquire+0x1f1/0xad0 kernel/locking/lockdep.c:5005
__raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline]
_raw_spin_lock_bh+0x2f/0x40 kernel/locking/spinlock.c:175
spin_lock_bh include/linux/spinlock.h:359 [inline]
lock_sock_nested+0x3b/0x110 net/core/sock.c:3040
l2cap_sock_teardown_cb+0x88/0x400 net/bluetooth/l2cap_sock.c:1520
l2cap_chan_del+0xad/0x1300 net/bluetooth/l2cap_core.c:618
l2cap_chan_close+0x118/0xb10 net/bluetooth/l2cap_core.c:823
l2cap_chan_timeout+0x173/0x450 net/bluetooth/l2cap_core.c:436
process_one_work+0x94c/0x1670 kernel/workqueue.c:2269
worker_thread+0x64c/0x1120 kernel/workqueue.c:2415
kthread+0x3b5/0x4a0 kernel/kthread.c:292
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294

Allocated by task 3899:
save_stack+0x1b/0x40 mm/kasan/common.c:48
set_track mm/kasan/common.c:56 [inline]
__kasan_kmalloc.constprop.0+0xc2/0xd0 mm/kasan/common.c:494
__do_kmalloc mm/slab.c:3656 [inline]
__kmalloc+0x17a/0x340 mm/slab.c:3665
kmalloc include/linux/slab.h:560 [inline]
tomoyo_realpath_from_path+0xc3/0x620 security/tomoyo/realpath.c:254
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_check_open_permission+0x272/0x380 security/tomoyo/file.c:771
tomoyo_file_open security/tomoyo/tomoyo.c:313 [inline]
tomoyo_file_open+0xa3/0xd0 security/tomoyo/tomoyo.c:308
security_file_open+0x52/0x3f0 security/security.c:1574
do_dentry_open+0x3a0/0x1290 fs/open.c:815
do_open fs/namei.c:3243 [inline]
path_openat+0x1bb9/0x2750 fs/namei.c:3360
do_filp_open+0x17e/0x3c0 fs/namei.c:3387
do_sys_openat2+0x16f/0x3b0 fs/open.c:1179
do_sys_open fs/open.c:1195 [inline]
ksys_open include/linux/syscalls.h:1390 [inline]
__do_sys_open fs/open.c:1201 [inline]
__se_sys_open fs/open.c:1199 [inline]
__x64_sys_open+0x119/0x1c0 fs/open.c:1199
do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 3899:
save_stack+0x1b/0x40 mm/kasan/common.c:48
set_track mm/kasan/common.c:56 [inline]
kasan_set_free_info mm/kasan/common.c:316 [inline]
__kasan_slab_free+0xf5/0x140 mm/kasan/common.c:455
__cache_free mm/slab.c:3426 [inline]
kfree+0x103/0x2c0 mm/slab.c:3757
tomoyo_realpath_from_path+0x191/0x620 security/tomoyo/realpath.c:291
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_check_open_permission+0x272/0x380 security/tomoyo/file.c:771
tomoyo_file_open security/tomoyo/tomoyo.c:313 [inline]
tomoyo_file_open+0xa3/0xd0 security/tomoyo/tomoyo.c:308
security_file_open+0x52/0x3f0 security/security.c:1574
do_dentry_open+0x3a0/0x1290 fs/open.c:815
do_open fs/namei.c:3243 [inline]
path_openat+0x1bb9/0x2750 fs/namei.c:3360
do_filp_open+0x17e/0x3c0 fs/namei.c:3387
do_sys_openat2+0x16f/0x3b0 fs/open.c:1179
do_sys_open fs/open.c:1195 [inline]
ksys_open include/linux/syscalls.h:1390 [inline]
__do_sys_open fs/open.c:1201 [inline]
__se_sys_open fs/open.c:1199 [inline]
__x64_sys_open+0x119/0x1c0 fs/open.c:1199
do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff888049784000
which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 160 bytes to the right of
4096-byte region [ffff888049784000, ffff888049785000)
The buggy address belongs to the page:
page:ffffea000125e100 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 head:ffffea000125e100 order:1 compound_mapcount:0
flags: 0xfffe0000010200(slab|head)
raw: 00fffe0000010200 ffffea0001c34088 ffffea000122f088 ffff8880aa002000
raw: 0000000000000000 ffff888049784000 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff888049784f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888049785000: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888049785080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff888049785100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888049785180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================


---
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 syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Dec 19, 2020, 2:56:09 AM12/19/20
to da...@davemloft.net, johan....@gmail.com, ku...@kernel.org, linux-b...@vger.kernel.org, linux-...@vger.kernel.org, luiz....@gmail.com, mar...@holtmann.org, net...@vger.kernel.org, syzkall...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: a409ed15 Merge tag 'gpio-v5.11-1' of git://git.kernel.org/..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=174778a7500000
kernel config: https://syzkaller.appspot.com/x/.config?x=20efebc728efc8ff
dashboard link: https://syzkaller.appspot.com/bug?extid=9a0875bc1b2ca466b484
compiler: gcc (GCC) 10.1.0-syz 20200507
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=10a4445b500000

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

==================================================================
BUG: KASAN: slab-out-of-bounds in __lock_acquire+0x3da6/0x54b0 kernel/locking/lockdep.c:4702
Read of size 8 at addr ffff88801938c0a0 by task kworker/1:1/34

CPU: 1 PID: 34 Comm: kworker/1:1 Not tainted 5.10.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events l2cap_chan_timeout
Call Trace:
__dump_stack lib/dump_stack.c:79 [inline]
dump_stack+0x107/0x163 lib/dump_stack.c:120
print_address_description.constprop.0.cold+0xae/0x497 mm/kasan/report.c:385
__kasan_report mm/kasan/report.c:545 [inline]
kasan_report.cold+0x1f/0x37 mm/kasan/report.c:562
__lock_acquire+0x3da6/0x54b0 kernel/locking/lockdep.c:4702
lock_acquire kernel/locking/lockdep.c:5437 [inline]
lock_acquire+0x29d/0x750 kernel/locking/lockdep.c:5402
__raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline]
_raw_spin_lock_bh+0x2f/0x40 kernel/locking/spinlock.c:175
spin_lock_bh include/linux/spinlock.h:359 [inline]
lock_sock_nested+0x3b/0x110 net/core/sock.c:3049
l2cap_sock_teardown_cb+0xa1/0x660 net/bluetooth/l2cap_sock.c:1520
l2cap_chan_del+0xbc/0xaa0 net/bluetooth/l2cap_core.c:618
l2cap_chan_close+0x1bc/0xaf0 net/bluetooth/l2cap_core.c:823
l2cap_chan_timeout+0x17e/0x2f0 net/bluetooth/l2cap_core.c:436
process_one_work+0x98d/0x1630 kernel/workqueue.c:2275
worker_thread+0x64c/0x1120 kernel/workqueue.c:2421
kthread+0x3b1/0x4a0 kernel/kthread.c:292
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296

Allocated by task 11222:
kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48
kasan_set_track mm/kasan/common.c:56 [inline]
__kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:461
__do_kmalloc mm/slab.c:3659 [inline]
__kmalloc+0x18b/0x340 mm/slab.c:3668
kmalloc include/linux/slab.h:557 [inline]
kzalloc include/linux/slab.h:682 [inline]
tomoyo_get_name+0x22b/0x4c0 security/tomoyo/memory.c:173
tomoyo_parse_name_union+0xbc/0x160 security/tomoyo/util.c:260
tomoyo_update_path_acl security/tomoyo/file.c:395 [inline]
tomoyo_write_file+0x4c0/0x7f0 security/tomoyo/file.c:1022
tomoyo_write_domain2+0x116/0x1d0 security/tomoyo/common.c:1152
tomoyo_add_entry security/tomoyo/common.c:2042 [inline]
tomoyo_supervisor+0xbee/0xf20 security/tomoyo/common.c:2103
tomoyo_audit_path_log security/tomoyo/file.c:168 [inline]
tomoyo_path_permission security/tomoyo/file.c:587 [inline]
tomoyo_path_permission+0x270/0x3a0 security/tomoyo/file.c:573
tomoyo_path_perm+0x37c/0x3f0 security/tomoyo/file.c:838
tomoyo_path_symlink+0x94/0xe0 security/tomoyo/tomoyo.c:200
security_path_symlink+0xdf/0x150 security/security.c:1111
do_symlinkat+0x123/0x2c0 fs/namei.c:3985
do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff88801938c000
which belongs to the cache kmalloc-128 of size 128
The buggy address is located 32 bytes to the right of
128-byte region [ffff88801938c000, ffff88801938c080)
The buggy address belongs to the page:
page:00000000b7b67fec refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1938c
flags: 0xfff00000000200(slab)
raw: 00fff00000000200 ffffea00004e6508 ffffea0000a5cf48 ffff888010840400
raw: 0000000000000000 ffff88801938c000 0000000100000010 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88801938bf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88801938c000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88801938c080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff88801938c100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88801938c180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

syzbot

unread,
Nov 24, 2021, 4:19:14 PM11/24/21
to da...@davemloft.net, ji...@nvidia.com, johan....@gmail.com, ku...@kernel.org, leo...@nvidia.com, linux-b...@vger.kernel.org, linux-...@vger.kernel.org, luiz....@gmail.com, mar...@holtmann.org, net...@vger.kernel.org, syzkall...@googlegroups.com, wanji...@vivo.com
syzbot suspects this issue was fixed by commit:

commit c5e0321e43deed0512b34d8d8d40a16c0e22b541
Author: Leon Romanovsky <leo...@nvidia.com>
Date: Tue Oct 26 19:40:42 2021 +0000

Revert "devlink: Remove not-executed trap policer notifications"

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=10f87adeb00000
start commit: a409ed156a90 Merge tag 'gpio-v5.11-1' of git://git.kernel...
git tree: upstream
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=10a4445b500000

If the result looks correct, please mark the issue as fixed by replying with:

#syz fix: Revert "devlink: Remove not-executed trap policer notifications"

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

syzbot

unread,
Sep 29, 2022, 6:19:29 AM9/29/22
to syzkall...@googlegroups.com
Auto-closing this bug as obsolete.
No recent activity, existing reproducers are no longer triggering the issue.
Reply all
Reply to author
Forward
0 new messages