bisecting fixing commit since 14b58326976de6ef3998eefec1dd7f8b38b97a75 building syzkaller on f721e4a097714a9054b9fe1aadf427afbbd2c157 testing commit 14b58326976de6ef3998eefec1dd7f8b38b97a75 with gcc (GCC) 8.4.1 20210217 kernel signature: c48de388d041995234c99392fcc14c64f660ca9bfbe5d765101e17c0db568ffe all runs: crashed: KASAN: use-after-free Read in lock_sock_nested testing current HEAD 3242aa3a635c0958671ee1e4b0958dcc7c4e5c79 testing commit 3242aa3a635c0958671ee1e4b0958dcc7c4e5c79 with gcc (GCC) 8.4.1 20210217 kernel signature: 4d5efa0edecefb7f56862534da72b5c45de4de37c167db9ec3ade11de1c329ff all runs: crashed: KASAN: use-after-free Read in lock_sock_nested revisions tested: 2, total time: 24m40.232183763s (build: 15m31.470303712s, test: 8m9.062944499s) the crash still happens on HEAD commit msg: Linux 4.14.222 crash: KASAN: use-after-free Read in lock_sock_nested ================================================================== BUG: KASAN: use-after-free in __lock_acquire+0x2cf0/0x42d0 kernel/locking/lockdep.c:3369 Read of size 8 at addr ffff8881da8175e0 by task kworker/1:2/2812 CPU: 1 PID: 2812 Comm: kworker/1:2 Not tainted 4.14.222-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:17 [inline] dump_stack+0x14b/0x1e7 lib/dump_stack.c:58 print_address_description.cold.6+0x9/0x1ca mm/kasan/report.c:252 kasan_report_error mm/kasan/report.c:351 [inline] kasan_report mm/kasan/report.c:409 [inline] kasan_report.cold.7+0x11a/0x2d3 mm/kasan/report.c:393 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430 __lock_acquire+0x2cf0/0x42d0 kernel/locking/lockdep.c:3369 lock_acquire+0x17e/0x3e0 kernel/locking/lockdep.c:3998 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline] _raw_spin_lock_bh+0x31/0x40 kernel/locking/spinlock.c:176 spin_lock_bh include/linux/spinlock.h:322 [inline] lock_sock_nested+0x3a/0x100 net/core/sock.c:2788 l2cap_sock_teardown_cb+0x7a/0x3e0 net/bluetooth/l2cap_sock.c:1341 l2cap_chan_close+0x3be/0x7e0 net/bluetooth/l2cap_core.c:761 l2cap_chan_timeout+0x10e/0x1b0 net/bluetooth/l2cap_core.c:430 process_one_work+0x74f/0x1620 kernel/workqueue.c:2116 worker_thread+0xcc/0xee0 kernel/workqueue.c:2250 kthread+0x338/0x400 kernel/kthread.c:232 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404 Allocated by task 5807: save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59 save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_kmalloc.part.1+0x62/0xf0 mm/kasan/kasan.c:551 kasan_kmalloc+0xaf/0xc0 mm/kasan/kasan.c:536 __do_kmalloc_node mm/slab.c:3682 [inline] __kmalloc_node+0x50/0x70 mm/slab.c:3689 kmalloc_node include/linux/slab.h:530 [inline] kvmalloc_node+0x70/0x80 mm/util.c:397 kvmalloc include/linux/mm.h:531 [inline] xt_alloc_table_info+0x60/0xc0 net/netfilter/x_tables.c:1062 do_replace net/ipv6/netfilter/ip6_tables.c:1146 [inline] do_ip6t_set_ctl+0x1af/0x3d0 net/ipv6/netfilter/ip6_tables.c:1685 nf_sockopt net/netfilter/nf_sockopt.c:106 [inline] nf_setsockopt+0x5c/0xb0 net/netfilter/nf_sockopt.c:115 ipv6_setsockopt+0x95/0xf0 net/ipv6/ipv6_sockglue.c:937 tcp_setsockopt net/ipv4/tcp.c:2828 [inline] tcp_setsockopt+0x6a/0xd0 net/ipv4/tcp.c:2822 sock_common_setsockopt+0x73/0xf0 net/core/sock.c:2994 SYSC_setsockopt net/socket.c:1865 [inline] SyS_setsockopt+0x130/0x1f0 net/socket.c:1844 do_syscall_64+0x1c7/0x5b0 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb Freed by task 5807: save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59 save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_slab_free+0xab/0x190 mm/kasan/kasan.c:524 __cache_free mm/slab.c:3496 [inline] kfree+0xcc/0x270 mm/slab.c:3815 kvfree+0x2c/0x30 mm/util.c:416 xt_free_table_info+0xf8/0x160 net/netfilter/x_tables.c:1082 __do_replace+0x3fa/0x5d0 net/ipv6/netfilter/ip6_tables.c:1107 do_replace net/ipv6/netfilter/ip6_tables.c:1161 [inline] do_ip6t_set_ctl+0x25c/0x3d0 net/ipv6/netfilter/ip6_tables.c:1685 nf_sockopt net/netfilter/nf_sockopt.c:106 [inline] nf_setsockopt+0x5c/0xb0 net/netfilter/nf_sockopt.c:115 ipv6_setsockopt+0x95/0xf0 net/ipv6/ipv6_sockglue.c:937 tcp_setsockopt net/ipv4/tcp.c:2828 [inline] tcp_setsockopt+0x6a/0xd0 net/ipv4/tcp.c:2822 sock_common_setsockopt+0x73/0xf0 net/core/sock.c:2994 SYSC_setsockopt net/socket.c:1865 [inline] SyS_setsockopt+0x130/0x1f0 net/socket.c:1844 do_syscall_64+0x1c7/0x5b0 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb The buggy address belongs to the object at ffff8881da817540 which belongs to the cache kmalloc-2048 of size 2048 The buggy address is located 160 bytes inside of 2048-byte region [ffff8881da817540, ffff8881da817d40) The buggy address belongs to the page: page:ffffea00076a0580 count:1 mapcount:0 mapping:ffff8881da816440 index:0x0 compound_mapcount: 0 flags: 0x17ffe0000008100(slab|head) raw: 017ffe0000008100 ffff8881da816440 0000000000000000 0000000100000003 raw: ffffea0007a7b520 ffffea00074be9a0 ffff8881f6000c40 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8881da817480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8881da817500: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb >ffff8881da817580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881da817600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881da817680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================