bisecting fixing commit since 3ffe1e79c174b2093f7ee3df589a7705572c9620 building syzkaller on 0d298d6b2e4a48a2b4d3413cabc199e5f61c1dd4 testing commit 3ffe1e79c174b2093f7ee3df589a7705572c9620 with gcc (GCC) 8.1.0 kernel signature: ab7bf8199489471065cbb1b1ca9ad415e89eb8fb all runs: crashed: KASAN: use-after-free Read in put_pid_ns testing current HEAD c1141b3aab36eb0d9b2bcae4aff69e77d0554386 testing commit c1141b3aab36eb0d9b2bcae4aff69e77d0554386 with gcc (GCC) 8.1.0 kernel signature: 18aaed04449051c118e8c1d59295bd234afbda4e all runs: crashed: KASAN: use-after-free Read in put_pid_ns revisions tested: 2, total time: 24m10.394420325s (build: 16m40.087306912s, test: 6m55.673475823s) the crash still happens on HEAD commit msg: Linux 4.14.166 crash: KASAN: use-after-free Read in put_pid_ns RDX: 9999999999999999 RSI: 0000000000000000 RDI: 88bd14a7b286b957 RBP: 000000000075bf20 R08: ffffffffffffffff R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f53570546d4 R13: 00000000004bfce6 R14: 00000000004d1a58 R15: 0000000000000003 ================================================================== BUG: KASAN: use-after-free in put_pid_ns.part.2+0xe7/0x100 kernel/pid_namespace.c:202 Read of size 8 at addr ffff88806f71a8b8 by task syz-executor.0/7240 CPU: 0 PID: 7240 Comm: syz-executor.0 Not tainted 4.14.166-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0xf7/0x13b lib/dump_stack.c:58 print_address_description.cold.7+0x9/0x1c9 mm/kasan/report.c:252 kasan_report_error mm/kasan/report.c:351 [inline] kasan_report.cold.8+0x11a/0x2d3 mm/kasan/report.c:409 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430 put_pid_ns.part.2+0xe7/0x100 kernel/pid_namespace.c:202 put_pid_ns+0x9/0x10 kernel/pid_namespace.c:198 free_nsproxy+0xc9/0x190 kernel/nsproxy.c:182 switch_task_namespaces+0x84/0xa0 kernel/nsproxy.c:229 exit_task_namespaces+0xb/0x10 kernel/nsproxy.c:234 copy_process.part.37+0x38de/0x66e0 kernel/fork.c:1971 copy_process kernel/fork.c:1586 [inline] _do_fork+0x155/0xbb0 kernel/fork.c:2070 SYSC_clone kernel/fork.c:2180 [inline] SyS_clone+0x14/0x20 kernel/fork.c:2174 do_syscall_64+0x1c7/0x5b0 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 RIP: 0033:0x459829 RSP: 002b:00007f2967e19c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000038 RAX: ffffffffffffffda RBX: 00007f2967e19c90 RCX: 0000000000459829 RDX: 9999999999999999 RSI: 0000000000000000 RDI: 88bd14a7b286b957 RBP: 000000000075bf20 R08: ffffffffffffffff R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f2967e1a6d4 R13: 00000000004bfce6 R14: 00000000004d1a58 R15: 0000000000000003 Allocated by task 7240: save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59 save_stack+0x43/0xd0 mm/kasan/kasan.c:447 set_track mm/kasan/kasan.c:459 [inline] kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:551 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:489 kmem_cache_alloc+0x12e/0x790 mm/slab.c:3552 kmem_cache_zalloc include/linux/slab.h:651 [inline] create_pid_namespace kernel/pid_namespace.c:116 [inline] copy_pid_ns+0x17b/0xba0 kernel/pid_namespace.c:186 create_new_namespaces+0x2e5/0x750 kernel/nsproxy.c:94 copy_namespaces+0x220/0x2b0 kernel/nsproxy.c:165 copy_process.part.37+0x2420/0x66e0 kernel/fork.c:1774 copy_process kernel/fork.c:1586 [inline] _do_fork+0x155/0xbb0 kernel/fork.c:2070 SYSC_clone kernel/fork.c:2180 [inline] SyS_clone+0x14/0x20 kernel/fork.c:2174 do_syscall_64+0x1c7/0x5b0 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 Freed by task 17: save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59 save_stack+0x43/0xd0 mm/kasan/kasan.c:447 set_track mm/kasan/kasan.c:459 [inline] kasan_slab_free+0x71/0xc0 mm/kasan/kasan.c:524 __cache_free mm/slab.c:3496 [inline] kmem_cache_free+0x80/0x2d0 mm/slab.c:3758 delayed_free_pidns+0x76/0x90 kernel/pid_namespace.c:166 __rcu_reclaim kernel/rcu/rcu.h:195 [inline] rcu_do_batch kernel/rcu/tree.c:2699 [inline] invoke_rcu_callbacks kernel/rcu/tree.c:2962 [inline] __rcu_process_callbacks kernel/rcu/tree.c:2929 [inline] rcu_process_callbacks+0x7e0/0x11e0 kernel/rcu/tree.c:2946 __do_softirq+0x246/0x9b0 kernel/softirq.c:288 The buggy address belongs to the object at ffff88806f71a080 which belongs to the cache pid_namespace of size 2264 The buggy address is located 2104 bytes inside of 2264-byte region [ffff88806f71a080, ffff88806f71a958) The buggy address belongs to the page: page:ffffea0001bdc680 count:1 mapcount:0 mapping:ffff88806f71a080 index:0x0 compound_mapcount: 0 flags: 0x1fffc0000008100(slab|head) raw: 01fffc0000008100 ffff88806f71a080 0000000000000000 0000000100000003 raw: ffffea0002562920 ffffea0001d266a0 ffff8880a6f98e40 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88806f71a780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88806f71a800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88806f71a880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88806f71a900: fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc ffff88806f71a980: fc fc fc fc fc fc fc fc fc fc fc fb fb fb fb fb ==================================================================