syzbot


KASAN: invalid-free in __put_task_struct

Status: closed as invalid on 2018/04/10 14:48
Subsystems: mm
[Documentation on labels]
Reported-by: syzbot+be7758b36ca6c15602af@syzkaller.appspotmail.com
First crash: 2697d, last: 2697d

Sample crash report:
netlink: 12 bytes leftover after parsing attributes in process `syz-executor5'.
==================================================================
BUG: KASAN: double-free or invalid-free in taskstats_tgid_free include/linux/taskstats_kern.h:22 [inline]
BUG: KASAN: double-free or invalid-free in free_signal_struct kernel/fork.c:626 [inline]
BUG: KASAN: double-free or invalid-free in put_signal_struct kernel/fork.c:640 [inline]
BUG: KASAN: double-free or invalid-free in __put_task_struct+0x2c9/0x3c0 kernel/fork.c:654

CPU: 1 PID: 14446 Comm: syz-executor4 Not tainted 4.16.0-rc6+ #285
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x194/0x24d lib/dump_stack.c:53
 print_address_description+0x73/0x250 mm/kasan/report.c:256
 kasan_report_invalid_free+0x55/0x80 mm/kasan/report.c:336
 __kasan_slab_free+0x145/0x170 mm/kasan/kasan.c:500
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:527
 __cache_free mm/slab.c:3485 [inline]
 kmem_cache_free+0x83/0x2a0 mm/slab.c:3743
 taskstats_tgid_free include/linux/taskstats_kern.h:22 [inline]
 free_signal_struct kernel/fork.c:626 [inline]
 put_signal_struct kernel/fork.c:640 [inline]
 __put_task_struct+0x2c9/0x3c0 kernel/fork.c:654
 put_task_struct include/linux/sched/task.h:96 [inline]
 delayed_put_task_struct+0xca/0x3d0 kernel/exit.c:180
 __rcu_reclaim kernel/rcu/rcu.h:172 [inline]
 rcu_do_batch kernel/rcu/tree.c:2674 [inline]
 invoke_rcu_callbacks kernel/rcu/tree.c:2933 [inline]
 __rcu_process_callbacks kernel/rcu/tree.c:2900 [inline]
 rcu_process_callbacks+0xd6c/0x17f0 kernel/rcu/tree.c:2917
 __do_softirq+0x2d7/0xb85 kernel/softirq.c:285
 invoke_softirq kernel/softirq.c:365 [inline]
 irq_exit+0x1cc/0x200 kernel/softirq.c:405
 exiting_irq arch/x86/include/asm/apic.h:541 [inline]
 smp_apic_timer_interrupt+0x16b/0x700 arch/x86/kernel/apic/apic.c:1052
 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:857
 </IRQ>
RIP: 0010:debug_lockdep_rcu_enabled.part.1+0x1f/0x60 kernel/rcu/update.c:301
RSP: 0018:ffff8801ac5aedc8 EFLAGS: 00000202 ORIG_RAX: ffffffffffffff12
RAX: dffffc0000000000 RBX: ffff8801cd6a05c0 RCX: ffffffff81aa8b13
RDX: 0000000000000004 RSI: 00000000ffffffff RDI: ffff8801cd6a0e34
RBP: ffff8801ac5aedd0 R08: 0000000000000000 R09: 1ffff100358b5db5
R10: ffff8801ac5aed70 R11: 0000000000000000 R12: 0000000000000000
R13: ffffffff87765efc R14: 0000000000000bee R15: 0000000000400000
 debug_lockdep_rcu_enabled+0x77/0x90 kernel/rcu/update.c:300
 ___might_sleep+0x8a/0x470 kernel/sched/core.c:6098
 __might_sleep+0x95/0x190 kernel/sched/core.c:6086
 cache_alloc_debugcheck_before mm/slab.c:3054 [inline]
 slab_alloc_node mm/slab.c:3290 [inline]
 kmem_cache_alloc_node+0x28a/0x760 mm/slab.c:3629
 __alloc_skb+0xf1/0x780 net/core/skbuff.c:193
 alloc_skb include/linux/skbuff.h:986 [inline]
 alloc_skb_with_frags+0x10d/0x750 net/core/skbuff.c:5246
 sock_alloc_send_pskb+0x787/0x9b0 net/core/sock.c:2088
 packet_alloc_skb net/packet/af_packet.c:2803 [inline]
 packet_snd net/packet/af_packet.c:2894 [inline]
 packet_sendmsg+0x1ece/0x60b0 net/packet/af_packet.c:2969
 sock_sendmsg_nosec net/socket.c:629 [inline]
 sock_sendmsg+0xca/0x110 net/socket.c:639
 ___sys_sendmsg+0x320/0x8b0 net/socket.c:2047
 __sys_sendmmsg+0x1ee/0x620 net/socket.c:2137
 SYSC_sendmmsg net/socket.c:2168 [inline]
 SyS_sendmmsg+0x35/0x60 net/socket.c:2163
 do_syscall_64+0x281/0x940 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x4548b9
RSP: 002b:00007f5a980fcc68 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 00007f5a980fd6d4 RCX: 00000000004548b9
RDX: 0492492492492510 RSI: 0000000020871fc8 RDI: 0000000000000017
RBP: 000000000072bea0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 00000000000004c8 R14: 00000000006f9360 R15: 0000000000000000

Allocated by task 14439:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:552
 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:489
 kmem_cache_alloc+0x12e/0x760 mm/slab.c:3541
 kmem_cache_zalloc include/linux/slab.h:691 [inline]
 taskstats_tgid_alloc kernel/taskstats.c:573 [inline]
 taskstats_exit+0x7b5/0xfc0 kernel/taskstats.c:606
 do_exit+0x44a/0x1ad0 kernel/exit.c:850
 do_group_exit+0x149/0x400 kernel/exit.c:968
 SYSC_exit_group kernel/exit.c:979 [inline]
 SyS_exit_group+0x1d/0x20 kernel/exit.c:977
 do_syscall_64+0x281/0x940 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 14469:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:520
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:527
 __cache_free mm/slab.c:3485 [inline]
 kmem_cache_free+0x83/0x2a0 mm/slab.c:3743
 taskstats_tgid_free include/linux/taskstats_kern.h:22 [inline]
 free_signal_struct kernel/fork.c:626 [inline]
 put_signal_struct kernel/fork.c:640 [inline]
 __put_task_struct+0x2c9/0x3c0 kernel/fork.c:654
 put_task_struct include/linux/sched/task.h:96 [inline]
 delayed_put_task_struct+0xca/0x3d0 kernel/exit.c:180
 __rcu_reclaim kernel/rcu/rcu.h:172 [inline]
 rcu_do_batch kernel/rcu/tree.c:2674 [inline]
 invoke_rcu_callbacks kernel/rcu/tree.c:2933 [inline]
 __rcu_process_callbacks kernel/rcu/tree.c:2900 [inline]
 rcu_process_callbacks+0xd6c/0x17f0 kernel/rcu/tree.c:2917
 __do_softirq+0x2d7/0xb85 kernel/softirq.c:285

The buggy address belongs to the object at ffff8801c2f18c40
 which belongs to the cache taskstats of size 328
The buggy address is located 0 bytes inside of
 328-byte region [ffff8801c2f18c40, ffff8801c2f18d88)
The buggy address belongs to the page:
page:ffffea00070bc600 count:1 mapcount:0 mapping:ffff8801c2f18000 index:0x0
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffff8801c2f18000 0000000000000000 000000010000000a
raw: ffffea00074d36a0 ffffea0006f69860 ffff8801d9a4c7c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801c2f18b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801c2f18b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8801c2f18c00: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
                                           ^
 ffff8801c2f18c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801c2f18d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/03/29 17:06 net-next-old 56455e0998dd d47f0ed6 .config console log report ci-upstream-net-kasan-gce
* Struck through repros no longer work on HEAD.