BUG: unable to handle kernel NULL pointer dereference in smack_inode_permission

Status: upstream: reported C repro on 2022/11/14 00:05
Fix commit: 578b565b240a 9p/fd: Fix write overflow in p9_read_work
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-arm64 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-fs ci2-upstream-kcsan-gce ci2-upstream-usb], missing on: [ci-qemu2-riscv64]
First crash: 87d, last: 87d

Sample crash report:
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000028
Mem abort info:
  ESR = 0x0000000096000004
  EC = 0x25: DABT (current EL), IL = 32 bits
  SET = 0, FnV = 0
  EA = 0, S1PTW = 0
  FSC = 0x04: level 0 translation fault
Data abort info:
  ISV = 0, ISS = 0x00000004
  CM = 0, WnR = 0
user pgtable: 4k pages, 48-bit VAs, pgdp=0000000109d98000
[0000000000000028] pgd=0000000000000000, p4d=0000000000000000
Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
Modules linked in:
CPU: 0 PID: 2557 Comm: udevd Not tainted 6.1.0-rc4-syzkaller-31859-g56751c56c2a2 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/30/2022
pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : smack_inode_permission+0x70/0x164 security/smack/smack_lsm.c:1149
lr : smack_inode_permission+0x68/0x164 security/smack/smack_lsm.c:1146
sp : ffff800016a53a30
x29: ffff800016a53a80 x28: fefefefefefefeff
 x27: ffff0000ca5c0025

x26: 0000000000000000
 x25: 0000000000000000
 x24: ffff0000ca5c0025
x23: 0000000000000000 x22: 0000000000000008 x21: 0000000000000001
x20: 0000000000000001 x19: ffff0000c70cf2d8
 x18: 0000000000000000

x17: 0000000000000000
 x16: ffff80000db1a158
 x15: ffff0000c4f39a40
x14: 0000000000000090 x13: 00000000ffffffff x12: ffff0000c4f39a40
x11: ff8080000944189c x10: 0000000000000000 x9 : ffff0000c4f39a40
x8 : ffff80000944189c x7 : ffff8000086feb70 x6 : 0000000000000000
x5 : ffff0000c4f39a40 x4 : 0000000000000001 x3 : 0000000000000000
x2 : 0000000000000001 x1 : 0000000000000001 x0 : 0000000000000000
Call trace:
 security_inode_permission+0x50/0xa4 security/security.c:1326
 inode_permission+0xa0/0x244 fs/namei.c:533
 may_lookup fs/namei.c:1715 [inline]
 link_path_walk+0x138/0x628 fs/namei.c:2262
 path_lookupat+0x54/0x208 fs/namei.c:2473
 filename_lookup+0xf8/0x264 fs/namei.c:2503
 user_path_at_empty+0x5c/0x114 fs/namei.c:2876
 do_readlinkat+0x84/0x1c8 fs/stat.c:468
 __do_sys_readlinkat fs/stat.c:495 [inline]
 __se_sys_readlinkat fs/stat.c:492 [inline]
 __arm64_sys_readlinkat+0x28/0x3c fs/stat.c:492
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall arch/arm64/kernel/syscall.c:52 [inline]
 el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x48/0x164 arch/arm64/kernel/syscall.c:206
 el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:637
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:584
Code: f90003ff 97b9817f 34000134 8b1602f6 (b94022d7) 
---[ end trace 0000000000000000 ]---
Code disassembly (best guess):
   0:	f90003ff 	str	xzr, [sp]
   4:	97b9817f 	bl	0xfffffffffee60600
   8:	34000134 	cbz	w20, 0x2c
   c:	8b1602f6 	add	x22, x23, x22
* 10:	b94022d7 	ldr	w23, [x22, #32] <-- trapping instruction

Crashes (1):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-gce-arm64 2022/11/09 23:57 git:// for-kernelci 56751c56c2a2 5fa28208 .config console log report syz C [disk image] [vmlinux] [kernel image] BUG: unable to handle kernel NULL pointer dereference in smack_inode_permission
* Struck through repros no longer work on HEAD.