bisecting cause commit starting from c85fb28b6f999db9928b841f63f1beeb3074eeca building syzkaller on 1880b4a9f394370a7d1fcb5c1cfca0fa1127b463 testing commit c85fb28b6f999db9928b841f63f1beeb3074eeca with gcc (GCC) 8.1.0 kernel signature: df98331e28ff30b3f7c40e49a436f4674bbf033f1b5f1da7571dff6918640e90 run #0: crashed: general protection fault in apparmor_cred_prepare run #1: crashed: WARNING: refcount bug in apparmor_cred_free run #2: crashed: kernel BUG at arch/x86/mm/physaddr.c:LINE! run #3: crashed: kernel BUG at arch/x86/mm/physaddr.c:LINE! run #4: crashed: BUG: unable to handle kernel NULL pointer dereference in crypto_destroy_tfm run #5: crashed: kernel BUG at arch/x86/mm/physaddr.c:LINE! run #6: crashed: BUG: unable to handle kernel paging request in get_pfnblock_flags_mask run #7: crashed: WARNING in apparmor_file_alloc_security run #8: crashed: BUG: unable to handle kernel NULL pointer dereference in crypto_destroy_tfm run #9: crashed: BUG: unable to handle kernel NULL pointer dereference in crypto_destroy_tfm testing release v5.8 testing commit bcf876870b95592b52519ed4aafcf9d95999bc9c with gcc (GCC) 8.1.0 kernel signature: a785f7794ef2ea0d0e3e4314fe485ef5a5aa6201f1b6e7c9d9bef76bd0ba54af run #0: crashed: BUG: unable to handle kernel paging request in apparmor_cred_free run #1: crashed: general protection fault in common_perm run #2: crashed: BUG: unable to handle kernel paging request in common_file_perm run #3: crashed: general protection fault in common_perm run #4: crashed: WARNING: refcount bug in apparmor_cred_free run #5: crashed: kernel BUG at arch/x86/mm/physaddr.c:LINE! run #6: crashed: BUG: unable to handle kernel paging request in path_name run #7: crashed: kernel BUG at mm/vmalloc.c:LINE! run #8: crashed: kernel BUG at arch/x86/mm/physaddr.c:LINE! run #9: crashed: general protection fault in crypto_destroy_tfm testing release v5.7 testing commit 3d77e6a8804abcc0504c904bd6e5cdf3a5cf8162 with gcc (GCC) 8.1.0 kernel signature: 2a159ed97018b8258219d3af1c44a4f878aef26e93b96882b31fc29b4406efde all runs: crashed: KASAN: use-after-free Read in sctp_auth_destroy_hmacs testing release v5.6 testing commit 7111951b8d4973bda27ff663f2cf18b663d15b48 with gcc (GCC) 8.1.0 kernel signature: fe0b3d5015d50ce4276b3f1c58045c18c63e2d7b0a4f8e84894f11c03d12558c all runs: crashed: KASAN: use-after-free Read in sctp_auth_destroy_hmacs testing release v5.5 testing commit d5226fa6dbae0569ee43ecfc08bdcd6770fc4755 with gcc (GCC) 8.1.0 kernel signature: a6fc847ba2855e5cdb558ea913c2d5183c6d0a2aa9cdf07f84c544c7b42403df all runs: crashed: KASAN: use-after-free Read in sctp_auth_destroy_hmacs testing release v5.4 testing commit 219d54332a09e8d8741c1e1982f5eae56099de85 with gcc (GCC) 8.1.0 kernel signature: 7f782351abf2fb688941341923fbfdd1397414d6afb891fb30ce422da35b20a7 all runs: crashed: KASAN: use-after-free Read in sctp_auth_destroy_hmacs testing release v5.3 testing commit 4d856f72c10ecb060868ed10ff1b1453943fc6c8 with gcc (GCC) 8.1.0 kernel signature: 1f3ab4e43151ab0b4cdac9459eaf50181146c93248fd2325128c9f342cd37d66 all runs: OK # git bisect start 219d54332a09e8d8741c1e1982f5eae56099de85 4d856f72c10ecb060868ed10ff1b1453943fc6c8 Bisecting: 7882 revisions left to test after this (roughly 13 steps) [a9f8b38a071b468276a243ea3ea5a0636e848cf2] Merge tag 'for-linus-5.4-1' of git://github.com/cminyard/linux-ipmi testing commit a9f8b38a071b468276a243ea3ea5a0636e848cf2 with gcc (GCC) 8.1.0 kernel signature: 8f064cf8899807dca801a7a03f524bb07442bbe67f12264322b33586e6f9f148 all runs: crashed: KASAN: use-after-free Read in sctp_auth_destroy_hmacs # git bisect bad a9f8b38a071b468276a243ea3ea5a0636e848cf2 Bisecting: 3920 revisions left to test after this (roughly 12 steps) [fe38bd6862074c0a2b9be7f31f043aaa70b2af5f] Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm testing commit fe38bd6862074c0a2b9be7f31f043aaa70b2af5f with gcc (GCC) 8.1.0 kernel signature: b1bc558eb1885ebe78fde84713b6dfdfe2f155c6a809a015b04060956e1e41b7 all runs: OK # git bisect good fe38bd6862074c0a2b9be7f31f043aaa70b2af5f Bisecting: 1962 revisions left to test after this (roughly 11 steps) [069841ef8293697e951c34f9a45601b77fb541d7] Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue testing commit 069841ef8293697e951c34f9a45601b77fb541d7 with gcc (GCC) 8.1.0 kernel signature: 51338b03d999d0b7c7aa50b9bbb1635a5eb4063bf82b640aabdea02c717e4034 all runs: crashed: KASAN: use-after-free Read in sctp_auth_destroy_hmacs # git bisect bad 069841ef8293697e951c34f9a45601b77fb541d7 Bisecting: 978 revisions left to test after this (roughly 10 steps) [f33bf6b00f20c9d26c42dfdaf8b83c2b0c1e6f71] net: stmmac: dwmac-meson: use devm_platform_ioremap_resource() to simplify code testing commit f33bf6b00f20c9d26c42dfdaf8b83c2b0c1e6f71 with gcc (GCC) 8.1.0 kernel signature: 29211c9ec9971f1e9aa998f1d008c7d4241948308f448d5be2629d753ace3253 all runs: crashed: KASAN: use-after-free Read in sctp_auth_destroy_hmacs # git bisect bad f33bf6b00f20c9d26c42dfdaf8b83c2b0c1e6f71 Bisecting: 489 revisions left to test after this (roughly 9 steps) [16e9b481e988b1f7e6df2243bb510e1c9b581272] nfp: no need to check return value of debugfs_create functions testing commit 16e9b481e988b1f7e6df2243bb510e1c9b581272 with gcc (GCC) 8.1.0 kernel signature: 7f1392f3bf90a18de87e272aa493c11821ba38a63311f4e467f2f3313787e66c all runs: OK # git bisect good 16e9b481e988b1f7e6df2243bb510e1c9b581272 Bisecting: 244 revisions left to test after this (roughly 8 steps) [a4d2113e46c1d2ded1bfed9a19fe17b5ab2d584c] ipvlan: set hw_enc_features like macvlan testing commit a4d2113e46c1d2ded1bfed9a19fe17b5ab2d584c with gcc (GCC) 8.1.0 kernel signature: 3d822d90d537f3276a020d2bc6b1b907e4b3c790964c284ee355198868c57e5e all runs: OK # git bisect good a4d2113e46c1d2ded1bfed9a19fe17b5ab2d584c Bisecting: 113 revisions left to test after this (roughly 7 steps) [932630fa902878f4c8c50d0b1260eeb9de16b0a4] Merge tag 'wireless-drivers-next-for-davem-2019-08-19' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next testing commit 932630fa902878f4c8c50d0b1260eeb9de16b0a4 with gcc (GCC) 8.1.0 kernel signature: cd597c443e76341392e19a20e2cf374682c941da1b0eac2bed8a615df3f372a0 all runs: crashed: KASAN: use-after-free Read in sctp_auth_destroy_hmacs # git bisect bad 932630fa902878f4c8c50d0b1260eeb9de16b0a4 Bisecting: 65 revisions left to test after this (roughly 6 steps) [bb2ded26028be00204dbe2153f98fbd1902a2187] sctp: not set peer.asconf_capable in sctp_association_init testing commit bb2ded26028be00204dbe2153f98fbd1902a2187 with gcc (GCC) 8.1.0 kernel signature: 244959606dbece5e1de107ce4f160aa3ede9c744d8113728f89760e843b3a947 all runs: OK # git bisect good bb2ded26028be00204dbe2153f98fbd1902a2187 Bisecting: 32 revisions left to test after this (roughly 5 steps) [ffa4d78cbc2644b4867b8129b3fbb5ddcdfcdba2] mwifiex: pcie: Use dev_get_drvdata testing commit ffa4d78cbc2644b4867b8129b3fbb5ddcdfcdba2 with gcc (GCC) 8.1.0 kernel signature: 288933f67e295ff3a919366ee729089f8149ad596f0ba2d92d8d7d005c872b0b all runs: boot failed: general protection fault in dma_direct_max_mapping_size # git bisect skip ffa4d78cbc2644b4867b8129b3fbb5ddcdfcdba2 Bisecting: 32 revisions left to test after this (roughly 5 steps) [2ec4ad49b98e4a14147d04f914717135eca7c8b1] libertas_tf: Use correct channel range in lbtf_geo_init testing commit 2ec4ad49b98e4a14147d04f914717135eca7c8b1 with gcc (GCC) 8.1.0 kernel signature: 7b2087021976315f08c86feae8759ca7bc53ae84dcd833810e856ff085bf7d48 all runs: boot failed: general protection fault in dma_direct_max_mapping_size # git bisect skip 2ec4ad49b98e4a14147d04f914717135eca7c8b1 Bisecting: 32 revisions left to test after this (roughly 5 steps) [c032461936de82a3f4108cacc7c3d1b204c42eef] wl3501_cs: remove redundant variable rc testing commit c032461936de82a3f4108cacc7c3d1b204c42eef with gcc (GCC) 8.1.0 kernel signature: d7e75e40a3534478d931866899da15c07077b62016baaf59981288e3313c0ccd all runs: boot failed: general protection fault in dma_direct_max_mapping_size # git bisect skip c032461936de82a3f4108cacc7c3d1b204c42eef Bisecting: 32 revisions left to test after this (roughly 5 steps) [dfc7a8f7c857369c3cee4aa4c12d6c8da7aa1597] rsi: fix for sdio reset card issue testing commit dfc7a8f7c857369c3cee4aa4c12d6c8da7aa1597 with gcc (GCC) 8.1.0 kernel signature: 56c7637614c5cf07386699b4d41012a917df6675e8b7c89f0b8301a9b4ca08f1 all runs: boot failed: general protection fault in dma_direct_max_mapping_size # git bisect skip dfc7a8f7c857369c3cee4aa4c12d6c8da7aa1597 Bisecting: 32 revisions left to test after this (roughly 5 steps) [5483ecefe9602502441b0b76968f9c4f888ad242] Merge branch 'sctp-support-per-endpoint-auth-and-asconf-flags' testing commit 5483ecefe9602502441b0b76968f9c4f888ad242 with gcc (GCC) 8.1.0 kernel signature: 8112a17698b929a10cc65c9dc8afc64d239b17963b816aaf2f8c884f37e84eba all runs: crashed: KASAN: use-after-free Read in sctp_auth_destroy_hmacs # git bisect bad 5483ecefe9602502441b0b76968f9c4f888ad242 Bisecting: 2 revisions left to test after this (roughly 2 steps) [03f961270f4256fe9f47b94aea889bd26877216b] sctp: add sctp_auth_init and sctp_auth_free testing commit 03f961270f4256fe9f47b94aea889bd26877216b with gcc (GCC) 8.1.0 kernel signature: 31452108f18a10e0c7467ff67b21c7b29a7f9031a92b93c45ba35e0650a4565f all runs: OK # git bisect good 03f961270f4256fe9f47b94aea889bd26877216b Bisecting: 0 revisions left to test after this (roughly 1 step) [2f7576347cf3dd993f1ffe5e6018b4b764319c52] sctp: remove net sctp.x_enable working as a global switch testing commit 2f7576347cf3dd993f1ffe5e6018b4b764319c52 with gcc (GCC) 8.1.0 kernel signature: 205aed08dfac69f20530d8304e12f1aae5cb1df90a97c5041b4ddaac966ebe0b all runs: crashed: KASAN: use-after-free Read in sctp_auth_destroy_hmacs # git bisect bad 2f7576347cf3dd993f1ffe5e6018b4b764319c52 Bisecting: 0 revisions left to test after this (roughly 0 steps) [56dd525abd56f7acd7b44a52935726e3ada4916c] sctp: add SCTP_AUTH_SUPPORTED sockopt testing commit 56dd525abd56f7acd7b44a52935726e3ada4916c with gcc (GCC) 8.1.0 kernel signature: 1153005183318159ac182343b9ff0ff0a055ff943721d3839d14f5a690931c18 all runs: crashed: KASAN: use-after-free Read in sctp_auth_destroy_hmacs # git bisect bad 56dd525abd56f7acd7b44a52935726e3ada4916c 56dd525abd56f7acd7b44a52935726e3ada4916c is the first bad commit commit 56dd525abd56f7acd7b44a52935726e3ada4916c Author: Xin Long Date: Mon Aug 19 22:02:49 2019 +0800 sctp: add SCTP_AUTH_SUPPORTED sockopt SCTP_AUTH_SUPPORTED sockopt is used to set enpoint's auth flag. With this feature, each endpoint will have its own flag for its future asoc's auth_capable, instead of netns auth flag. Note that when both ep's auth_enable is enabled, endpoint auth related data should be initialized. If asconf_enable is also set, SCTP_CID_ASCONF/SCTP_CID_ASCONF_ACK should be added into auth_chunk_list. Signed-off-by: Xin Long Signed-off-by: David S. Miller include/uapi/linux/sctp.h | 1 + net/sctp/socket.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) culprit signature: 1153005183318159ac182343b9ff0ff0a055ff943721d3839d14f5a690931c18 parent signature: 31452108f18a10e0c7467ff67b21c7b29a7f9031a92b93c45ba35e0650a4565f revisions tested: 23, total time: 5h4m2.02100894s (build: 2h35m24.367458399s, test: 2h26m0.730948041s) first bad commit: 56dd525abd56f7acd7b44a52935726e3ada4916c sctp: add SCTP_AUTH_SUPPORTED sockopt recipients (to): ["davem@davemloft.net" "davem@davemloft.net" "linux-sctp@vger.kernel.org" "lucien.xin@gmail.com" "marcelo.leitner@gmail.com" "netdev@vger.kernel.org" "nhorman@tuxdriver.com" "vyasevich@gmail.com"] recipients (cc): ["linux-kernel@vger.kernel.org"] crash: KASAN: use-after-free Read in sctp_auth_destroy_hmacs ================================================================== BUG: KASAN: use-after-free in sctp_auth_destroy_hmacs.part.1+0x5b/0x60 net/sctp/auth.c:509 Read of size 8 at addr ffff8880998e89c0 by task syz-executor.5/8419 CPU: 0 PID: 8419 Comm: syz-executor.5 Not tainted 5.3.0-rc5-syzkaller #0 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+0x165/0x21a lib/dump_stack.c:113 print_address_description.cold.4+0x9/0x327 mm/kasan/report.c:351 __kasan_report.cold.5+0x1b/0x40 mm/kasan/report.c:482 kasan_report+0x12/0x17 mm/kasan/common.c:612 __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:132 sctp_auth_destroy_hmacs.part.1+0x5b/0x60 net/sctp/auth.c:509 sctp_auth_destroy_hmacs net/sctp/auth.c:505 [inline] sctp_auth_free+0xe3/0x160 net/sctp/auth.c:1076 sctp_endpoint_destroy net/sctp/endpointola.c:201 [inline] sctp_endpoint_put+0x92/0x1b0 net/sctp/endpointola.c:234 sctp_endpoint_free+0x6c/0x80 net/sctp/endpointola.c:181 sctp_destroy_sock+0x84/0x390 net/sctp/socket.c:5110 sctp_v6_destroy_sock+0xd/0x20 net/sctp/socket.c:9448 sk_common_release+0x5e/0x2d0 net/core/sock.c:3160 sctp_close+0x3e5/0x750 net/sctp/socket.c:1536 inet_release+0xc1/0x1c0 net/ipv4/af_inet.c:427 inet6_release+0x46/0x60 net/ipv6/af_inet6.c:470 __sock_release+0xc2/0x270 net/socket.c:590 sock_close+0x13/0x20 net/socket.c:1268 __fput+0x25a/0x780 fs/file_table.c:280 ____fput+0x9/0x10 fs/file_table.c:313 task_work_run+0x108/0x180 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_usermode_loop+0x1f2/0x2e0 arch/x86/entry/common.c:163 prepare_exit_to_usermode arch/x86/entry/common.c:194 [inline] syscall_return_slowpath arch/x86/entry/common.c:274 [inline] do_syscall_64+0x462/0x540 arch/x86/entry/common.c:299 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x417781 Code: 75 14 b8 03 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 a4 1a 00 00 c3 48 83 ec 08 e8 0a fc ff ff 48 89 04 24 b8 03 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 53 fc ff ff 48 89 d0 48 83 c4 08 48 3d 01 RSP: 002b:00007ffe1de152d0 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000000004 RCX: 0000000000417781 RDX: 0000001b2e020000 RSI: 0000000000000001 RDI: 0000000000000003 RBP: 0000000000000001 R08: 0000000000000000 R09: 0000000000000000 R10: 00007ffe1de153b0 R11: 0000000000000293 R12: 000000000118c9a0 R13: 000000000118c9a0 R14: 00000000000003e8 R15: 000000000118bf2c Allocated by task 8432: save_stack mm/kasan/common.c:69 [inline] set_track mm/kasan/common.c:77 [inline] __kasan_kmalloc.part.0+0x44/0xc0 mm/kasan/common.c:487 __kasan_kmalloc.constprop.1+0xb1/0xc0 mm/kasan/common.c:468 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:501 kmem_cache_alloc_trace+0x162/0x410 mm/slab.c:3550 kmalloc include/linux/slab.h:552 [inline] kmalloc_array include/linux/slab.h:675 [inline] kcalloc include/linux/slab.h:687 [inline] sctp_auth_init_hmacs+0xab/0x270 net/sctp/auth.c:464 sctp_auth_init+0x7e/0x470 net/sctp/auth.c:1055 sctp_setsockopt_auth_supported net/sctp/socket.c:4547 [inline] sctp_setsockopt+0x2843/0x5ee0 net/sctp/socket.c:4767 sock_common_setsockopt+0x73/0xf0 net/core/sock.c:3139 __sys_setsockopt+0x213/0x440 net/socket.c:2084 __do_sys_setsockopt net/socket.c:2100 [inline] __se_sys_setsockopt net/socket.c:2097 [inline] __x64_sys_setsockopt+0xb9/0x150 net/socket.c:2097 do_syscall_64+0xd0/0x540 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 8432: save_stack mm/kasan/common.c:69 [inline] set_track mm/kasan/common.c:77 [inline] __kasan_slab_free+0x11a/0x1e0 mm/kasan/common.c:449 kasan_slab_free+0xe/0x10 mm/kasan/common.c:457 __cache_free mm/slab.c:3425 [inline] kfree+0x104/0x2d0 mm/slab.c:3756 sctp_auth_destroy_hmacs.part.1+0x4a/0x60 net/sctp/auth.c:511 sctp_auth_destroy_hmacs net/sctp/auth.c:505 [inline] sctp_auth_init_hmacs+0x1c2/0x270 net/sctp/auth.c:496 sctp_auth_init+0x7e/0x470 net/sctp/auth.c:1055 sctp_setsockopt_auth_supported net/sctp/socket.c:4547 [inline] sctp_setsockopt+0x2843/0x5ee0 net/sctp/socket.c:4767 sock_common_setsockopt+0x73/0xf0 net/core/sock.c:3139 __sys_setsockopt+0x213/0x440 net/socket.c:2084 __do_sys_setsockopt net/socket.c:2100 [inline] __se_sys_setsockopt net/socket.c:2097 [inline] __x64_sys_setsockopt+0xb9/0x150 net/socket.c:2097 do_syscall_64+0xd0/0x540 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff8880998e89c0 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 0 bytes inside of 32-byte region [ffff8880998e89c0, ffff8880998e89e0) The buggy address belongs to the page: page:ffffea0002663a00 refcount:1 mapcount:0 mapping:ffff8880aa4001c0 index:0xffff8880998e8fc1 flags: 0xfffe0000000200(slab) raw: 00fffe0000000200 ffffea000287b408 ffffea00028abf88 ffff8880aa4001c0 raw: ffff8880998e8fc1 ffff8880998e8000 000000010000003b 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8880998e8880: 00 00 fc fc fc fc fc fc 05 fc fc fc fc fc fc fc ffff8880998e8900: 00 00 fc fc fc fc fc fc fb fb fb fb fc fc fc fc >ffff8880998e8980: 05 fc fc fc fc fc fc fc fb fb fb fb fc fc fc fc ^ ffff8880998e8a00: fb fb fb fb fc fc fc fc 05 fc fc fc fc fc fc fc ffff8880998e8a80: 05 fc fc fc fc fc fc fc 05 fc fc fc fc fc fc fc ==================================================================