bisecting cause commit starting from 510e2ceda031eed97a7a0f9aad65d271a58b460d building syzkaller on 7fb690f39a0394eb6691d7014d509c966836c8a1 testing commit 510e2ceda031eed97a7a0f9aad65d271a58b460d with gcc (GCC) 8.1.0 run #0: crashed: KASAN: use-after-free Read in rhashtable_walk_enter run #1: crashed: BUG: spinlock bad magic in rhashtable_walk_enter run #2: crashed: KASAN: use-after-free Read in rhashtable_walk_enter run #3: crashed: KASAN: use-after-free Read in rhashtable_walk_enter run #4: crashed: KASAN: use-after-free Read in rhashtable_walk_enter run #5: crashed: KASAN: use-after-free Read in rhashtable_walk_enter run #6: crashed: KASAN: use-after-free Read in rhashtable_walk_enter run #7: crashed: KASAN: slab-out-of-bounds Read in rhashtable_walk_enter run #8: crashed: KASAN: use-after-free Read in rhashtable_walk_enter run #9: crashed: KASAN: use-after-free Read in rhashtable_walk_enter testing release v5.1 testing commit e93c9c99a629c61837d5a7fc2120cd2b6c70dbdd with gcc (GCC) 8.1.0 all runs: OK # git bisect start 510e2ceda031eed97a7a0f9aad65d271a58b460d v5.1 Bisecting: 5346 revisions left to test after this (roughly 12 steps) [80f232121b69cc69a31ccb2b38c1665d770b0710] Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next testing commit 80f232121b69cc69a31ccb2b38c1665d770b0710 with gcc (GCC) 8.1.0 all runs: OK # git bisect good 80f232121b69cc69a31ccb2b38c1665d770b0710 Bisecting: 2669 revisions left to test after this (roughly 11 steps) [a2d635decbfa9c1e4ae15cb05b68b2559f7f827c] Merge tag 'drm-next-2019-05-09' of git://anongit.freedesktop.org/drm/drm testing commit a2d635decbfa9c1e4ae15cb05b68b2559f7f827c with gcc (GCC) 8.1.0 all runs: OK # git bisect good a2d635decbfa9c1e4ae15cb05b68b2559f7f827c Bisecting: 1424 revisions left to test after this (roughly 10 steps) [c3b7112df86b769927a60a6d7175988ca3d60f09] fork: do not release lock that wasn't taken testing commit c3b7112df86b769927a60a6d7175988ca3d60f09 with gcc (GCC) 8.1.0 all runs: OK # git bisect good c3b7112df86b769927a60a6d7175988ca3d60f09 Bisecting: 706 revisions left to test after this (roughly 10 steps) [55472bae5331f33582d9f0e8919fed8bebcda0da] Merge tag 'linux-watchdog-5.2-rc1' of git://www.linux-watchdog.org/linux-watchdog testing commit 55472bae5331f33582d9f0e8919fed8bebcda0da with gcc (GCC) 8.1.0 all runs: OK # git bisect good 55472bae5331f33582d9f0e8919fed8bebcda0da Bisecting: 325 revisions left to test after this (roughly 9 steps) [318222a35bfb0ae9b5ff3e359a583463e6cfcd94] Merge branch 'akpm' (patches from Andrew) testing commit 318222a35bfb0ae9b5ff3e359a583463e6cfcd94 with gcc (GCC) 8.1.0 all runs: OK # git bisect good 318222a35bfb0ae9b5ff3e359a583463e6cfcd94 Bisecting: 165 revisions left to test after this (roughly 7 steps) [f8587c80c62a65c004ee838275351814b52c428c] Merge branch 'pci/printk-portdrv' testing commit f8587c80c62a65c004ee838275351814b52c428c with gcc (GCC) 8.1.0 all runs: OK # git bisect good f8587c80c62a65c004ee838275351814b52c428c Bisecting: 81 revisions left to test after this (roughly 6 steps) [280664f558c9d973315d48f125eb664cc607d089] Merge tag 'modules-for-v5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux testing commit 280664f558c9d973315d48f125eb664cc607d089 with gcc (GCC) 8.1.0 all runs: OK # git bisect good 280664f558c9d973315d48f125eb664cc607d089 Bisecting: 40 revisions left to test after this (roughly 5 steps) [f4a0be84d73ec648628bf8094600ceb73cb6073f] enetc: Fix NULL dma address unmap for Tx BD extensions testing commit f4a0be84d73ec648628bf8094600ceb73cb6073f with gcc (GCC) 8.1.0 all runs: OK # git bisect good f4a0be84d73ec648628bf8094600ceb73cb6073f Bisecting: 20 revisions left to test after this (roughly 4 steps) [ba6306e3f648a857ae52ddcabc2859542fd2f94c] rhashtable: Remove RCU marking from rhash_lock_head testing commit ba6306e3f648a857ae52ddcabc2859542fd2f94c with gcc (GCC) 8.1.0 all runs: OK # git bisect good ba6306e3f648a857ae52ddcabc2859542fd2f94c Bisecting: 10 revisions left to test after this (roughly 3 steps) [b4e467c82f8c12af78b6f6fa5730cb7dea7af1b4] net: usb: qmi_wwan: add Telit 0x1260 and 0x1261 compositions testing commit b4e467c82f8c12af78b6f6fa5730cb7dea7af1b4 with gcc (GCC) 8.1.0 all runs: OK # git bisect good b4e467c82f8c12af78b6f6fa5730cb7dea7af1b4 Bisecting: 5 revisions left to test after this (roughly 3 steps) [5aee080f2cf18215dfc10ad2bb4be29fa7381050] Revert "aqc111: fix double endianness swap on BE" testing commit 5aee080f2cf18215dfc10ad2bb4be29fa7381050 with gcc (GCC) 8.1.0 run #0: crashed: KASAN: use-after-free Read in rhashtable_walk_enter run #1: crashed: KASAN: slab-out-of-bounds Read in rhashtable_walk_enter run #2: crashed: KASAN: slab-out-of-bounds Read in rhashtable_walk_enter run #3: crashed: INFO: trying to register non-static key in rhashtable_walk_enter run #4: crashed: KASAN: slab-out-of-bounds Read in rhashtable_walk_enter run #5: crashed: KASAN: use-after-free Read in rhashtable_walk_enter run #6: crashed: KASAN: use-after-free Read in rhashtable_walk_enter run #7: crashed: KASAN: slab-out-of-bounds Read in rhashtable_walk_enter run #8: crashed: KASAN: slab-out-of-bounds Read in rhashtable_walk_enter run #9: crashed: KASAN: use-after-free Read in rhashtable_walk_enter # git bisect bad 5aee080f2cf18215dfc10ad2bb4be29fa7381050 Bisecting: 2 revisions left to test after this (roughly 1 step) [61fb0d01680771f72cc9d39783fb2c122aaad51e] ipv6: prevent possible fib6 leaks testing commit 61fb0d01680771f72cc9d39783fb2c122aaad51e with gcc (GCC) 8.1.0 all runs: OK # git bisect good 61fb0d01680771f72cc9d39783fb2c122aaad51e Bisecting: 0 revisions left to test after this (roughly 1 step) [858e5400e682370d0f8d217fcd6fd6ae5b256f5f] xfrm: ressurrect "Fix uninitialized memory read in _decode_session4" testing commit 858e5400e682370d0f8d217fcd6fd6ae5b256f5f with gcc (GCC) 8.1.0 run #0: crashed: KASAN: use-after-free Read in rhashtable_walk_enter run #1: crashed: KASAN: use-after-free Read in rhashtable_walk_enter run #2: crashed: KASAN: use-after-free Read in rhashtable_walk_enter run #3: crashed: KASAN: slab-out-of-bounds Read in rhashtable_walk_enter run #4: crashed: KASAN: slab-out-of-bounds Read in rhashtable_walk_enter run #5: crashed: KASAN: slab-out-of-bounds Read in rhashtable_walk_enter run #6: crashed: KASAN: use-after-free Read in rhashtable_walk_enter run #7: crashed: KASAN: slab-out-of-bounds Read in rhashtable_walk_enter run #8: crashed: KASAN: use-after-free Read in rhashtable_walk_enter run #9: crashed: INFO: trying to register non-static key in rhashtable_walk_enter # git bisect bad 858e5400e682370d0f8d217fcd6fd6ae5b256f5f Bisecting: 0 revisions left to test after this (roughly 0 steps) [7e27e8d6130c5e88fac9ddec4249f7f2337fe7f8] tipc: switch order of device registration to fix a crash testing commit 7e27e8d6130c5e88fac9ddec4249f7f2337fe7f8 with gcc (GCC) 8.1.0 run #0: crashed: KASAN: use-after-free Read in rhashtable_walk_enter run #1: crashed: KASAN: use-after-free Read in rhashtable_walk_enter run #2: crashed: KASAN: use-after-free Read in rhashtable_walk_enter run #3: crashed: KASAN: use-after-free Read in rhashtable_walk_enter run #4: crashed: KASAN: use-after-free Read in rhashtable_walk_enter run #5: crashed: INFO: trying to register non-static key in rhashtable_walk_enter run #6: crashed: KASAN: slab-out-of-bounds Read in rhashtable_walk_enter run #7: crashed: KASAN: slab-out-of-bounds Read in rhashtable_walk_enter run #8: crashed: KASAN: use-after-free Read in rhashtable_walk_enter run #9: crashed: KASAN: use-after-free Read in rhashtable_walk_enter # git bisect bad 7e27e8d6130c5e88fac9ddec4249f7f2337fe7f8 7e27e8d6130c5e88fac9ddec4249f7f2337fe7f8 is the first bad commit commit 7e27e8d6130c5e88fac9ddec4249f7f2337fe7f8 Author: Junwei Hu Date: Thu May 16 10:51:15 2019 +0800 tipc: switch order of device registration to fix a crash When tipc is loaded while many processes try to create a TIPC socket, a crash occurs: PANIC: Unable to handle kernel paging request at virtual address "dfff20000000021d" pc : tipc_sk_create+0x374/0x1180 [tipc] lr : tipc_sk_create+0x374/0x1180 [tipc] Exception class = DABT (current EL), IL = 32 bits Call trace: tipc_sk_create+0x374/0x1180 [tipc] __sock_create+0x1cc/0x408 __sys_socket+0xec/0x1f0 __arm64_sys_socket+0x74/0xa8 ... This is due to race between sock_create and unfinished register_pernet_device. tipc_sk_insert tries to do "net_generic(net, tipc_net_id)". but tipc_net_id is not initialized yet. So switch the order of the two to close the race. This can be reproduced with multiple processes doing socket(AF_TIPC, ...) and one process doing module removal. Fixes: a62fbccecd62 ("tipc: make subscriber server support net namespace") Signed-off-by: Junwei Hu Reported-by: Wang Wang Reviewed-by: Xiaogang Wang Signed-off-by: David S. Miller :040000 040000 a8c27e7716c8b1c2b8a3c3758b7ed317c27a4397 576758d95f3ab1f0b4ce1c811eebe81b1322c5e1 M net revisions tested: 16, total time: 4h49m22.173931818s (build: 2h7m33.259573259s, test: 2h33m21.90257493s) first bad commit: 7e27e8d6130c5e88fac9ddec4249f7f2337fe7f8 tipc: switch order of device registration to fix a crash cc: ["davem@davemloft.net" "hujunwei4@huawei.com" "jon.maloy@ericsson.com" "linux-kernel@vger.kernel.org" "netdev@vger.kernel.org" "tipc-discussion@lists.sourceforge.net" "wangxiaogang3@huawei.com" "ying.xue@windriver.com"] crash: KASAN: use-after-free Read in rhashtable_walk_enter ================================================================== BUG: KASAN: use-after-free in __lock_acquire+0x3c15/0x55b0 kernel/locking/lockdep.c:3664 Read of size 8 at addr ffff88809ee96e40 by task syz-executor.0/7446 CPU: 1 PID: 7446 Comm: syz-executor.0 Not tainted 5.1.0+ #1 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x113/0x167 lib/dump_stack.c:113 print_address_description.cold.5+0x9/0x1ff mm/kasan/report.c:188 __kasan_report.cold.6+0x1b/0x39 mm/kasan/report.c:317 kasan_report+0x12/0x20 mm/kasan/common.c:614 __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:132 __lock_acquire+0x3c15/0x55b0 kernel/locking/lockdep.c:3664 lock_acquire+0x173/0x3d0 kernel/locking/lockdep.c:4302 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2d/0x40 kernel/locking/spinlock.c:151 spin_lock include/linux/spinlock.h:338 [inline] rhashtable_walk_enter+0xf4/0x300 lib/rhashtable.c:669 __tipc_dump_start+0x1bb/0x2c0 net/tipc/socket.c:3414 tipc_dump_start+0x6e/0x90 net/tipc/socket.c:3396 __netlink_dump_start+0x485/0x810 net/netlink/af_netlink.c:2351 netlink_dump_start include/linux/netlink.h:226 [inline] tipc_sock_diag_handler_dump+0x186/0x260 net/tipc/diag.c:91 __sock_diag_cmd net/core/sock_diag.c:232 [inline] sock_diag_rcv_msg+0x291/0x380 net/core/sock_diag.c:263 netlink_rcv_skb+0x13f/0x380 net/netlink/af_netlink.c:2486 sock_diag_rcv+0x25/0x40 net/core/sock_diag.c:274 netlink_unicast_kernel net/netlink/af_netlink.c:1311 [inline] netlink_unicast+0x444/0x640 net/netlink/af_netlink.c:1337 netlink_sendmsg+0x765/0xc50 net/netlink/af_netlink.c:1926 sock_sendmsg_nosec net/socket.c:660 [inline] sock_sendmsg+0xd6/0x100 net/socket.c:671 ___sys_sendmsg+0x658/0x960 net/socket.c:2292 __sys_sendmsg+0xd9/0x180 net/socket.c:2330 __do_sys_sendmsg net/socket.c:2339 [inline] __se_sys_sendmsg net/socket.c:2337 [inline] __x64_sys_sendmsg+0x73/0xb0 net/socket.c:2337 do_syscall_64+0xd6/0x530 arch/x86/entry/common.c:301 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x458da9 Code: ad b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 7b b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007fa7221dac78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000458da9 RDX: 0000000000000000 RSI: 0000000020000080 RDI: 0000000000000003 RBP: 000000000073bf00 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007fa7221db6d4 R13: 00000000004c6790 R14: 00000000004db3e8 R15: 00000000ffffffff Allocated by task 7342: save_stack+0x21/0x90 mm/kasan/common.c:71 set_track mm/kasan/common.c:79 [inline] __kasan_kmalloc.constprop.8+0xc7/0xd0 mm/kasan/common.c:489 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:503 kmem_cache_alloc_trace+0x154/0x750 mm/slab.c:3585 kmalloc include/linux/slab.h:547 [inline] tomoyo_print_header security/tomoyo/audit.c:156 [inline] tomoyo_init_log+0x18e/0x1e00 security/tomoyo/audit.c:255 tomoyo_supervisor+0x30a/0xc00 security/tomoyo/common.c:2095 tomoyo_audit_path_log security/tomoyo/file.c:168 [inline] tomoyo_path_permission+0x24e/0x340 security/tomoyo/file.c:587 tomoyo_check_open_permission+0x2c6/0x2f0 security/tomoyo/file.c:777 tomoyo_file_open+0x81/0xa0 security/tomoyo/tomoyo.c:319 security_file_open+0x4c/0x250 security/security.c:1458 do_dentry_open+0x2d1/0x1000 fs/open.c:764 vfs_open+0x9a/0xc0 fs/open.c:886 do_last fs/namei.c:3416 [inline] path_openat+0xb52/0x3d10 fs/namei.c:3533 do_filp_open+0x177/0x250 fs/namei.c:3563 do_sys_open+0x1dd/0x370 fs/open.c:1069 __do_sys_openat fs/open.c:1096 [inline] __se_sys_openat fs/open.c:1090 [inline] __x64_sys_openat+0x98/0xf0 fs/open.c:1090 do_syscall_64+0xd6/0x530 arch/x86/entry/common.c:301 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 7342: save_stack+0x21/0x90 mm/kasan/common.c:71 set_track mm/kasan/common.c:79 [inline] __kasan_slab_free+0x102/0x150 mm/kasan/common.c:451 kasan_slab_free+0xe/0x10 mm/kasan/common.c:459 __cache_free mm/slab.c:3462 [inline] kfree+0xcf/0x230 mm/slab.c:3785 tomoyo_init_log+0x12e7/0x1e00 security/tomoyo/audit.c:294 tomoyo_supervisor+0x30a/0xc00 security/tomoyo/common.c:2095 tomoyo_audit_path_log security/tomoyo/file.c:168 [inline] tomoyo_path_permission+0x24e/0x340 security/tomoyo/file.c:587 tomoyo_check_open_permission+0x2c6/0x2f0 security/tomoyo/file.c:777 tomoyo_file_open+0x81/0xa0 security/tomoyo/tomoyo.c:319 security_file_open+0x4c/0x250 security/security.c:1458 do_dentry_open+0x2d1/0x1000 fs/open.c:764 vfs_open+0x9a/0xc0 fs/open.c:886 do_last fs/namei.c:3416 [inline] path_openat+0xb52/0x3d10 fs/namei.c:3533 do_filp_open+0x177/0x250 fs/namei.c:3563 do_sys_open+0x1dd/0x370 fs/open.c:1069 __do_sys_openat fs/open.c:1096 [inline] __se_sys_openat fs/open.c:1090 [inline] __x64_sys_openat+0x98/0xf0 fs/open.c:1090 do_syscall_64+0xd6/0x530 arch/x86/entry/common.c:301 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff88809ee96140 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 3328 bytes inside of 4096-byte region [ffff88809ee96140, ffff88809ee97140) The buggy address belongs to the page: page:ffffea00027ba580 count:1 mapcount:0 mapping:ffff8880aa400dc0 index:0x0 compound_mapcount: 0 flags: 0x1fffc0000010200(slab|head) raw: 01fffc0000010200 ffffea000267d908 ffffea000223b888 ffff8880aa400dc0 raw: 0000000000000000 ffff88809ee96140 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88809ee96d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88809ee96d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88809ee96e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88809ee96e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88809ee96f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================