syzbot


KASAN: stack-out-of-bounds Write in preempt_schedule_irq

Status: upstream: reported on 2025/04/11 13:09
Subsystems: kernel
[Documentation on labels]
Reported-by: syzbot+dce69a6cda0826710f0e@syzkaller.appspotmail.com
First crash: 8d12h, last: 8d12h
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [kernel?] KASAN: stack-out-of-bounds Write in preempt_schedule_irq 0 (1) 2025/04/11 13:09
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream BUG: unable to handle kernel paging request in preempt_schedule_irq kernel 1 241d 237d 0/28 auto-obsoleted due to no activity on 2024/11/14 20:10

Sample crash report:
==================================================================
BUG: KASAN: stack-out-of-bounds in native_save_fl arch/x86/include/asm/irqflags.h:19 [inline]
BUG: KASAN: stack-out-of-bounds in arch_local_save_flags arch/x86/include/asm/irqflags.h:109 [inline]
BUG: KASAN: stack-out-of-bounds in arch_irqs_disabled arch/x86/include/asm/irqflags.h:151 [inline]
BUG: KASAN: stack-out-of-bounds in preempt_schedule_irq+0x10d/0x1c0 kernel/sched/core.c:7091
Write of size 8 at addr ffffc90004db6380 by task syz.3.172/6997

CPU: 1 UID: 0 PID: 6997 Comm: syz.3.172 Not tainted 6.14.0-next-20250404-syzkaller #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
 print_address_description mm/kasan/report.c:408 [inline]
 print_report+0x16e/0x5b0 mm/kasan/report.c:521
 kasan_report+0x143/0x180 mm/kasan/report.c:634
 native_save_fl arch/x86/include/asm/irqflags.h:19 [inline]
 arch_local_save_flags arch/x86/include/asm/irqflags.h:109 [inline]
 arch_irqs_disabled arch/x86/include/asm/irqflags.h:151 [inline]
 preempt_schedule_irq+0x10d/0x1c0 kernel/sched/core.c:7091
 irqentry_exit+0x5e/0x90 kernel/entry/common.c:354
 asm_sysvec_reschedule_ipi+0x1a/0x20 arch/x86/include/asm/idtentry.h:707
RIP: 0010:xas_load+0xd/0x5c0 lib/xarray.c:238
Code: 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 55 41 57 41 56 41 55 41 54 <53> 48 83 ec 48 49 89 fc 48 bd 00 00 00 00 00 fc ff df e8 cc a1 94
RSP: 0018:ffffc90004db64d0 EFLAGS: 00000287
RAX: ffffffff81fedbf2 RBX: ffffc90004db6580 RCX: 0000000000080000
RDX: ffffc9000d5ae000 RSI: 0000000000001020 RDI: ffffc90004db6580
RBP: ffffc90004db6630 R08: ffffffff81fedbd6 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: dffffc0000000000
R13: ffffc90004db6580 R14: 1ffff920009b6cac R15: ffffffff81fedba5
 filemap_get_read_batch+0x242/0x960 mm/filemap.c:2361
 filemap_get_pages+0x60c/0x1fc0 mm/filemap.c:2593
 filemap_read+0x466/0x1260 mm/filemap.c:2701
 __kernel_read+0x532/0xa10 fs/read_write.c:528
 integrity_kernel_read+0xb2/0x100 security/integrity/iint.c:28
 ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:480 [inline]
 ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
 ima_calc_file_hash+0xb22/0x1c10 security/integrity/ima/ima_crypto.c:568
 ima_collect_measurement+0x52b/0xb20 security/integrity/ima/ima_api.c:293
 process_measurement+0x13a3/0x1fe0 security/integrity/ima/ima_main.c:383
 ima_file_check+0xdb/0x130 security/integrity/ima/ima_main.c:611
 security_file_post_open+0xb9/0x280 security/security.c:3130
 do_open fs/namei.c:3847 [inline]
 path_openat+0x2cf7/0x35d0 fs/namei.c:4004
 do_filp_open+0x284/0x4e0 fs/namei.c:4031
 do_sys_openat2+0x12b/0x1d0 fs/open.c:1429
 do_sys_open fs/open.c:1444 [inline]
 __do_sys_openat fs/open.c:1460 [inline]
 __se_sys_openat fs/open.c:1455 [inline]
 __x64_sys_openat+0x249/0x2a0 fs/open.c:1455
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fbf8ad8d169
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fbf88bd5038 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007fbf8afa6080 RCX: 00007fbf8ad8d169
RDX: 0000000000000042 RSI: 0000200000000040 RDI: ffffffffffffff9c
RBP: 00007fbf8ae0e2a0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fbf8afa6080 R15: 00007ffe61db2558
 </TASK>

The buggy address belongs to stack of task syz.3.172/6997
 and is located at offset 32 in frame:
 preempt_schedule_irq+0x0/0x1c0 arch/x86/include/asm/bitops.h:-1

This frame has 2 objects:
 [32, 40) 'flags.i.i.i'
 [64, 72) 'flags.i.i'

The buggy address belongs to the virtual mapping at
 [ffffc90004db0000, ffffc90004db9000) created by:
 copy_process+0x5dc/0x3d10 kernel/fork.c:2259

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x36 pfn:0x51784
memcg:ffff88802f1c8e02
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000
raw: 0000000000000036 0000000000000000 00000001ffffffff ffff88802f1c8e02
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_ZERO|__GFP_NOWARN), pid 6870, tgid 6870 (dhcpcd-run-hook), ts 184650699844, free_ts 184571613308
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1f4/0x240 mm/page_alloc.c:1718
 prep_new_page mm/page_alloc.c:1726 [inline]
 get_page_from_freelist+0x356d/0x3700 mm/page_alloc.c:3655
 __alloc_frozen_pages_noprof+0x211/0x5b0 mm/page_alloc.c:4937
 alloc_pages_mpol+0x339/0x690 mm/mempolicy.c:2302
 alloc_frozen_pages_noprof mm/mempolicy.c:2373 [inline]
 alloc_pages_noprof+0x121/0x190 mm/mempolicy.c:2393
 vm_area_alloc_pages mm/vmalloc.c:3591 [inline]
 __vmalloc_area_node mm/vmalloc.c:3669 [inline]
 __vmalloc_node_range_noprof+0x9cb/0x1390 mm/vmalloc.c:3844
 __vmalloc_node_noprof+0x80/0xa0 mm/vmalloc.c:3907
 alloc_thread_stack_node kernel/fork.c:314 [inline]
 dup_task_struct+0x3f7/0x870 kernel/fork.c:1136
 copy_process+0x5dc/0x3d10 kernel/fork.c:2259
 kernel_clone+0x242/0x930 kernel/fork.c:2844
 __do_sys_clone kernel/fork.c:2987 [inline]
 __se_sys_clone kernel/fork.c:2971 [inline]
 __x64_sys_clone+0x268/0x2e0 kernel/fork.c:2971
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
page last free pid 6790 tgid 6789 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 free_pages_prepare mm/page_alloc.c:1262 [inline]
 free_unref_folios+0xe0e/0x17f0 mm/page_alloc.c:2739
 folios_put_refs+0x70a/0x800 mm/swap.c:992
 folio_batch_release include/linux/pagevec.h:101 [inline]
 truncate_inode_pages_range+0x462/0x10e0 mm/truncate.c:379
 kill_bdev block/bdev.c:91 [inline]
 blkdev_flush_mapping+0x108/0x270 block/bdev.c:674
 blkdev_put_whole block/bdev.c:681 [inline]
 bdev_release+0x460/0x700 block/bdev.c:1106
 blkdev_release+0x15/0x20 block/fops.c:660
 __fput+0x3e9/0x9f0 fs/file_table.c:465
 task_work_run+0x251/0x310 kernel/task_work.c:227
 get_signal+0x15db/0x1730 kernel/signal.c:2807
 arch_do_signal_or_restart+0x98/0x840 arch/x86/kernel/signal.c:337
 exit_to_user_mode_loop kernel/entry/common.c:111 [inline]
 exit_to_user_mode_prepare include/linux/entry-common.h:329 [inline]
 __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
 syscall_exit_to_user_mode+0xce/0x340 kernel/entry/common.c:218
 do_syscall_64+0x100/0x230 arch/x86/entry/syscall_64.c:100
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Memory state around the buggy address:
 ffffc90004db6280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffffc90004db6300: 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1
>ffffc90004db6380: 00 f2 f2 f2 00 f3 f3 f3 00 00 00 00 00 00 00 00
                      ^
 ffffc90004db6400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffffc90004db6480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================
----------------
Code disassembly (best guess):
   0:	2e 0f 1f 84 00 00 00 	cs nopl 0x0(%rax,%rax,1)
   7:	00 00
   9:	0f 1f 40 00          	nopl   0x0(%rax)
   d:	90                   	nop
   e:	90                   	nop
   f:	90                   	nop
  10:	90                   	nop
  11:	90                   	nop
  12:	90                   	nop
  13:	90                   	nop
  14:	90                   	nop
  15:	90                   	nop
  16:	90                   	nop
  17:	90                   	nop
  18:	90                   	nop
  19:	90                   	nop
  1a:	90                   	nop
  1b:	90                   	nop
  1c:	90                   	nop
  1d:	f3 0f 1e fa          	endbr64
  21:	55                   	push   %rbp
  22:	41 57                	push   %r15
  24:	41 56                	push   %r14
  26:	41 55                	push   %r13
  28:	41 54                	push   %r12
* 2a:	53                   	push   %rbx <-- trapping instruction
  2b:	48 83 ec 48          	sub    $0x48,%rsp
  2f:	49 89 fc             	mov    %rdi,%r12
  32:	48 bd 00 00 00 00 00 	movabs $0xdffffc0000000000,%rbp
  39:	fc ff df
  3c:	e8                   	.byte 0xe8
  3d:	cc                   	int3
  3e:	a1                   	.byte 0xa1
  3f:	94                   	xchg   %eax,%esp

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/04/07 00:36 linux-next a4cda136f021 1c65791e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Write in preempt_schedule_irq
* Struck through repros no longer work on HEAD.