syzbot


kernel BUG in __set_page_owner_handle

Status: internal: reported on 2022/05/08 02:48
Reported-by: syzbot+@syzkaller.appspotmail.com
Fix commit: cd8c1fd8cdd1 mm/page_owner: use strscpy() instead of strlcpy()
Patched on: [ci-qemu-upstream ci-qemu-upstream-386 ci-qemu2-arm32 ci-qemu2-arm64 ci-qemu2-arm64-compat ci-qemu2-arm64-mte ci-upstream-bpf-kasan-gce ci-upstream-bpf-next-kasan-gce ci-upstream-gce-leak ci-upstream-kasan-gce ci-upstream-kasan-gce-386 ci-upstream-kasan-gce-root ci-upstream-kasan-gce-selinux-root ci-upstream-kasan-gce-smack-root ci-upstream-kmsan-gce ci-upstream-kmsan-gce-386 ci-upstream-linux-next-kasan-gce-root ci-upstream-net-kasan-gce ci-upstream-net-this-kasan-gce ci2-upstream-kcsan-gce ci2-upstream-usb], missing on: [ci-qemu2-riscv64]
First crash: 52d, last: 52d

Sample crash report:
detected buffer overflow in __fortify_strlen
------------[ cut here ]------------
kernel BUG at lib/string_helpers.c:980!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN
CPU: 0 PID: 4087 Comm: dhcpcd-run-hooks Not tainted 5.18.0-rc3-syzkaller-01537-g20b87e7c29df #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:fortify_panic+0x18/0x1a lib/string_helpers.c:980
Code: 8c e8 c5 ba e1 fa e9 23 0f bf fa e8 0b 5d 8c f8 eb db 55 48 89 fd e8 e0 49 40 f8 48 89 ee 48 c7 c7 80 f5 26 8a e8 99 09 f1 ff <0f> 0b e8 ca 49 40 f8 48 8b 54 24 18 4c 89 f1 48 c7 c7 00 00 27 8a
RSP: 0018:ffffc900000074a8 EFLAGS: 00010286

RAX: 000000000000002c RBX: ffff88801226b728 RCX: 0000000000000000
RDX: ffff8880198e0000 RSI: ffffffff81600458 RDI: fffff52000000e87
RBP: ffffffff89da2aa0 R08: 000000000000002c R09: 0000000000000000
R10: ffffffff815fae2e R11: 0000000000000000 R12: ffff88801226b700
R13: ffff8880198e0830 R14: 0000000000000000 R15: 0000000000000000
FS:  0000000000000000(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f5876ad6ff8 CR3: 000000001a48c000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600
Call Trace:
 <IRQ>
 __fortify_strlen include/linux/fortify-string.h:128 [inline]
 strlcpy include/linux/fortify-string.h:143 [inline]
 __set_page_owner_handle+0x2b1/0x3e0 mm/page_owner.c:171
 __set_page_owner+0x3e/0x50 mm/page_owner.c:190
 prep_new_page mm/page_alloc.c:2441 [inline]
 get_page_from_freelist+0xba2/0x3e00 mm/page_alloc.c:4182
 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5408
 alloc_pages+0x1aa/0x310 mm/mempolicy.c:2272
 alloc_slab_page mm/slub.c:1799 [inline]
 allocate_slab+0x26c/0x3c0 mm/slub.c:1944
 new_slab mm/slub.c:2004 [inline]
 ___slab_alloc+0x8df/0xf20 mm/slub.c:3005
 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3092
 slab_alloc_node mm/slub.c:3183 [inline]
 slab_alloc mm/slub.c:3225 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3232 [inline]
 kmem_cache_alloc+0x360/0x3b0 mm/slub.c:3242
 dst_alloc+0x146/0x1f0 net/core/dst.c:92
 ip6_dst_alloc+0x2e/0x90 net/ipv6/route.c:344
 icmp6_dst_alloc+0x6d/0x680 net/ipv6/route.c:3261
 ndisc_send_skb+0x112d/0x17e0 net/ipv6/ndisc.c:487
 ndisc_send_rs+0x12e/0x6f0 net/ipv6/ndisc.c:717
 addrconf_rs_timer+0x3f2/0x820 net/ipv6/addrconf.c:3931
 call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1421
 expire_timers kernel/time/timer.c:1466 [inline]
 __run_timers.part.0+0x679/0xa80 kernel/time/timer.c:1737
 __run_timers kernel/time/timer.c:1715 [inline]
 run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1750
 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558
 invoke_softirq kernel/softirq.c:432 [inline]
 __irq_exit_rcu+0x123/0x180 kernel/softirq.c:637
 irq_exit_rcu+0x5/0x20 kernel/softirq.c:649
 sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1097
 </IRQ>
 <TASK>
 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:645
RIP: 0010:strscpy+0x85/0x2a0 lib/string.c:212
Code: 80 eb 3a 48 b9 00 00 00 00 00 fc ff df 48 89 f8 48 c1 e8 03 80 3c 08 00 0f 85 9c 01 00 00 48 8b 04 24 4b 89 34 2f 49 83 c5 08 <4c> 89 e6 4c 29 ee 4c 29 e8 48 83 f8 07 0f 86 a1 00 00 00 4a 8d 3c
RSP: 0018:ffffc90004a6fa70 EFLAGS: 00000212
RAX: 0000000000000010 RBX: ffff88807cf6c42c RCX: dffffc0000000000
RDX: ffffed100f9ed887 RSI: 736b6f6f682d6e75 RDI: ffff8880198e0838
RBP: 8080808080808080 R08: 0000000000000000 R09: ffff88807cf6c434
R10: ffffed100f9ed886 R11: 0000000000000000 R12: 0000000000000010
R13: 0000000000000010 R14: fefefefefefefeff R15: ffff8880198e0830
 strscpy include/linux/fortify-string.h:170 [inline]
 strscpy_pad+0x20/0x70 lib/string_helpers.c:788
 __set_task_comm+0xab/0x2f0 fs/exec.c:1232
 begin_new_exec+0x1604/0x2f70 fs/exec.c:1358
 load_elf_binary+0x15a3/0x4ec0 fs/binfmt_elf.c:1002
 search_binary_handler fs/exec.c:1726 [inline]
 exec_binprm fs/exec.c:1767 [inline]
 bprm_execve fs/exec.c:1836 [inline]
 bprm_execve+0x7ef/0x1970 fs/exec.c:1798
 do_execveat_common+0x727/0x890 fs/exec.c:1941
 do_execve fs/exec.c:2011 [inline]
 __do_sys_execve fs/exec.c:2087 [inline]
 __se_sys_execve fs/exec.c:2082 [inline]
 __x64_sys_execve+0x8f/0xc0 fs/exec.c:2082
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7f5876c5c337
Code: Unable to access opcode bytes at RIP 0x7f5876c5c30d.
RSP: 002b:00007f5876ad6e78 EFLAGS: 00000206 ORIG_RAX: 000000000000003b
RAX: ffffffffffffffda RBX: 00007ffe421c5ae0 RCX: 00007f5876c5c337
RDX: 0000555e2f442810 RSI: 00007ffe421c5fd0 RDI: 0000555e2d603de0
RBP: 00007f5876ad6ff0 R08: 00007ffe421c5e80 R09: 0000000000000000
R10: 0000000000000008 R11: 0000000000000206 R12: 00007f5876ad6f20
R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000041
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:fortify_panic+0x18/0x1a lib/string_helpers.c:980
Code: 8c e8 c5 ba e1 fa e9 23 0f bf fa e8 0b 5d 8c f8 eb db 55 48 89 fd e8 e0 49 40 f8 48 89 ee 48 c7 c7 80 f5 26 8a e8 99 09 f1 ff <0f> 0b e8 ca 49 40 f8 48 8b 54 24 18 4c 89 f1 48 c7 c7 00 00 27 8a
RSP: 0018:ffffc900000074a8 EFLAGS: 00010286
RAX: 000000000000002c RBX: ffff88801226b728 RCX: 0000000000000000
RDX: ffff8880198e0000 RSI: ffffffff81600458 RDI: fffff52000000e87
RBP: ffffffff89da2aa0 R08: 000000000000002c R09: 0000000000000000
R10: ffffffff815fae2e R11: 0000000000000000 R12: ffff88801226b700
R13: ffff8880198e0830 R14: 0000000000000000 R15: 0000000000000000
FS:  0000000000000000(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f5876c5c30d CR3: 000000001a48c000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600
----------------
Code disassembly (best guess):
   0:	80 eb 3a             	sub    $0x3a,%bl
   3:	48 b9 00 00 00 00 00 	movabs $0xdffffc0000000000,%rcx
   a:	fc ff df
   d:	48 89 f8             	mov    %rdi,%rax
  10:	48 c1 e8 03          	shr    $0x3,%rax
  14:	80 3c 08 00          	cmpb   $0x0,(%rax,%rcx,1)
  18:	0f 85 9c 01 00 00    	jne    0x1ba
  1e:	48 8b 04 24          	mov    (%rsp),%rax
  22:	4b 89 34 2f          	mov    %rsi,(%r15,%r13,1)
  26:	49 83 c5 08          	add    $0x8,%r13
* 2a:	4c 89 e6             	mov    %r12,%rsi <-- trapping instruction
  2d:	4c 29 ee             	sub    %r13,%rsi
  30:	4c 29 e8             	sub    %r13,%rax
  33:	48 83 f8 07          	cmp    $0x7,%rax
  37:	0f 86 a1 00 00 00    	jbe    0xde
  3d:	4a                   	rex.WX
  3e:	8d                   	.byte 0x8d
  3f:	3c                   	.byte 0x3c

Crashes (1):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-bpf-next-kasan-gce 2022/05/08 02:47 bpf-next 20b87e7c29df e60b1103 .config log report info kernel BUG in __set_page_owner_handle