KASAN: use-after-free Read in try_to_wake_up

5 views
Skip to first unread message

syzbot

unread,
Oct 30, 2022, 5:08:38 AM10/30/22
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 41f36d7859a7 Linux 4.14.296
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=13b5c4ca880000
kernel config: https://syzkaller.appspot.com/x/.config?x=20cc5ea0fe276fa6
dashboard link: https://syzkaller.appspot.com/bug?extid=badca4803d13fbbed2bd
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1791ab22880000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=156a96a6880000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/941b591cedec/disk-41f36d78.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/2eea2720f8fc/vmlinux-41f36d78.xz
kernel image: https://storage.googleapis.com/syzbot-assets/7c3ce0be6b9a/bzImage-41f36d78.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/9f02921469b7/mount_0.gz

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

loop0: rw=0, want=576460752303423532, limit=2048
loop2: rw=0, want=576460752303423532, limit=2048
attempt to access beyond end of device
loop0: rw=0, want=576460752303423532, limit=2048
==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x2c57/0x3f20 kernel/locking/lockdep.c:3369
Read of size 8 at addr ffff888093d9cd60 by task syz-executor352/8495

CPU: 1 PID: 8495 Comm: syz-executor352 Not tainted 4.14.296-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/11/2022
Call Trace:
<IRQ>
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x1b2/0x281 lib/dump_stack.c:58
print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351
kasan_report mm/kasan/report.c:409 [inline]
__asan_report_load8_noabort+0x68/0x70 mm/kasan/report.c:430
__lock_acquire+0x2c57/0x3f20 kernel/locking/lockdep.c:3369
lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
_raw_spin_lock_irqsave+0x8c/0xc0 kernel/locking/spinlock.c:160
try_to_wake_up+0x6a/0x1100 kernel/sched/core.c:2000
call_timer_fn+0x14a/0x650 kernel/time/timer.c:1280
expire_timers+0x232/0x4d0 kernel/time/timer.c:1319
__run_timers kernel/time/timer.c:1637 [inline]
run_timer_softirq+0x1d5/0x5a0 kernel/time/timer.c:1650
__do_softirq+0x24d/0x9ff kernel/softirq.c:288
invoke_softirq kernel/softirq.c:368 [inline]
irq_exit+0x193/0x240 kernel/softirq.c:409
exiting_irq arch/x86/include/asm/apic.h:638 [inline]
smp_apic_timer_interrupt+0x141/0x5e0 arch/x86/kernel/apic/apic.c:1106
apic_timer_interrupt+0x93/0xa0 arch/x86/entry/entry_64.S:793
</IRQ>
RIP: 0010:arch_local_irq_restore arch/x86/include/asm/paravirt.h:779 [inline]
RIP: 0010:console_unlock+0xbeb/0xf20 kernel/printk/printk.c:2417
RSP: 0018:ffff8880aaff74b8 EFLAGS: 00000297 ORIG_RAX: ffffffffffffff10
RAX: ffff88809ca66440 RBX: 0000000000000200 RCX: 1ffff1101394cdb1
RDX: 0000000000000000 RSI: ffff88809ca66d68 RDI: 0000000000000297
RBP: 0000000000000000 R08: ffffffff8b9c84a8 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffffffff83d25990
R13: ffffffff8961e210 R14: dffffc0000000000 R15: 0000000000000040
vprintk_emit+0x224/0x620 kernel/printk/printk.c:1925
vprintk_func+0x58/0x160 kernel/printk/printk_safe.c:409
printk+0x9e/0xbc kernel/printk/printk.c:1998
handle_bad_sector+0x13b/0x161 block/blk-core.c:1940
bio_check_eod block/blk-core.c:2034 [inline]
generic_make_request_checks.cold+0x12/0x6a block/blk-core.c:2052
generic_make_request+0x67/0x850 block/blk-core.c:2185
submit_bio+0x234/0x390 block/blk-core.c:2303
mpage_bio_submit fs/mpage.c:66 [inline]
do_mpage_readpage+0xeb0/0x1470 fs/mpage.c:302
mpage_readpage+0x10b/0x1e0 fs/mpage.c:411
do_read_cache_page+0x38e/0xc10 mm/filemap.c:2713
read_mapping_page include/linux/pagemap.h:398 [inline]
nilfs_get_page.isra.0+0x72/0x8c0 fs/nilfs2/dir.c:201
nilfs_add_link+0x1e3/0xea0 fs/nilfs2/dir.c:471
nilfs_add_nondir fs/nilfs2/namei.c:46 [inline]
nilfs_symlink+0x1fb/0x350 fs/nilfs2/namei.c:168
vfs_symlink+0x3ce/0x620 fs/namei.c:4158
SYSC_symlinkat fs/namei.c:4185 [inline]
SyS_symlinkat+0x1dc/0x240 fs/namei.c:4165
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x7ff8b54ebc79
RSP: 002b:00007fffda94bea8 EFLAGS: 00000246 ORIG_RAX: 000000000000010a
RAX: ffffffffffffffda RBX: 0030656c69662f2e RCX: 00007ff8b54ebc79
RDX: 0000000020000780 RSI: 0000000000000003 RDI: 00000000200001c0
RBP: 0000000000000000 R08: 00007fffda94bed0 R09: 00007fffda94bed0
R10: 000055555719c2c0 R11: 0000000000000246 R12: 00007fffda94becc
R13: 00007fffda94bf00 R14: 00007fffda94bee0 R15: 0000000000000012

Allocated by task 2:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
kmem_cache_alloc_node+0x146/0x410 mm/slab.c:3642
alloc_task_struct_node kernel/fork.c:156 [inline]
dup_task_struct kernel/fork.c:515 [inline]
copy_process.part.0+0x17d3/0x71c0 kernel/fork.c:1631
copy_process kernel/fork.c:1606 [inline]
_do_fork+0x184/0xc80 kernel/fork.c:2092
kernel_thread+0x2f/0x40 kernel/fork.c:2154
create_kthread kernel/kthread.c:255 [inline]
kthreadd+0x51a/0x770 kernel/kthread.c:592
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

Freed by task 1:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kmem_cache_free+0x7c/0x2b0 mm/slab.c:3758
__put_task_struct+0x276/0x470 kernel/fork.c:420
put_task_struct include/linux/sched/task.h:98 [inline]
delayed_put_task_struct+0x1fb/0x2e0 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+0x780/0x1180 kernel/rcu/tree.c:2946
__do_softirq+0x24d/0x9ff kernel/softirq.c:288

The buggy address belongs to the object at ffff888093d9c580
which belongs to the cache task_struct of size 6144
The buggy address is located 2016 bytes inside of
6144-byte region [ffff888093d9c580, ffff888093d9dd80)
The buggy address belongs to the page:
page:ffffea00024f6700 count:1 mapcount:0 mapping:ffff888093d9c580 index:0xffff888093d9c580 compound_mapcount: 0
flags: 0xfff00000008100(slab|head)
raw: 00fff00000008100 ffff888093d9c580 ffff888093d9c580 0000000100000000
raw: ffffea0002af4ea0 ffffea00024e0320 ffff88823f8307c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff888093d9cc00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888093d9cc80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888093d9cd00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888093d9cd80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888093d9ce00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
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
Reply all
Reply to author
Forward
0 new messages