KASAN: use-after-free Read in has_ns_capability_noaudit

Status: auto-closed as invalid on 2020/02/21 22:32
First crash: 2000d, last: 1704d

Sample crash report:
BUG: KASAN: use-after-free in __read_once_size include/linux/compiler.h:183 [inline]
BUG: KASAN: use-after-free in has_ns_capability_noaudit+0x1b1/0x1c0 kernel/capability.c:343
Read of size 8 at addr ffff8881955ee468 by task syz-executor.5/27345

CPU: 1 PID: 27345 Comm: syz-executor.5 Not tainted 4.14.150+ #0
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0xca/0x134 lib/dump_stack.c:53
 print_address_description+0x60/0x226 mm/kasan/report.c:187
 __kasan_report.cold+0x1a/0x41 mm/kasan/report.c:316
 __read_once_size include/linux/compiler.h:183 [inline]
 has_ns_capability_noaudit+0x1b1/0x1c0 kernel/capability.c:343
 oom_badness.part.0+0x4ee/0x6b0 mm/oom_kill.c:211
 oom_badness+0x35/0x50 mm/oom_kill.c:179
 proc_oom_score+0x62/0xb0 fs/proc/base.c:559
 proc_single_show+0xf1/0x160 fs/proc/base.c:762
 seq_read+0x4f7/0x1180 fs/seq_file.c:237
ip6_tunnel:  xmit: Local address not yet configured!
 do_loop_readv_writev fs/read_write.c:699 [inline]
 do_loop_readv_writev fs/read_write.c:686 [inline]
 do_iter_read+0x3e8/0x5b0 fs/read_write.c:923
 vfs_readv+0xe6/0x150 fs/read_write.c:985
 do_preadv+0x189/0x230 fs/read_write.c:1069
 do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292
RIP: 0033:0x459ef9
RSP: 002b:00007f52683dac78 EFLAGS: 00000246 ORIG_RAX: 0000000000000127
RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 0000000000459ef9
RDX: 0000000000000199 RSI: 00000000200017c0 RDI: 0000000000000006
ip6_tunnel:  xmit: Local address not yet configured!
RBP: 000000000075bfc8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f52683db6d4
R13: 00000000004c75cc R14: 00000000004dcf78 R15: 00000000ffffffff

Allocated by task 27334:
 save_stack mm/kasan/common.c:76 [inline]
 set_track mm/kasan/common.c:85 [inline]
 __kasan_kmalloc.part.0+0x53/0xc0 mm/kasan/common.c:501
 slab_post_alloc_hook mm/slab.h:439 [inline]
 slab_alloc_node mm/slub.c:2792 [inline]
 slab_alloc mm/slub.c:2800 [inline]
 kmem_cache_alloc+0xee/0x360 mm/slub.c:2805
 kmem_cache_alloc_node include/linux/slab.h:361 [inline]
 alloc_task_struct_node kernel/fork.c:159 [inline]
 dup_task_struct kernel/fork.c:525 [inline]
 copy_process.part.0+0x14f4/0x66c0 kernel/fork.c:1729
 copy_process kernel/fork.c:1679 [inline]
 _do_fork+0x197/0xce0 kernel/fork.c:2220
 do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292

Freed by task 27358:
 save_stack mm/kasan/common.c:76 [inline]
 set_track mm/kasan/common.c:85 [inline]
 __kasan_slab_free+0x164/0x210 mm/kasan/common.c:463
 slab_free_hook mm/slub.c:1407 [inline]
 slab_free_freelist_hook mm/slub.c:1458 [inline]
 slab_free mm/slub.c:3039 [inline]
 kmem_cache_free+0xd7/0x3b0 mm/slub.c:3055
 __put_task_struct+0x295/0x490 kernel/fork.c:430
ip6_tunnel:  xmit: Local address not yet configured!
 put_task_struct include/linux/sched/task.h:96 [inline]
 delayed_put_task_struct+0xb4/0x310 kernel/exit.c:180
 __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+0x59f/0xf60 kernel/rcu/tree.c:2946
 __do_softirq+0x234/0x9ec kernel/softirq.c:288

The buggy address belongs to the object at ffff8881955ede00
 which belongs to the cache task_struct of size 5760
The buggy address is located 1640 bytes inside of
 5760-byte region [ffff8881955ede00, ffff8881955ef480)
The buggy address belongs to the page:
page:ffffea0006557a00 count:1 mapcount:0 mapping:          (null) index:0x0 compound_mapcount: 0
flags: 0x4000000000010200(slab|head)
raw: 4000000000010200 0000000000000000 0000000000000000 0000000100050005
raw: dead000000000100 dead000000000200 ffff8881da823e00 0000000000000000
ip6_tunnel:  xmit: Local address not yet configured!
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8881955ee300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881955ee380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8881955ee400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881955ee480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881955ee500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/10/24 22:32 android-4.14 fb1827d6f2b8 d01bb02a .config console log report ci-android-414-kasan-gce-root
2019/05/03 05:35 android-4.14 b5123fd47340 e9039493 .config console log report ci-android-414-kasan-gce-root
2019/01/02 14:28 android-4.14 7d2d5fc1acda f0491811 .config console log report ci-android-414-kasan-gce-root
* Struck through repros no longer work on HEAD.