syzbot


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

Status: closed as invalid on 2024/09/13 10:29
Subsystems: kernel
[Documentation on labels]
First crash: 181d, last: 174d

Sample crash report:
==================================================================
BUG: KASAN: stack-out-of-bounds in insn_init arch/x86/lib/insn.c:70 [inline]
BUG: KASAN: stack-out-of-bounds in insn_decode+0x51/0x4c0 arch/x86/lib/insn.c:758
Write of size 88 at addr ffffc900041b7410 by task syz.3.43/5499
Oops: general protection fault, probably for non-canonical address 0xdfff0c60ffffff09: 0000 [#2] PREEMPT SMP KASAN PTI

CPU: 0 UID: 0 PID: 5499 Comm: syz.3.43 Not tainted 6.11.0-rc4-next-20240821-syzkaller #0
CPU: 1 UID: 0 PID: 5499 Comm: syz.3.43 Not tainted 6.11.0-rc4-next-20240821-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
Call Trace:
RIP: 1020:0xfffffffd
 <TASK>
Code: Unable to access opcode bytes at 0xffffffd3.
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
RSP: 1060:ffffffffffffffff EFLAGS: 8bb6e90100000000 ORIG_RAX: ffffc900041b6430
RAX: 1ffff92000836c70 RBX: 58b5b74704c4f300 RCX: ffffc900041b65ee
RDX: ffffc900041b6674 RSI: 0000000045e0360e RDI: ffffffff8e0aa2fb
RBP: ffffc900841b6673 R08: 0000000000000000 R09: ffffc900041b65f4
R10: ffffc900041b6428 R11: ffffc900041b6677 R12: ffffc900041b6420
R13: dffffc0000000000 R14: ffff1060ffffff09 R15: ffffffff8bb6b70d
FS:  0000000000000000(0000) GS:ffff8880b9100000(0000) knlGS:0000000000000000
CS:  ff09 DS: 0000 ES: 0018 CR0: ffffc900041b65ed
CR2: ffffffff81fc4903 CR3: ffffc900041b61a0 CR4: 0000000000000000
 print_address_description mm/kasan/report.c:377 [inline]
 print_report+0x169/0x550 mm/kasan/report.c:488
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
BUG: unable to handle page fault for address: ffffc900841b65eb
#PF: supervisor instruction fetch in kernel mode
#PF: error_code(0x0010) - not-present page
PGD 15800067 P4D 15800067 PUD 0 
Oops: Oops: 0010 [#3] PREEMPT SMP KASAN PTI
CPU: 1 UID: 0 PID: 5499 Comm: syz.3.43 Not tainted 6.11.0-rc4-next-20240821-syzkaller #0
 kasan_report+0x143/0x180 mm/kasan/report.c:601
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
RIP: 6230:0xffff1060ffffff09
Code: Unable to access opcode bytes at 0xffff1060fffffedf.
RSP: 0000:00000000fffffff8 EFLAGS: ffffffff8bb6f3ee
 kasan_check_range+0x282/0x290 mm/kasan/generic.c:189
 ORIG_RAX: ffffc900041b61a0
RAX: ffffffff8c0d4a0a RBX: ffffc900041b61a0 RCX: 0000000000000000
 __asan_memset+0x23/0x50 mm/kasan/shadow.c:84
RDX: ffffc900041b65f8 RSI: 0000000000000082 RDI: 0000000000000082
RBP: 01fffc0000000000 R08: 0000000000000018 R09: 1ffff1101722519a
 insn_init arch/x86/lib/insn.c:70 [inline]
 insn_decode+0x51/0x4c0 arch/x86/lib/insn.c:758
R10: dffffc0000000000 R11: ffffed101722519b R12: ffff1060ffffff09
R13: ffffc900041b6230 R14: ffffffff8bb6f3ee R15: 00000000fffffff8
FS:  0000000000000000(0000) GS:ffff8880b9100000(0000) knlGS:0000000000000000
CS:  6230 DS: 0000 ES: 0000 CR0: 0000000080050033
 get_kernel_gp_address arch/x86/kernel/traps.c:558 [inline]
 __exc_general_protection arch/x86/kernel/traps.c:733 [inline]
 exc_general_protection+0x454/0x5d0 arch/x86/kernel/traps.c:693
CR2: ffffc900841b65eb CR3: 000000000e736000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
 asm_exc_general_protection+0x26/0x30 arch/x86/include/asm/idtentry.h:617
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
RIP: 0010:clear_pending kernel/locking/qspinlock.c:151 [inline]
RIP: 0010:pv_wait_head_or_lock kernel/locking/qspinlock_paravirt.h:435 [inline]
RIP: 0010:__pv_queued_spin_lock_slowpath+0x830/0xdb0 kernel/locking/qspinlock.c:508
Code: e9 6e ff ff ff 48 8d 8c 24 b0 00 00 00 80 e1 07 fe c1 38 c1 7c 97 48 8d bc 24 b0 00 00 00 e8 87 e3 34 f6 eb 88 48 8b 44 24 10 <42> 0f b6 04 28 84 c0 0f 85 d3 00 00 00 4c 8b 64 24 48 41 c6 04 24
RSP: 0018:ffffc900041b75e0 EFLAGS: 00010056
RAX: ffffc900041b7600 RBX: 1ffff92000836ed2 RCX: ffffc900041b7601
RDX: 0000000000000001 RSI: 0000000000000002 RDI: ffff8880b903ea42
RBP: ffffc900041b7718 R08: ffff8880b903ea43 R09: 1ffff11017207d48
R10: dffffc0000000000 R11: ffffed1017207d49 R12: 0000000000000000
R13: dffffc0000000000 R14: ffff8880b903ea40 R15: ffffc900041b76a0
------------[ cut here ]------------
WARNING: CPU: 1 PID: 5499 at kernel/rcu/tree_plugin.h:442 __rcu_read_unlock+0x94/0x110 kernel/rcu/tree_plugin.h:442
Modules linked in:
CPU: 1 UID: 0 PID: 5499 Comm: syz.3.43 Not tainted 6.11.0-rc4-next-20240821-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
RIP: 0010:__rcu_read_unlock+0x94/0x110 kernel/rcu/tree_plugin.h:442
Code: 41 83 3f 00 75 29 42 0f b6 04 23 84 c0 75 62 41 8b 45 00 3d 00 00 00 40 73 0f 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc 90 <0f> 0b 90 eb eb 4c 89 f7 e8 7f 00 00 00 eb cd 44 89 e9 80 e1 07 80
RSP: 0018:ffffc900041b5bc0 EFLAGS: 00010086
RAX: 00000000ffffffff RBX: 1ffff110035fc088 RCX: ffffffff81703af0
RDX: 0000000000000000 RSI: ffffffff8c609d80 RDI: ffffffff8c609d40
RBP: 00000000ffffffff R08: ffffffff901c0c6f R09: 1ffffffff203818d
R10: dffffc0000000000 R11: fffffbfff203818e R12: dffffc0000000000
R13: ffff88801afe0444 R14: ffff88801afe0000 R15: dffffc0000000000
FS:  0000000000000000(0000) GS:ffff8880b9100000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffc900841b65eb CR3: 000000000e736000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 pv_queued_spin_lock_slowpath arch/x86/include/asm/paravirt.h:584 [inline]
 queued_spin_lock_slowpath+0x42/0x50 arch/x86/include/asm/qspinlock.h:51
 queued_spin_lock include/asm-generic/qspinlock.h:114 [inline]
 do_raw_spin_lock+0x272/0x370 kernel/locking/spinlock_debug.c:116
 rcu_read_unlock include/linux/rcupdate.h:882 [inline]
 is_bpf_text_address+0x285/0x2a0 kernel/bpf/core.c:769
 kernel_text_address+0xa7/0xe0 kernel/extable.c:125
 __kernel_text_address+0xd/0x40 kernel/extable.c:79
 show_trace_log_lvl+0x2ed/0x410 arch/x86/kernel/dumpstack.c:259
 raw_spin_rq_lock_nested+0xb0/0x140 kernel/sched/core.c:595
 show_regs arch/x86/kernel/dumpstack.c:478 [inline]
 __die_body+0x5f/0xb0 arch/x86/kernel/dumpstack.c:420
 page_fault_oops+0x8e4/0xcc0 arch/x86/mm/fault.c:711
 raw_spin_rq_lock kernel/sched/sched.h:1488 [inline]
 rq_lock kernel/sched/sched.h:1787 [inline]
 __schedule+0x354/0x4b30 kernel/sched/core.c:6587
 __bad_area_nosemaphore+0x118/0x770 arch/x86/mm/fault.c:785
 do_task_dead+0xc4/0xd0 kernel/sched/core.c:6693
 do_exit+0x1f7f/0x28e0 kernel/exit.c:990
 handle_page_fault arch/x86/mm/fault.c:1479 [inline]
 exc_page_fault+0x5c8/0x8c0 arch/x86/mm/fault.c:1539
 do_group_exit+0x207/0x2c0 kernel/exit.c:1088
 get_signal+0x176f/0x1810 kernel/signal.c:2936
 arch_do_signal_or_restart+0x96/0x860 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:328 [inline]
 __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
 syscall_exit_to_user_mode+0xc9/0x370 kernel/entry/common.c:218
 do_syscall_64+0x100/0x230 arch/x86/entry/common.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f1f40d79e79
Code: Unable to access opcode bytes at 0x7f1f40d79e4f.
RSP: 002b:00007f1f407ff0e8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 00007f1f40f16060 RCX: 00007f1f40d79e79
RDX: 0000000000000000 RSI: 0000000000000080 RDI: 00007f1f40f16060
RBP: 00007f1f40f16058 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f1f40f16064
R13: 0000000000000000 R14: 00007ffd2f066270 R15: 00007ffd2f066358
 </TASK>

The buggy address belongs to stack of task syz.3.43/5499
internal error: frame has invalid marker: 18446744071595369491

The buggy address belongs to the virtual mapping at
 [ffffc900041b0000, ffffc900041b9000) created by:
 copy_process+0x5d1/0x3d50 kernel/fork.c:2206

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88807aa9be58 pfn:0x7aa9b
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000
raw: ffff88807aa9be58 0000000000000000 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x102dc2(GFP_HIGHUSER|__GFP_NOWARN|__GFP_ZERO), pid 5327, tgid 5327 (syz.4.8), ts 61522925700, free_ts 61520570788
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1517
 prep_new_page mm/page_alloc.c:1525 [inline]
 get_page_from_freelist+0x3004/0x30c0 mm/page_alloc.c:3476
 __alloc_pages_noprof+0x29e/0x780 mm/page_alloc.c:4743
 alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2265
 vm_area_alloc_pages mm/vmalloc.c:3600 [inline]
 __vmalloc_area_node mm/vmalloc.c:3669 [inline]
 __vmalloc_node_range_noprof+0xa40/0x1400 mm/vmalloc.c:3850
 alloc_thread_stack_node kernel/fork.c:314 [inline]
 dup_task_struct+0x444/0x8c0 kernel/fork.c:1115
 copy_process+0x5d1/0x3d50 kernel/fork.c:2206
 kernel_clone+0x226/0x8f0 kernel/fork.c:2787
 __do_sys_clone3 kernel/fork.c:3091 [inline]
 __se_sys_clone3+0x2cb/0x350 kernel/fork.c:3070
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
page last free pid 4684 tgid 4684 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 free_pages_prepare mm/page_alloc.c:1098 [inline]
 free_unref_page+0xc07/0xd90 mm/page_alloc.c:2651
 discard_slab mm/slub.c:2630 [inline]
 __put_partials+0xeb/0x130 mm/slub.c:3098
 put_cpu_partial+0x17c/0x250 mm/slub.c:3173
 __slab_free+0x2ea/0x3d0 mm/slub.c:4391
 qlink_free mm/kasan/quarantine.c:163 [inline]
 qlist_free_all+0x9e/0x140 mm/kasan/quarantine.c:179
 kasan_quarantine_reduce+0x14f/0x170 mm/kasan/quarantine.c:286
 __kasan_slab_alloc+0x23/0x80 mm/kasan/common.c:329
 kasan_slab_alloc include/linux/kasan.h:250 [inline]
 slab_post_alloc_hook mm/slub.c:4036 [inline]
 slab_alloc_node mm/slub.c:4085 [inline]
 kmem_cache_alloc_node_noprof+0x16b/0x320 mm/slub.c:4128
 __alloc_skb+0x1c3/0x440 net/core/skbuff.c:667
 netlink_sendmsg+0x638/0xcb0 net/netlink/af_netlink.c:1876
 sock_sendmsg_nosec net/socket.c:730 [inline]
 __sock_sendmsg+0x221/0x270 net/socket.c:745
 ____sys_sendmsg+0x525/0x7d0 net/socket.c:2597
 ___sys_sendmsg net/socket.c:2651 [inline]
 __sys_sendmsg+0x298/0x390 net/socket.c:2680
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Memory state around the buggy address:
 ffffc900041b7300: 01 f2 00 02 f2 f2 00 02 00 00 00 00 00 00 00 00
 ffffc900041b7380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffffc900041b7400: 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1
                                                       ^
 ffffc900041b7480: 00 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00
 ffffc900041b7500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================
----------------
Code disassembly (best guess):
   0:	e9 6e ff ff ff       	jmp    0xffffff73
   5:	48 8d 8c 24 b0 00 00 	lea    0xb0(%rsp),%rcx
   c:	00
   d:	80 e1 07             	and    $0x7,%cl
  10:	fe c1                	inc    %cl
  12:	38 c1                	cmp    %al,%cl
  14:	7c 97                	jl     0xffffffad
  16:	48 8d bc 24 b0 00 00 	lea    0xb0(%rsp),%rdi
  1d:	00
  1e:	e8 87 e3 34 f6       	call   0xf634e3aa
  23:	eb 88                	jmp    0xffffffad
  25:	48 8b 44 24 10       	mov    0x10(%rsp),%rax
* 2a:	42 0f b6 04 28       	movzbl (%rax,%r13,1),%eax <-- trapping instruction
  2f:	84 c0                	test   %al,%al
  31:	0f 85 d3 00 00 00    	jne    0x10a
  37:	4c 8b 64 24 48       	mov    0x48(%rsp),%r12
  3c:	41                   	rex.B
  3d:	c6                   	.byte 0xc6
  3e:	04 24                	add    $0x24,%al

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/08/21 20:10 linux-next eb8c5ca373cb db5852f9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Write in insn_decode
2024/08/21 18:26 linux-next eb8c5ca373cb db5852f9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Write in insn_decode
2024/08/20 21:08 linux-next bb1b0acdcd66 9f0ab3fb .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Write in insn_decode
2024/08/27 22:59 linux-next 6f923748057a 6c853ff9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in insn_decode
* Struck through repros no longer work on HEAD.