bisecting cause commit starting from 7a7fd0de4a9804299793e564a555a49c1fc924cb building syzkaller on 92ead2966b78ac6b2d6a0a464cc15c6ee6f853c6 testing commit 7a7fd0de4a9804299793e564a555a49c1fc924cb with gcc (GCC) 10.2.1 20210217 kernel signature: 59d15557b17998ede33749c6a0b8e278d877eff7dfc7756ab2b8b6423d1a91a3 all runs: crashed: KASAN: use-after-free Read in cipso_v4_genopt testing release v5.11 testing commit f40ddce88593482919761f74910f42f4b84c004b with gcc (GCC) 10.2.1 20210217 kernel signature: 6bb4886383edb3f9345f9a02b5a357f3c504b1988bfcd4017431e212371aeba1 all runs: crashed: KASAN: use-after-free Read in cipso_v4_genopt testing release v5.10 testing commit 2c85ebc57b3e1817b6ce1a6b703928e113a90442 with gcc (GCC) 10.2.1 20210217 kernel signature: b0311d74ef0603a54551c70859c6b47eaa8bc3b8ded1e98429323ade3f4f6e14 all runs: crashed: KASAN: use-after-free Read in cipso_v4_genopt testing release v5.9 testing commit bbf5c979011a099af5dc76498918ed7df445635b with gcc (GCC) 10.2.1 20210217 kernel signature: 5558e7c65924d3b51abce56c4713c684a1b4717360adf7ce4f743998a58878d4 all runs: crashed: KASAN: use-after-free Read in cipso_v4_genopt testing release v5.8 testing commit bcf876870b95592b52519ed4aafcf9d95999bc9c with gcc (GCC) 8.4.1 20210217 kernel signature: 4d6afee619ccacfd6fc5f73f8cff2325f894a095e61ace9e1890d0f49a9972dd all runs: crashed: KASAN: use-after-free Read in cipso_v4_genopt testing release v5.7 testing commit 3d77e6a8804abcc0504c904bd6e5cdf3a5cf8162 with gcc (GCC) 8.4.1 20210217 kernel signature: 44f44410a0a91c2cf74e1c12b538a0f948a4445b00f77be2c95cec3106456f26 all runs: crashed: KASAN: use-after-free Read in cipso_v4_genopt testing release v5.6 testing commit 7111951b8d4973bda27ff663f2cf18b663d15b48 with gcc (GCC) 8.4.1 20210217 kernel signature: 22c97194a9fa9fe237865c0e01e52a1e2de0b96c5f321069aa8c136a6cd35f98 all runs: crashed: KASAN: use-after-free Read in cipso_v4_genopt testing release v5.5 testing commit d5226fa6dbae0569ee43ecfc08bdcd6770fc4755 with gcc (GCC) 8.4.1 20210217 kernel signature: 370029a54ec4c61655e364a651b3b4438467354aba19003097b88fcff295708f all runs: crashed: KASAN: use-after-free Read in cipso_v4_genopt testing release v5.4 testing commit 219d54332a09e8d8741c1e1982f5eae56099de85 with gcc (GCC) 8.4.1 20210217 kernel signature: 3b8d9f5e466472dffd2afd91732c2f10e2e3e20e7ce6a1b41fb44e356cea1125 all runs: crashed: KASAN: use-after-free Read in cipso_v4_genopt testing release v5.3 testing commit 4d856f72c10ecb060868ed10ff1b1453943fc6c8 with gcc (GCC) 8.4.1 20210217 kernel signature: 248c4f39b5a768fb94b1e9f7d13ad3fba9c19a5cd4a1bb5142dd11ac31cec2de all runs: boot failed: BUG: spinlock bad magic in nf_connlabels_get testing release v5.2 testing commit 0ecfebd2b52404ae0c54a878c872bb93363ada36 with gcc (GCC) 8.4.1 20210217 kernel signature: b15b1a9d8fb9420b0839168141f70d2607adf35a268a956b5217690d8b18b5a7 all runs: boot failed: can't ssh into the instance testing release v5.1 testing commit e93c9c99a629c61837d5a7fc2120cd2b6c70dbdd with gcc (GCC) 8.4.1 20210217 kernel signature: 27ec513561df7b6bb446a84e9558246d53e59eea91cbeb920eab4f951b659fd4 all runs: boot failed: can't ssh into the instance testing release v5.0 testing commit 1c163f4c7b3f621efff9b28a47abb36f7378d783 with gcc (GCC) 8.4.1 20210217 kernel signature: e84a4ce2b24a20da790b7ffd5b5c7df931b87a2a43f21ed841df8a4e468e49ae all runs: boot failed: can't ssh into the instance testing release v4.20 testing commit 8fe28cb58bcb235034b64cbbb7550a8a43fd88be with gcc (GCC) 8.4.1 20210217 kernel signature: e578ea63e69c18dc9700f8a84e33b2a79bd826b3b2d74f240c966178e35def45 all runs: boot failed: can't ssh into the instance testing release v4.19 testing commit 84df9525b0c27f3ebc2ebb1864fa62a97fdedb7d with gcc (GCC) 8.4.1 20210217 kernel signature: 8b227622bd1efed59f9a10c427a2e2dc60b70a498f9ee98d45c0bd1a6b44f926 all runs: boot failed: can't ssh into the instance testing release v4.18 testing commit 94710cac0ef4ee177a63b5227664b38c95bbf703 with gcc (GCC) 8.4.1 20210217 kernel signature: b860fe54f893c50dc4ccd1e1df8c920d11e8103dc663514f0f6aa0d17997d4b9 all runs: boot failed: can't ssh into the instance testing release v4.17 testing commit 29dcea88779c856c7dc92040a0c01233263101d4 with gcc (GCC) 8.4.1 20210217 failed to run ["make" "-j" "64" "ARCH=x86_64" "CC=/syzkaller/shared/bisect_bin/gcc-8.1.0/bin/gcc" "bzImage"]: exit status 2 testing release v4.16 testing commit 0adb32858b0bddf4ada5f364a84ed60b196dbcda with gcc (GCC) 8.4.1 20210217 orc_dump.c:106:2: error: 'elf_getshnum' is deprecated [-Werror=deprecated-declarations] orc_dump.c:111:2: error: 'elf_getshstrndx' is deprecated [-Werror=deprecated-declarations] elf.c:135:2: error: 'elf_getshnum' is deprecated [-Werror=deprecated-declarations] elf.c:140:2: error: 'elf_getshstrndx' is deprecated [-Werror=deprecated-declarations] testing release v4.15 testing commit d8a5b80568a9cb66810e75b182018e9edb68e8ff with gcc (GCC) 8.4.1 20210217 orc_dump.c:106:2: error: 'elf_getshnum' is deprecated [-Werror=deprecated-declarations] orc_dump.c:111:2: error: 'elf_getshstrndx' is deprecated [-Werror=deprecated-declarations] pager.c:36:12: error: passing argument 2 to 'restrict'-qualified parameter aliases with argument 4 [-Werror=restrict] elf.c:135:2: error: 'elf_getshnum' is deprecated [-Werror=deprecated-declarations] elf.c:140:2: error: 'elf_getshstrndx' is deprecated [-Werror=deprecated-declarations] testing release v4.14 testing commit bebc6082da0a9f5d47a1ea2edc099bf671058bd4 with gcc (GCC) 8.4.1 20210217 orc_dump.c:105:2: error: 'elf_getshnum' is deprecated [-Werror=deprecated-declarations] orc_dump.c:110:2: error: 'elf_getshstrndx' is deprecated [-Werror=deprecated-declarations] pager.c:36:12: error: passing argument 2 to 'restrict'-qualified parameter aliases with argument 4 [-Werror=restrict] elf.c:134:2: error: 'elf_getshnum' is deprecated [-Werror=deprecated-declarations] elf.c:139:2: error: 'elf_getshstrndx' is deprecated [-Werror=deprecated-declarations] testing release v4.13 testing commit 569dbb88e80deb68974ef6fdd6a13edb9d686261 with gcc (GCC) 8.4.1 20210217 pager.c:35:12: error: passing argument 2 to 'restrict'-qualified parameter aliases with argument 4 [-Werror=restrict] elf.c:144:2: error: 'elf_getshnum' is deprecated [-Werror=deprecated-declarations] elf.c:149:2: error: 'elf_getshstrndx' is deprecated [-Werror=deprecated-declarations] testing release v4.12 testing commit 6f7da290413ba713f0cdd9ff1a2a9bb129ef4f6c with gcc (GCC) 8.4.1 20210217 pager.c:35:12: error: passing argument 2 to 'restrict'-qualified parameter aliases with argument 4 [-Werror=restrict] elf.c:141:2: error: 'elf_getshnum' is deprecated [-Werror=deprecated-declarations] elf.c:146:2: error: 'elf_getshstrndx' is deprecated [-Werror=deprecated-declarations] testing release v4.11 testing commit a351e9b9fc24e982ec2f0e76379a49826036da12 with gcc (GCC) 7.5.0 elf.c:141:2: error: 'elf_getshnum' is deprecated [-Werror=deprecated-declarations] elf.c:146:2: error: 'elf_getshstrndx' is deprecated [-Werror=deprecated-declarations] pager.c:35:12: error: passing argument 2 to 'restrict'-qualified parameter aliases with argument 4 [-Werror=restrict] testing release v4.10 testing commit c470abd4fde40ea6a0846a2beab642a578c0b8cd with gcc (GCC) 5.5.0 tools/include/linux/log2.h:19:1: error: ignoring attribute 'noreturn' because it conflicts with attribute 'const' [-Werror=attributes] elf.c:129:2: error: 'elf_getshnum' is deprecated [-Werror=deprecated-declarations] elf.c:134:2: error: 'elf_getshstrndx' is deprecated [-Werror=deprecated-declarations] pager.c:35:12: error: passing argument 2 to 'restrict'-qualified parameter aliases with argument 4 [-Werror=restrict] testing release v4.9 testing commit 69973b830859bc6529a7a0468ba0d80ee5117826 with gcc (GCC) 5.5.0 tools/include/linux/log2.h:19:1: error: ignoring attribute 'noreturn' because it conflicts with attribute 'const' [-Werror=attributes] elf.c:129:2: error: 'elf_getshnum' is deprecated [-Werror=deprecated-declarations] elf.c:134:2: error: 'elf_getshstrndx' is deprecated [-Werror=deprecated-declarations] pager.c:35:12: error: passing argument 2 to 'restrict'-qualified parameter aliases with argument 4 [-Werror=restrict] testing release v4.8 testing commit c8d2bc9bc39ebea8437fd974fdbc21847bb897a3 with gcc (GCC) 5.5.0 tools/include/linux/log2.h:19:1: error: ignoring attribute 'noreturn' because it conflicts with attribute 'const' [-Werror=attributes] elf.c:129:2: error: 'elf_getshnum' is deprecated [-Werror=deprecated-declarations] elf.c:134:2: error: 'elf_getshstrndx' is deprecated [-Werror=deprecated-declarations] pager.c:33:12: error: passing argument 2 to 'restrict'-qualified parameter aliases with argument 4 [-Werror=restrict] testing release v4.7 testing commit 523d939ef98fd712632d93a5a2b588e477a7565e with gcc (GCC) 5.5.0 tools/include/linux/log2.h:19:1: error: ignoring attribute 'noreturn' because it conflicts with attribute 'const' [-Werror=attributes] pager.c:33:12: error: passing argument 2 to 'restrict'-qualified parameter aliases with argument 4 [-Werror=restrict] elf.c:122:2: error: 'elf_getshnum' is deprecated [-Werror=deprecated-declarations] elf.c:127:2: error: 'elf_getshstrndx' is deprecated [-Werror=deprecated-declarations] testing release v4.6 testing commit 2dcd0af568b0cf583645c8a317dd12e344b1c72a with gcc (GCC) 5.5.0 tools/include/linux/log2.h:19:1: error: ignoring attribute 'noreturn' because it conflicts with attribute 'const' [-Werror=attributes] pager.c:33:12: error: passing argument 2 to 'restrict'-qualified parameter aliases with argument 4 [-Werror=restrict] revisions tested: 16, total time: 3h35m15.488007827s (build: 1h48m31.986424474s, test: 1h42m25.376534158s) the crash already happened on the oldest tested release commit msg: Linux 5.4 crash: KASAN: use-after-free Read in cipso_v4_genopt ================================================================== BUG: KASAN: use-after-free in cipso_v4_genopt.part.9.constprop.13+0x124f/0x17a0 net/ipv4/cipso_ipv4.c:1776 Read of size 1 at addr ffff888238fdf610 by task syz-executor.0/10694 CPU: 0 PID: 10694 Comm: syz-executor.0 Not tainted 5.4.0-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+0x96/0xe0 lib/dump_stack.c:118 print_address_description.constprop.4.cold.6+0x9/0x373 mm/kasan/report.c:374 __kasan_report.cold.7+0x7a/0x95 mm/kasan/report.c:506 kasan_report+0xe/0x20 mm/kasan/common.c:634 cipso_v4_genopt.part.9.constprop.13+0x124f/0x17a0 net/ipv4/cipso_ipv4.c:1776 cipso_v4_genopt net/ipv4/cipso_ipv4.c:1767 [inline] cipso_v4_sock_setattr+0x6e/0x3c0 net/ipv4/cipso_ipv4.c:1858 netlbl_sock_setattr+0x1b1/0x2c0 net/netlabel/netlabel_kapi.c:989 smack_netlabel+0x10f/0x150 security/smack/smack_lsm.c:2431 security_socket_post_create+0x58/0xa0 security/security.c:1981 __sock_create+0x41f/0x5b0 net/socket.c:1434 sock_create net/socket.c:1469 [inline] __sys_socket+0xd1/0x1a0 net/socket.c:1511 __do_sys_socket net/socket.c:1520 [inline] __se_sys_socket net/socket.c:1518 [inline] __x64_sys_socket+0x6a/0xb0 net/socket.c:1518 do_syscall_64+0x8e/0x4e0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x465ef9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f827f94f188 EFLAGS: 00000246 ORIG_RAX: 0000000000000029 RAX: ffffffffffffffda RBX: 000000000056bf60 RCX: 0000000000465ef9 RDX: 0000000000000002 RSI: 0000000000000003 RDI: 0000040000000002 RBP: 00000000004bcd1c R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf60 R13: 00007ffd58d8e3cf R14: 00007f827f94f300 R15: 0000000000022000 Allocated by task 1: save_stack+0x19/0x80 mm/kasan/common.c:69 set_track mm/kasan/common.c:77 [inline] __kasan_kmalloc mm/kasan/common.c:510 [inline] __kasan_kmalloc.constprop.11+0xc1/0xd0 mm/kasan/common.c:483 kmalloc include/linux/slab.h:556 [inline] smk_cipso_doi+0x224/0x4d0 security/smack/smackfs.c:696 init_smk_fs+0xd4/0x154 security/smack/smackfs.c:2974 do_one_initcall+0xc3/0x51f init/main.c:938 do_initcall_level init/main.c:1006 [inline] do_initcalls init/main.c:1014 [inline] do_basic_setup init/main.c:1031 [inline] kernel_init_freeable+0x51f/0x5b9 init/main.c:1191 kernel_init+0x7/0x123 init/main.c:1109 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352 Freed by task 5340: save_stack+0x19/0x80 mm/kasan/common.c:69 set_track mm/kasan/common.c:77 [inline] kasan_set_free_info mm/kasan/common.c:332 [inline] __kasan_slab_free+0x124/0x170 mm/kasan/common.c:471 slab_free_hook mm/slub.c:1424 [inline] slab_free_freelist_hook+0x53/0x140 mm/slub.c:1457 slab_free mm/slub.c:3004 [inline] kfree+0xd6/0x3b0 mm/slub.c:3956 __rcu_reclaim kernel/rcu/rcu.h:222 [inline] rcu_do_batch kernel/rcu/tree.c:2157 [inline] rcu_core+0x9bf/0x1240 kernel/rcu/tree.c:2377 __do_softirq+0x24a/0xa97 kernel/softirq.c:292 The buggy address belongs to the object at ffff888238fdf600 which belongs to the cache kmalloc-64 of size 64 The buggy address is located 16 bytes inside of 64-byte region [ffff888238fdf600, ffff888238fdf640) The buggy address belongs to the page: page:ffffea0008e3f7c0 refcount:1 mapcount:0 mapping:ffff8880b5803180 index:0x0 raw: 057ff00000000200 ffffea0008ead980 0000000e00000002 ffff8880b5803180 raw: 0000000000000000 0000000000200020 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888238fdf500: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc ffff888238fdf580: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc >ffff888238fdf600: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ^ ffff888238fdf680: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc ffff888238fdf700: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc ==================================================================