KASAN: use-after-free Read in get_task_mm

5 views
Skip to first unread message

syzbot

unread,
Nov 4, 2019, 12:00:10 AM11/4/19
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 7fe05eed Merge 4.9.194 into android-4.9
git tree: android-4.9
console output: https://syzkaller.appspot.com/x/log.txt?x=1551f858e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=c6d462552c77f021
dashboard link: https://syzkaller.appspot.com/bug?extid=3721b4d0caaf34b4f8bf
compiler: gcc (GCC) 9.0.0 20181231 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+3721b4...@syzkaller.appspotmail.com

lowmemorykiller: Killing 'syz-executor.5' (4703) (tgid 4703), adj 1000,
to free 51396kB on behalf of 'kswapd0' (33) because
cache -4412140kB is below limit 6144kB for oom_score_adj 0
Free memory is -6664kB above reserved
==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x2f37/0x4390
kernel/locking/lockdep.c:3224
Read of size 8 at addr ffff8801a02b4f18 by task kswapd0/33

CPU: 1 PID: 33 Comm: kswapd0 Not tainted 4.9.194+ #0
ffff8801d84074a0 ffffffff81b67001 0000000000000000 ffffea000680ac00
ffff8801a02b4f18 0000000000000008 ffffffff81210037 ffff8801d84074d8
ffffffff8150c4f1 0000000000000000 ffff8801a02b4f18 ffff8801a02b4f18
Call Trace:
[<0000000051098d73>] __dump_stack lib/dump_stack.c:15 [inline]
[<0000000051098d73>] dump_stack+0xc1/0x120 lib/dump_stack.c:51
[<00000000ce7e987d>] print_address_description+0x6f/0x23a
mm/kasan/report.c:256
[<00000000ee05c854>] kasan_report_error mm/kasan/report.c:355 [inline]
[<00000000ee05c854>] kasan_report mm/kasan/report.c:413 [inline]
[<00000000ee05c854>] kasan_report.cold+0x8c/0x2ba mm/kasan/report.c:397
[<000000007ce1287c>] __asan_report_load8_noabort+0x14/0x20
mm/kasan/report.c:434
[<000000004df38d1f>] __lock_acquire+0x2f37/0x4390
kernel/locking/lockdep.c:3224
[<00000000c8699b81>] lock_acquire+0x133/0x3d0 kernel/locking/lockdep.c:3756
[<00000000202ebbe3>] __raw_spin_lock include/linux/spinlock_api_smp.h:144
[inline]
[<00000000202ebbe3>] _raw_spin_lock+0x38/0x50 kernel/locking/spinlock.c:151
[<0000000028485d99>] spin_lock include/linux/spinlock.h:302 [inline]
[<0000000028485d99>] task_lock include/linux/sched.h:3217 [inline]
[<0000000028485d99>] get_task_mm+0x20/0xc0 kernel/fork.c:1012
[<000000000fbfa4b8>] handle_lmk_event+0x84/0x920
drivers/staging/android/lowmemorykiller.c:109
[<00000000d2516692>] lowmem_scan+0x6f3/0xb70
drivers/staging/android/lowmemorykiller.c:354
[<000000006e79300c>] do_shrink_slab mm/vmscan.c:399 [inline]
[<000000006e79300c>] shrink_slab.part.0+0x3cf/0xa20 mm/vmscan.c:502
[<00000000ccc737f7>] shrink_slab mm/vmscan.c:466 [inline]
[<00000000ccc737f7>] shrink_node+0x1ed/0x750 mm/vmscan.c:2604
[<000000001caffda6>] kswapd_shrink_node mm/vmscan.c:3209 [inline]
[<000000001caffda6>] balance_pgdat mm/vmscan.c:3329 [inline]
[<000000001caffda6>] kswapd+0x7f8/0x13b0 mm/vmscan.c:3523
[<00000000c201c8b7>] kthread+0x278/0x310 kernel/kthread.c:211
[<00000000b8492ed8>] ret_from_fork+0x5c/0x70 arch/x86/entry/entry_64.S:375

Allocated by task 4680:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
save_stack mm/kasan/kasan.c:512 [inline]
set_track mm/kasan/kasan.c:524 [inline]
kasan_kmalloc.part.0+0x62/0xf0 mm/kasan/kasan.c:616
kasan_kmalloc+0xb7/0xd0 mm/kasan/kasan.c:601
kasan_slab_alloc+0xf/0x20 mm/kasan/kasan.c:554
slab_post_alloc_hook mm/slab.h:417 [inline]
slab_alloc_node mm/slub.c:2715 [inline]
slab_alloc mm/slub.c:2723 [inline]
kmem_cache_alloc+0xd5/0x2b0 mm/slub.c:2728
kmem_cache_alloc_node include/linux/slab.h:364 [inline]
alloc_task_struct_node kernel/fork.c:146 [inline]
dup_task_struct kernel/fork.c:490 [inline]
copy_process.part.0+0x1714/0x6690 kernel/fork.c:1640
copy_process kernel/fork.c:1586 [inline]
_do_fork+0x1c1/0xd50 kernel/fork.c:2111
SYSC_clone kernel/fork.c:2223 [inline]
SyS_clone+0x37/0x50 kernel/fork.c:2217
do_syscall_64+0x1ad/0x5c0 arch/x86/entry/common.c:288
entry_SYSCALL_64_after_swapgs+0x5d/0xdb

Freed by task 2110:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
save_stack mm/kasan/kasan.c:512 [inline]
set_track mm/kasan/kasan.c:524 [inline]
kasan_slab_free+0xb0/0x190 mm/kasan/kasan.c:589
slab_free_hook mm/slub.c:1355 [inline]
slab_free_freelist_hook mm/slub.c:1377 [inline]
slab_free mm/slub.c:2958 [inline]
kmem_cache_free+0xbe/0x310 mm/slub.c:2980
free_task_struct kernel/fork.c:151 [inline]
free_task+0x74/0xb0 kernel/fork.c:367
__put_task_struct+0x27c/0x4a0 kernel/fork.c:404
put_task_struct include/linux/sched.h:2337 [inline]
delayed_put_task_struct+0x9a/0x2f0 kernel/exit.c:166
__rcu_reclaim kernel/rcu/rcu.h:118 [inline]
rcu_do_batch kernel/rcu/tree.c:2797 [inline]
invoke_rcu_callbacks kernel/rcu/tree.c:3061 [inline]
__rcu_process_callbacks kernel/rcu/tree.c:3028 [inline]
rcu_process_callbacks+0x8c2/0x1300 kernel/rcu/tree.c:3045
__do_softirq+0x22d/0x964 kernel/softirq.c:288

The buggy address belongs to the object at ffff8801a02b4740
which belongs to the cache task_struct of size 5824
The buggy address is located 2008 bytes inside of
5824-byte region [ffff8801a02b4740, ffff8801a02b5e00)
The buggy address belongs to the page:
page:ffffea000680ac00 count:1 mapcount:0 mapping: (null) index:0x0
compound_mapcount: 0
flags: 0x4000000000010200(slab|head)
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8801a02b4e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8801a02b4e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ffff8801a02b4f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8801a02b4f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8801a02b5000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
This bug 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 bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Mar 7, 2020, 8:32:11 AM3/7/20
to syzkaller-a...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages