syzbot


KASAN: slab-out-of-bounds Write in dbgfs_rm_context_write

Status: fixed on 2023/02/24 13:50
Subsystems: damon
[Documentation on labels]
Reported-by: syzbot+6087eafb76a94c4ac9eb@syzkaller.appspotmail.com
Fix commit: 1de09a7281ed mm/damon/dbgfs: check if rm_contexts input is for a real context
First crash: 539d, last: 529d
Cause bisection: failed (error log, bisect log)
  
Discussions (3)
Title Replies (including bot) Last reply
[PATCH v2 0/2] Fix slab-out-of-bounds Write in dbgfs_rm_context_write 3 (3) 2022/11/07 16:50
[PATCH 0/2] Fix slab-out-of-bounds Write in dbgfs_rm_context_write 4 (4) 2022/11/03 16:14
[syzbot] KASAN: slab-out-of-bounds Write in dbgfs_rm_context_write 1 (2) 2022/10/31 18:30
Last patch testing requests (2)
Created Duration User Patch Repo Result
2022/10/31 07:10 10m hdanton@sina.com patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 98555239e4c3 report log
2022/10/31 04:43 10m hdanton@sina.com patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 98555239e4c3 report log

Sample crash report:
general protection fault, probably for non-canonical address 0xdffffc0000000002: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000010-0x0000000000000017]
CPU: 0 PID: 3606 Comm: syz-executor643 Not tainted 6.1.0-rc3-syzkaller-00239-g10d916c86eca #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
RIP: 0010:dbgfs_rm_context mm/damon/dbgfs.c:928 [inline]
RIP: 0010:dbgfs_rm_context_write+0x2e3/0x4d0 mm/damon/dbgfs.c:971
Code: 00 4d 8b 36 4c 39 34 24 0f 84 e4 00 00 00 e8 54 c1 a7 ff 48 8b 44 24 18 49 63 d4 48 c1 e2 03 48 8d 34 10 48 89 f7 48 c1 ef 03 <80> 3c 2f 00 0f 85 6b 01 00 00 48 8b 05 3c 83 52 0f 4c 89 36 41 83
RSP: 0018:ffffc90003ddfcb0 EFLAGS: 00010212
RAX: 0000000000000010 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000010 RDI: 0000000000000002
RBP: dffffc0000000000 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000000
R13: ffff88806f0a0000 R14: ffff88801b2d7608 R15: 0000000000000000
FS:  00005555574d5300(0000) GS:ffff8880b9a00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000000002000f000 CR3: 000000007b257000 CR4: 0000000000350ef0
Call Trace:
 <TASK>
 full_proxy_write+0x118/0x180 fs/debugfs/file.c:236
 vfs_write+0x2d7/0xdd0 fs/read_write.c:582
 ksys_write+0x127/0x250 fs/read_write.c:637
 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+0x63/0xcd
RIP: 0033:0x7fb20de92d69
Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 00 00 00 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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffd47c11e88 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fb20de92d69
RDX: 000000000000fe6c RSI: 0000000020000080 RDI: 0000000000000003
RBP: 00007fb20de56f10 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fb20de56fa0
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:dbgfs_rm_context mm/damon/dbgfs.c:928 [inline]
RIP: 0010:dbgfs_rm_context_write+0x2e3/0x4d0 mm/damon/dbgfs.c:971
Code: 00 4d 8b 36 4c 39 34 24 0f 84 e4 00 00 00 e8 54 c1 a7 ff 48 8b 44 24 18 49 63 d4 48 c1 e2 03 48 8d 34 10 48 89 f7 48 c1 ef 03 <80> 3c 2f 00 0f 85 6b 01 00 00 48 8b 05 3c 83 52 0f 4c 89 36 41 83
RSP: 0018:ffffc90003ddfcb0 EFLAGS: 00010212
RAX: 0000000000000010 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000010 RDI: 0000000000000002
RBP: dffffc0000000000 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000000
R13: ffff88806f0a0000 R14: ffff88801b2d7608 R15: 0000000000000000
FS:  00005555574d5300(0000) GS:ffff8880b9b00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000005decd0 CR3: 000000007b257000 CR4: 0000000000350ee0
----------------
Code disassembly (best guess):
   0:	00 4d 8b             	add    %cl,-0x75(%rbp)
   3:	36 4c 39 34 24       	cmp    %r14,%ss:(%rsp)
   8:	0f 84 e4 00 00 00    	je     0xf2
   e:	e8 54 c1 a7 ff       	callq  0xffa7c167
  13:	48 8b 44 24 18       	mov    0x18(%rsp),%rax
  18:	49 63 d4             	movslq %r12d,%rdx
  1b:	48 c1 e2 03          	shl    $0x3,%rdx
  1f:	48 8d 34 10          	lea    (%rax,%rdx,1),%rsi
  23:	48 89 f7             	mov    %rsi,%rdi
  26:	48 c1 ef 03          	shr    $0x3,%rdi
* 2a:	80 3c 2f 00          	cmpb   $0x0,(%rdi,%rbp,1) <-- trapping instruction
  2e:	0f 85 6b 01 00 00    	jne    0x19f
  34:	48 8b 05 3c 83 52 0f 	mov    0xf52833c(%rip),%rax        # 0xf528377
  3b:	4c 89 36             	mov    %r14,(%rsi)
  3e:	41                   	rex.B
  3f:	83                   	.byte 0x83

Crashes (6):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/11/05 06:56 upstream 10d916c86eca 6d752409 .config strace log report syz C [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root general protection fault in dbgfs_rm_context_write
2022/10/27 02:23 upstream 98555239e4c3 86777b7f .config strace log report syz C ci-upstream-kasan-gce general protection fault in dbgfs_rm_context_write
2022/10/27 01:48 upstream 4dc12f37a8e9 86777b7f .config strace log report syz C [disk image] [vmlinux] [kernel image] ci2-upstream-fs general protection fault in dbgfs_rm_context_write
2022/10/27 05:45 upstream 98555239e4c3 86777b7f .config console log report syz C ci-upstream-kasan-gce-386 general protection fault in dbgfs_rm_context_write
2022/10/27 04:14 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 86777b7f .config console log report syz C [disk image] [vmlinux] ci-upstream-gce-arm64 BUG: unable to handle kernel NULL pointer dereference in dbgfs_rm_context_write
2022/10/27 01:32 upstream 4dc12f37a8e9 86777b7f .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in dbgfs_rm_context_write
* Struck through repros no longer work on HEAD.