syzbot


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

Status: upstream: reported syz repro on 2020/08/11 16:59
Reported-by: syzbot+9a0875bc1b2ca466b484@syzkaller.appspotmail.com
First crash: 691d, last: 250d

Cause bisection: introduced by (bisect log) [release commit]:
commit c470abd4fde40ea6a0846a2beab642a578c0b8cd
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date: Sun Feb 19 22:34:00 2017 +0000

  Linux 4.10

Crash: KASAN: use-after-free Read in lock_sock_nested (log)
Repro: syz .config

Fix bisection: fixed by (bisect log) :
commit c5e0321e43deed0512b34d8d8d40a16c0e22b541
Author: Leon Romanovsky <leonro@nvidia.com>
Date: Tue Oct 26 19:40:42 2021 +0000

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

similar bugs (8):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in lock_sock_nested C inconclusive 326 12d 1165d 0/1 upstream: reported C repro on 2019/04/24 06:28
linux-4.19 KASAN: slab-out-of-bounds Read in lock_sock_nested 11 29d 597d 0/1 upstream: reported on 2020/11/12 16:53
upstream BUG: unable to handle kernel paging request in lock_sock_nested 43 256d 696d 0/22 auto-closed as invalid on 2022/02/16 22:16
linux-4.19 KASAN: wild-memory-access Write in lock_sock_nested 2 520d 589d 0/1 auto-closed as invalid on 2021/05/28 14:35
linux-4.14 general protection fault in lock_sock_nested 4 421d 639d 0/1 auto-closed as invalid on 2021/09/04 19:35
linux-4.19 KASAN: use-after-free Read in lock_sock_nested C 428 8h52m 1072d 0/1 upstream: reported C repro on 2019/07/26 21:27
upstream KASAN: use-after-free Read in lock_sock_nested C inconclusive done 1830 2d08h 1277d 0/22 upstream: reported C repro on 2019/01/02 10:41
linux-4.14 BUG: unable to handle kernel paging request in lock_sock_nested 4 414d 534d 0/1 auto-closed as invalid on 2021/09/11 11:51
Patch testing requests:
Created Duration User Patch Repo Result
2021/06/30 08:22 11m wanjiabing@vivo.com linux-next report log

Sample crash report:
==================================================================
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
==================================================================

Crashes (23):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-selinux-root 2020/12/19 07:55 upstream a409ed156a90 04201c06 .config log report syz
ci-upstream-kasan-gce-root 2021/09/25 10:28 upstream 7d42e9818258 8cac236e .config log report info KASAN: slab-out-of-bounds Read in lock_sock_nested
ci-upstream-kasan-gce-selinux-root 2021/07/13 23:45 upstream 40226a3d96ef fa0594c3 .config log report info KASAN: slab-out-of-bounds Read in lock_sock_nested
ci-qemu-upstream 2021/05/07 17:53 upstream 18a3c5f7abfd f6da8120 .config log report info KASAN: slab-out-of-bounds Read in lock_sock_nested
ci-upstream-kasan-gce-selinux-root 2021/05/02 23:08 upstream d2b6f8a17919 77e2b668 .config log report info KASAN: slab-out-of-bounds Read in lock_sock_nested
ci-upstream-kasan-gce-selinux-root 2021/04/27 06:07 upstream 4a0225c3d208 805b5003 .config log report info KASAN: slab-out-of-bounds Read in lock_sock_nested
ci-upstream-kasan-gce-selinux-root 2021/03/31 15:20 upstream 5e46d1b78a03 6a81331a .config log report info KASAN: slab-out-of-bounds Read in lock_sock_nested
ci-upstream-kasan-gce-root 2021/02/25 15:16 upstream 29c395c77a9a 76f7fc95 .config log report info KASAN: slab-out-of-bounds Read in lock_sock_nested
ci-upstream-kasan-gce-selinux-root 2021/02/24 06:45 upstream c03c21ba6f4e fcc6d71b .config log report info KASAN: slab-out-of-bounds Read in lock_sock_nested
ci-upstream-kasan-gce-selinux-root 2021/02/24 05:35 upstream c03c21ba6f4e fcc6d71b .config log report info KASAN: slab-out-of-bounds Read in lock_sock_nested
ci-upstream-kasan-gce-selinux-root 2021/02/01 15:25 upstream 1048ba83fb1c e6b95f32 .config log report info KASAN: slab-out-of-bounds Read in lock_sock_nested
ci-upstream-kasan-gce-smack-root 2021/01/18 20:36 upstream 19c329f68089 63631df1 .config log report info KASAN: slab-out-of-bounds Read in lock_sock_nested
ci-upstream-net-kasan-gce 2021/05/20 10:19 net-next bc6d076daa8c a343ba6b .config log report info KASAN: slab-out-of-bounds Read in lock_sock_nested
ci-upstream-linux-next-kasan-gce-root 2021/06/30 09:49 linux-next a1f92694393a 84fd4c77 .config log report info KASAN: slab-out-of-bounds Read in lock_sock_nested
ci-upstream-kasan-gce-selinux-root 2021/01/15 22:28 upstream 5ee88057889b 65a7a854 .config log report info
ci-upstream-kasan-gce-selinux-root 2020/11/12 04:31 upstream 3d5e28bff7ad cca87986 .config log report info
ci-upstream-net-this-kasan-gce 2020/08/31 16:01 net c8146fe292a7 d5a3ae1f .config log report
ci-upstream-net-this-kasan-gce 2020/08/13 09:44 net 06a7a37be55e bc15f7db .config log report
ci-upstream-net-this-kasan-gce 2020/08/12 02:33 net 633f5b6bca9b bb3e5fe6 .config log report
ci-upstream-net-kasan-gce 2020/09/27 14:41 net-next 435be28b0789 5dd8aee8 .config log report info
ci-upstream-net-kasan-gce 2020/09/11 08:09 net-next 9984c0bb22dc adfb8b4e .config log report
ci-upstream-net-kasan-gce 2020/08/13 02:48 net-next bfdd5aaa54b0 bc15f7db .config log report
ci-upstream-net-kasan-gce 2020/08/10 18:04 net-next bfdd5aaa54b0 7adc7b65 .config log report