Hello,
syzbot found the following issue on:
HEAD commit: 9d49fb30 ANDROID: GKI: Add support for a GKI_DEFCONFIG_FRA..
git tree: android12-5.4
console output:
https://syzkaller.appspot.com/x/log.txt?x=17bee461d00000
kernel config:
https://syzkaller.appspot.com/x/.config?x=bf50317962957906
dashboard link:
https://syzkaller.appspot.com/bug?extid=abda2ab2731cf1c8e9fa
compiler: Debian clang version 11.0.1-2
syz repro:
https://syzkaller.appspot.com/x/repro.syz?x=152c7919d00000
C reproducer:
https://syzkaller.appspot.com/x/repro.c?x=10dbf4ded00000
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by:
syzbot+abda2a...@syzkaller.appspotmail.com
==================================================================
BUG: KASAN: use-after-free in atomic_read include/asm-generic/atomic-instrumented.h:26 [inline]
BUG: KASAN: use-after-free in refcount_inc_not_zero_checked+0x7c/0x280 lib/refcount.c:123
Read of size 4 at addr ffff8881e9693f20 by task syz-executor738/415
CPU: 1 PID: 415 Comm: syz-executor738 Not tainted 5.4.113-syzkaller-00286-g9d49fb308497 #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+0x1d8/0x24e lib/dump_stack.c:118
print_address_description+0x9b/0x650 mm/kasan/report.c:384
__kasan_report+0x182/0x260 mm/kasan/report.c:516
kasan_report+0x30/0x60 mm/kasan/common.c:641
check_memory_region_inline mm/kasan/generic.c:141 [inline]
check_memory_region+0x2a5/0x2e0 mm/kasan/generic.c:191
atomic_read include/asm-generic/atomic-instrumented.h:26 [inline]
refcount_inc_not_zero_checked+0x7c/0x280 lib/refcount.c:123
refcount_inc_checked+0x11/0x50 lib/refcount.c:156
get_task_struct include/linux/sched/task.h:111 [inline]
kthread_stop+0x2d/0x3b0 kernel/kthread.c:592
ext4_put_super+0x7c5/0xc00 fs/ext4/super.c:1055
generic_shutdown_super+0x11b/0x2a0 fs/super.c:464
kill_block_super+0x79/0xd0 fs/super.c:1444
deactivate_locked_super+0xaf/0x100 fs/super.c:335
deactivate_super+0x1b3/0x270 fs/super.c:366
cleanup_mnt+0x432/0x4e0 fs/namespace.c:1102
task_work_run+0x186/0x1b0 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:188 [inline]
exit_to_usermode_loop arch/x86/entry/common.c:163 [inline]
prepare_exit_to_usermode+0x2b0/0x310 arch/x86/entry/common.c:194
entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x446aa7
Code: 06 00 48 83 c4 08 5b 5d c3 66 2e 0f 1f 84 00 00 00 00 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 a6 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c4 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffea36a7808 EFLAGS: 00000202 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 00000000001c33fd RCX: 0000000000446aa7
RDX: 00007ffea36a78cc RSI: 0000000000000002 RDI: 00007ffea36a78c0
RBP: 00007ffea36a78c0 R08: 00000000ffffffff R09: 00007ffea36a76a0
R10: 00000000022e0723 R11: 0000000000000202 R12: 00007ffea36a8930
R13: 00000000022e06b0 R14: 00007ffea36a7830 R15: 000000000000047c
Allocated by task 2:
save_stack mm/kasan/common.c:70 [inline]
set_track mm/kasan/common.c:78 [inline]
__kasan_kmalloc+0x137/0x1e0 mm/kasan/common.c:517
slab_post_alloc_hook mm/slab.h:584 [inline]
slab_alloc_node mm/slub.c:2821 [inline]
slab_alloc mm/slub.c:2829 [inline]
kmem_cache_alloc+0x115/0x290 mm/slub.c:2834
kmem_cache_alloc_node include/linux/slab.h:427 [inline]
alloc_task_struct_node kernel/fork.c:171 [inline]
dup_task_struct kernel/fork.c:871 [inline]
copy_process+0x5cd/0x5630 kernel/fork.c:1877
_do_fork+0x18f/0x900 kernel/fork.c:2391
kernel_thread+0x15e/0x1c0 kernel/fork.c:2481
create_kthread kernel/kthread.c:291 [inline]
kthreadd+0x3dd/0x520 kernel/kthread.c:634
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:352
Freed by task 16:
save_stack mm/kasan/common.c:70 [inline]
set_track mm/kasan/common.c:78 [inline]
kasan_set_free_info mm/kasan/common.c:333 [inline]
__kasan_slab_free+0x18a/0x240 mm/kasan/common.c:475
slab_free_hook mm/slub.c:1454 [inline]
slab_free_freelist_hook+0x7b/0x150 mm/slub.c:1492
slab_free mm/slub.c:3072 [inline]
kmem_cache_free+0xb8/0x5f0 mm/slub.c:3088
__rcu_reclaim kernel/rcu/rcu.h:222 [inline]
rcu_do_batch+0x4c0/0xa10 kernel/rcu/tree.c:2166
rcu_core+0x697/0xf40 kernel/rcu/tree.c:2386
__do_softirq+0x23e/0x615 kernel/softirq.c:292
The buggy address belongs to the object at ffff8881e9693f00
which belongs to the cache task_struct of size 3904
The buggy address is located 32 bytes inside of
3904-byte region [ffff8881e9693f00, ffff8881e9694e40)
The buggy address belongs to the page:
page:ffffea0007a5a400 refcount:1 mapcount:0 mapping:ffff8881f5cef400 index:0xffff8881e9690fc0 compound_mapcount: 0
flags: 0x8000000000010200(slab|head)
raw: 8000000000010200 ffffea0007966600 0000000600000006 ffff8881f5cef400
raw: ffff8881e9690fc0 0000000080080006 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff8881e9693e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8881e9693e80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8881e9693f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8881e9693f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8881e9694000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
------------[ cut here ]------------
refcount_t: increment on 0; use-after-free.
WARNING: CPU: 1 PID: 415 at lib/refcount.c:156 refcount_inc_checked+0x46/0x50 lib/refcount.c:156
Modules linked in:
CPU: 1 PID: 415 Comm: syz-executor738 Tainted: G B 5.4.113-syzkaller-00286-g9d49fb308497 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:refcount_inc_checked+0x46/0x50 lib/refcount.c:156
Code: 80 3d 80 2a 1e 04 01 75 07 e8 f6 29 3e ff 5b c3 e8 ef 29 3e ff c6 05 6b 2a 1e 04 01 48 c7 c7 20 1d 03 85 31 c0 e8 4a a8 15 ff <0f> 0b 5b c3 66 0f 1f 44 00 00 55 48 89 e5 41 57 41 56 41 55 41 54
RSP: 0018:ffff8881e7bafc78 EFLAGS: 00010246
RAX: e88212b577a70800 RBX: ffff8881e9693f20 RCX: ffff8881e78c6e40
RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000
RBP: ffff8881e9231520 R08: ffffffff814e8767 R09: ffffed103ede5e08
R10: ffffed103ede5e08 R11: 0000000000000000 R12: dffffc0000000000
R13: ffff8881e9693f00 R14: dffffc0000000000 R15: ffff8881e9693f20
FS: 00000000022df3c0(0000) GS:ffff8881f6f00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffea36a88d8 CR3: 00000001e8275000 CR4: 00000000001406e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
get_task_struct include/linux/sched/task.h:111 [inline]
kthread_stop+0x2d/0x3b0 kernel/kthread.c:592
ext4_put_super+0x7c5/0xc00 fs/ext4/super.c:1055
generic_shutdown_super+0x11b/0x2a0 fs/super.c:464
kill_block_super+0x79/0xd0 fs/super.c:1444
deactivate_locked_super+0xaf/0x100 fs/super.c:335
deactivate_super+0x1b3/0x270 fs/super.c:366
cleanup_mnt+0x432/0x4e0 fs/namespace.c:1102
task_work_run+0x186/0x1b0 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:188 [inline]
exit_to_usermode_loop arch/x86/entry/common.c:163 [inline]
prepare_exit_to_usermode+0x2b0/0x310 arch/x86/entry/common.c:194
entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x446aa7
Code: 06 00 48 83 c4 08 5b 5d c3 66 2e 0f 1f 84 00 00 00 00 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 a6 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c4 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffea36a7808 EFLAGS: 00000202 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 00000000001c33fd RCX: 0000000000446aa7
RDX: 00007ffea36a78cc RSI: 0000000000000002 RDI: 00007ffea36a78c0
RBP: 00007ffea36a78c0 R08: 00000000ffffffff R09: 00007ffea36a76a0
R10: 00000000022e0723 R11: 0000000000000202 R12: 00007ffea36a8930
R13: 00000000022e06b0 R14: 00007ffea36a7830 R15: 000000000000047c
---[ end trace 5e6edafcf8cda5ba ]---
---
This report is generated by a bot. It may contain errors.
See
https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at
syzk...@googlegroups.com.
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches