syzbot


general protection fault in smack_log_callback

Status: upstream: reported C repro on 2024/09/19 13:23
Subsystems: audit
[Documentation on labels]
Reported-by: syzbot+044fdf24e96093584232@syzkaller.appspotmail.com
Fix commit: 8a23c9e1ba46 selinux,smack: properly reference the LSM blob in security_watch_key()
Patched on: [ci-qemu-gce-upstream-auto ci-qemu-upstream ci-qemu-upstream-386 ci-qemu2-arm32 ci-qemu2-arm64 ci-qemu2-arm64-compat ci-qemu2-arm64-mte ci-qemu2-riscv64 ci-snapshot-upstream-root ci-upstream-bpf-kasan-gce ci-upstream-bpf-next-kasan-gce ci-upstream-gce-arm64 ci-upstream-gce-leak ci-upstream-kasan-badwrites-root 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-386-root ci-upstream-kmsan-gce-root 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-qemu-native-arm64-kvm]
First crash: 18d, last: 12d
Cause bisection: introduced by (bisect log) :
commit 5f8d28f6d7d568dbbc8c5bce94894474c07afd4f
Author: Casey Schaufler <casey@schaufler-ca.com>
Date: Wed Jul 10 21:32:26 2024 +0000

  lsm: infrastructure management of the key security blob

Crash: KASAN: slab-use-after-free Read in smk_access (log)
Repro: C syz .config
  
Duplicate bugs (1)
duplicates (1):
Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
KASAN: slab-use-after-free Read in smk_access lsm C done 28 12d 16d 0/28 closed as dup on 2024/09/20 16:58
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [audit?] general protection fault in smack_log_callback 2 (4) 2024/09/19 19:37
Last patch testing requests (1)
Created Duration User Patch Repo Result
2024/09/19 16:05 24m paul@paul-moore.com patch upstream OK log

Sample crash report:
Oops: general protection fault, probably for non-canonical address 0xe006eb2e8e85e5c5: 0000 [#1] PREEMPT SMP KASAN PTI
KASAN: maybe wild-memory-access in range [0x00377974742f2e28-0x00377974742f2e2f]
CPU: 0 UID: 3327 PID: 5215 Comm: syz-executor393 Not tainted 6.11.0-syzkaller-04744-gbdf56c7580d2 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
RIP: 0010:strlen+0x2c/0x70 lib/string.c:402
Code: 1e fa 41 57 41 56 41 54 53 49 89 fe 48 c7 c0 ff ff ff ff 49 bf 00 00 00 00 00 fc ff df 48 89 fb 49 89 c4 48 89 d8 48 c1 e8 03 <42> 0f b6 04 38 84 c0 75 12 48 ff c3 49 8d 44 24 01 43 80 7c 26 01
RSP: 0018:ffffc9000399f838 EFLAGS: 00010207
RAX: 0006ef2e8e85e5c5 RBX: 00377974742f2e2e RCX: ffff888027135a00
RDX: 0000000000000000 RSI: 00377974742f2e2e RDI: 00377974742f2e2e
RBP: 00000000fffffff3 R08: ffffffff897a37ca R09: 3d7463656a626f20
R10: dffffc0000000000 R11: ffffed10050c4e0d R12: ffffffffffffffff
R13: ffff888027135a00 R14: 00377974742f2e2e R15: dffffc0000000000
FS:  0000555591989380(0000) GS:ffff8880b8800000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020caaffb CR3: 0000000024a90000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 audit_log_untrustedstring+0x25/0x1b0 kernel/audit.c:2135
 smack_log_callback+0x105/0x1b0 security/smack/smack_access.c:321
 common_lsm_audit+0xfd/0x1b30 security/lsm_audit.c:456
 smack_log+0x421/0x540 security/smack/smack_access.c:383
 smk_access+0x4a4/0x4e0 security/smack/smack_access.c:199
 smack_watch_key+0x2f4/0x3a0 security/smack/smack_lsm.c:4656
 security_watch_key+0x86/0x250 security/security.c:4448
 keyctl_watch_key+0x2b7/0x480 security/keys/keyctl.c:1813
 __do_sys_keyctl security/keys/keyctl.c:2021 [inline]
 __se_sys_keyctl+0x106/0xa50 security/keys/keyctl.c:1874
 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
RIP: 0033:0x7f384e02daf9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 c1 17 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffd63c63ed8 EFLAGS: 00000246 ORIG_RAX: 00000000000000fa
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f384e02daf9
RDX: 0000000000000004 RSI: 000000000adcda0f RDI: 0000000000000020
RBP: 00007f384e0a05f0 R08: 0000000000000000 R09: 0000000000000006
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 431bde82d7b634db R14: 0000000000000001 R15: 0000000000000001
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:strlen+0x2c/0x70 lib/string.c:402
Code: 1e fa 41 57 41 56 41 54 53 49 89 fe 48 c7 c0 ff ff ff ff 49 bf 00 00 00 00 00 fc ff df 48 89 fb 49 89 c4 48 89 d8 48 c1 e8 03 <42> 0f b6 04 38 84 c0 75 12 48 ff c3 49 8d 44 24 01 43 80 7c 26 01
RSP: 0018:ffffc9000399f838 EFLAGS: 00010207
RAX: 0006ef2e8e85e5c5 RBX: 00377974742f2e2e RCX: ffff888027135a00
RDX: 0000000000000000 RSI: 00377974742f2e2e RDI: 00377974742f2e2e
RBP: 00000000fffffff3 R08: ffffffff897a37ca R09: 3d7463656a626f20
R10: dffffc0000000000 R11: ffffed10050c4e0d R12: ffffffffffffffff
R13: ffff888027135a00 R14: 00377974742f2e2e R15: dffffc0000000000
FS:  0000555591989380(0000) GS:ffff8880b8800000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020caaffb CR3: 0000000024a90000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess), 1 bytes skipped:
   0:	fa                   	cli
   1:	41 57                	push   %r15
   3:	41 56                	push   %r14
   5:	41 54                	push   %r12
   7:	53                   	push   %rbx
   8:	49 89 fe             	mov    %rdi,%r14
   b:	48 c7 c0 ff ff ff ff 	mov    $0xffffffffffffffff,%rax
  12:	49 bf 00 00 00 00 00 	movabs $0xdffffc0000000000,%r15
  19:	fc ff df
  1c:	48 89 fb             	mov    %rdi,%rbx
  1f:	49 89 c4             	mov    %rax,%r12
  22:	48 89 d8             	mov    %rbx,%rax
  25:	48 c1 e8 03          	shr    $0x3,%rax
* 29:	42 0f b6 04 38       	movzbl (%rax,%r15,1),%eax <-- trapping instruction
  2e:	84 c0                	test   %al,%al
  30:	75 12                	jne    0x44
  32:	48 ff c3             	inc    %rbx
  35:	49 8d 44 24 01       	lea    0x1(%r12),%rax
  3a:	43                   	rex.XB
  3b:	80                   	.byte 0x80
  3c:	7c 26                	jl     0x64
  3e:	01                   	.byte 0x1

Crashes (12):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/09/18 23:19 upstream bdf56c7580d2 c673ca06 .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root general protection fault in smack_log_callback
2024/09/18 22:34 upstream bdf56c7580d2 c673ca06 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root general protection fault in smack_log_callback
2024/09/24 20:04 upstream abf2050f51fd 5643e0e9 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-arm64-mte BUG: unable to handle kernel NULL pointer dereference in smack_log_callback
2024/09/24 19:48 upstream abf2050f51fd 5643e0e9 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-arm64-mte BUG: unable to handle kernel NULL pointer dereference in smack_log_callback
2024/09/24 19:27 upstream abf2050f51fd 5643e0e9 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-arm64-mte BUG: unable to handle kernel NULL pointer dereference in smack_log_callback
2024/09/24 00:14 upstream f8eb5bd9a818 89298aad .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-arm64-mte BUG: unable to handle kernel NULL pointer dereference in smack_log_callback
2024/09/23 16:30 upstream de5cb0dcb74c 89298aad .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-arm64-mte BUG: unable to handle kernel NULL pointer dereference in smack_log_callback
2024/09/23 08:16 upstream de5cb0dcb74c 6f888b75 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-arm64-mte BUG: unable to handle kernel paging request in smack_log_callback
2024/09/23 04:12 upstream de5cb0dcb74c 6f888b75 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-arm64-mte BUG: unable to handle kernel NULL pointer dereference in smack_log_callback
2024/09/23 04:07 upstream de5cb0dcb74c 6f888b75 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-arm64-mte BUG: unable to handle kernel paging request in smack_log_callback
2024/09/22 16:01 upstream 88264981f208 6f888b75 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-arm64-mte BUG: unable to handle kernel paging request in smack_log_callback
2024/09/22 03:13 upstream 1ec6d097897a 6f888b75 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-arm64-mte BUG: unable to handle kernel NULL pointer dereference in smack_log_callback
* Struck through repros no longer work on HEAD.