syzbot


KASAN: out-of-bounds Read in proc_pid_stack

Status: moderation: reported on 2024/11/03 04:32
Subsystems: fs
[Documentation on labels]
Reported-by: syzbot+8f0a36ae6bfb85efe87b@syzkaller.appspotmail.com
First crash: 7d21h, last: 7d21h
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: stack-out-of-bounds Read in proc_pid_stack (2) fs 1 116d 75d 0/28 auto-obsoleted due to no activity on 2024/10/21 18:27
upstream KASAN: stack-out-of-bounds Read in proc_pid_stack riscv 3 520d 554d 22/28 fixed on 2023/06/08 14:41

Sample crash report:
UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy
misc raw-gadget: fail, usb_gadget_register_driver returned -16
==================================================================
BUG: KASAN: out-of-bounds in walk_stackframe+0x3f0/0x452 arch/riscv/kernel/stacktrace.c:66
Read of size 8 at addr ff200000017975f8 by task syz.3.2217/18074

CPU: 0 UID: 0 PID: 18074 Comm: syz.3.2217 Not tainted 6.12.0-rc1-syzkaller-00012-g5f153a692bac #0
Hardware name: riscv-virtio,qemu (DT)
Call Trace:
[<ffffffff80010a14>] dump_backtrace+0x2e/0x3c arch/riscv/kernel/stacktrace.c:130
[<ffffffff85f7c3cc>] show_stack+0x34/0x40 arch/riscv/kernel/stacktrace.c:136
[<ffffffff85fd797a>] __dump_stack lib/dump_stack.c:94 [inline]
[<ffffffff85fd797a>] dump_stack_lvl+0x122/0x196 lib/dump_stack.c:120
[<ffffffff85f861e4>] print_address_description mm/kasan/report.c:377 [inline]
[<ffffffff85f861e4>] print_report+0x290/0x5a0 mm/kasan/report.c:488
[<ffffffff80970318>] kasan_report+0xec/0x118 mm/kasan/report.c:601
[<ffffffff8097219c>] __asan_report_load8_noabort+0x12/0x1a mm/kasan/report_generic.c:381
[<ffffffff80010784>] walk_stackframe+0x3f0/0x452 arch/riscv/kernel/stacktrace.c:66
[<ffffffff85fd9d70>] arch_stack_walk+0x1c/0x24 arch/riscv/kernel/stacktrace.c:163
[<ffffffff80329ee4>] stack_trace_save_tsk+0x16c/0x1f6 kernel/stacktrace.c:150
[<ffffffff80c40144>] proc_pid_stack+0x176/0x27e fs/proc/base.c:493
[<ffffffff80c416a6>] proc_single_show+0xf0/0x20e fs/proc/base.c:813
[<ffffffff80acebf8>] seq_read_iter+0x452/0x101e fs/seq_file.c:230
[<ffffffff80acfa62>] seq_read+0x29e/0x360 fs/seq_file.c:162
[<ffffffff80a25d6a>] vfs_read+0x1b0/0x86c fs/read_write.c:567
[<ffffffff80a27a30>] ksys_read+0x128/0x266 fs/read_write.c:712
[<ffffffff80a27bdc>] __do_sys_read fs/read_write.c:722 [inline]
[<ffffffff80a27bdc>] __se_sys_read fs/read_write.c:720 [inline]
[<ffffffff80a27bdc>] __riscv_sys_read+0x6e/0x94 fs/read_write.c:720
[<ffffffff8000f2d4>] syscall_handler+0x94/0x118 arch/riscv/include/asm/syscall.h:90
[<ffffffff85fd9c4a>] do_trap_ecall_u+0x1aa/0x216 arch/riscv/kernel/traps.c:331
[<ffffffff85ffcac6>] _new_vmalloc_restore_context_a0+0xc2/0xce

The buggy address belongs to the virtual mapping at
 [ff20000001790000, ff20000001799000) created by:
 kernel_clone+0x11e/0x92c kernel/fork.c:2787

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0xb0a8b
memcg:ff60000019272802
flags: 0xffe000000000000(node=0|zone=0|lastcpupid=0x7ff)
raw: 0ffe000000000000 0000000000000000 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000000000 00000001ffffffff ff60000019272802
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x2dc2(GFP_KERNEL|__GFP_HIGHMEM|__GFP_NOWARN|__GFP_ZERO), pid 13955, tgid 13955 (kworker/u9:2), ts 7480326616100, free_ts 7327918244900
 __set_page_owner+0xa2/0x70c mm/page_owner.c:320
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0xec/0x1e4 mm/page_alloc.c:1537
 prep_new_page mm/page_alloc.c:1545 [inline]
 get_page_from_freelist+0xdaa/0x295a mm/page_alloc.c:3457
 __alloc_pages_noprof+0x1e2/0x1eb6 mm/page_alloc.c:4733
 alloc_pages_mpol_noprof+0xf8/0x48a mm/mempolicy.c:2265
 alloc_pages_noprof+0x174/0x2f0 mm/mempolicy.c:2345
 vm_area_alloc_pages mm/vmalloc.c:3568 [inline]
 __vmalloc_area_node mm/vmalloc.c:3646 [inline]
 __vmalloc_node_range_noprof+0x642/0x1450 mm/vmalloc.c:3828
 alloc_thread_stack_node kernel/fork.c:314 [inline]
 dup_task_struct kernel/fork.c:1115 [inline]
 copy_process+0x365c/0x8e32 kernel/fork.c:2206
 kernel_clone+0x11e/0x92c kernel/fork.c:2787
 user_mode_thread+0xea/0x11a kernel/fork.c:2865
 call_usermodehelper_exec_sync kernel/umh.c:133 [inline]
 call_usermodehelper_exec_work+0x6c/0x1ac kernel/umh.c:164
 process_one_work+0x956/0x1dae kernel/workqueue.c:3229
 process_scheduled_works kernel/workqueue.c:3310 [inline]
 worker_thread+0x5be/0xdc6 kernel/workqueue.c:3391
 kthread+0x28c/0x3a6 kernel/kthread.c:389
 ret_from_fork+0xe/0x18 arch/riscv/kernel/entry.S:326
page last free pid 17567 tgid 17567 stack trace:
 __reset_page_owner+0x8c/0x400 mm/page_owner.c:297
 reset_page_owner include/linux/page_owner.h:25 [inline]
 free_pages_prepare mm/page_alloc.c:1108 [inline]
 free_unref_page+0x592/0xf08 mm/page_alloc.c:2638
 __free_pages+0x13c/0x1bc mm/page_alloc.c:4820
 __free_slab+0xc8/0x16e mm/slub.c:2649
 free_slab+0x38/0x1ae mm/slub.c:2672
 discard_slab mm/slub.c:2678 [inline]
 __put_partials+0x174/0x1de mm/slub.c:3146
 put_cpu_partial+0x17e/0x298 mm/slub.c:3221
 __slab_free+0x112/0x3f6 mm/slub.c:4450
 do_slab_free mm/slub.c:4532 [inline]
 ___cache_free+0x1a6/0x1e0 mm/slub.c:4638
 qlink_free mm/kasan/quarantine.c:163 [inline]
 qlist_free_all+0x76/0x16c mm/kasan/quarantine.c:179
 kasan_quarantine_reduce+0x158/0x1ba mm/kasan/quarantine.c:286
 __kasan_slab_alloc+0x5c/0x82 mm/kasan/common.c:329
 kasan_slab_alloc include/linux/kasan.h:247 [inline]
 slab_post_alloc_hook mm/slub.c:4086 [inline]
 slab_alloc_node mm/slub.c:4135 [inline]
 kmem_cache_alloc_noprof+0x1a2/0x304 mm/slub.c:4142
 getname_flags.part.0+0x50/0x4b6 fs/namei.c:139
 getname_flags+0x98/0xd8 include/linux/audit.h:322
 user_path_at+0x28/0x52 fs/namei.c:3015

Memory state around the buggy address:
 ff20000001797500: 00 00 f2 f2 00 00 00 f3 f3 f3 f3 f3 00 00 00 00
 ff20000001797580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ff20000001797600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                   ^
 ff20000001797680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ff20000001797700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/10/30 04:26 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 5f153a692bac 66aeb999 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-riscv64 KASAN: out-of-bounds Read in proc_pid_stack
* Struck through repros no longer work on HEAD.