syzbot


KASAN: null-ptr-deref Write in backing_data_changed

Status: auto-obsoleted due to no activity on 2024/01/04 12:03
Bug presence: origin:downstream
[Documentation on labels]
Reported-by: syzbot+123b794611f0e3531e96@syzkaller.appspotmail.com
First crash: 444d, last: 407d
Cause bisection: introduced by (bisect log) :
commit c0f5b9920fddb8e08b9a906ed8d4fb9c46cc19d1
Author: Jiachen Zhang <zhangjiachen.jaycee@bytedance.com>
Date: Wed Sep 28 12:19:34 2022 +0000

  UPSTREAM: fuse: always revalidate rename target dentry

Crash: KASAN: null-ptr-deref Write in backing_data_changed (log)
Repro: C syz .config
  
Fix bisection: fixed by (bisect log) :
commit 63d4231d85e23d4eb29ab2ac10d5eccd0d41e7a9
Author: liujinbao1 <liujinbao1@xiaomi.corp-partner.google.com>
Date: Thu Oct 12 04:28:06 2023 +0000

  ANDROID: fuse-bpf: Add NULL pointer check in fuse_entry_revalidate

  
Bug presence (3)
Date Name Commit Repro Result
2023/08/21 android14-6.1 (ToT) c2611a04b92f C [report] KASAN: null-ptr-deref Write in backing_data_changed
2023/08/21 lts (merge base) b1644a0031cf C Didn't crash
2023/08/21 upstream (ToT) 706a74159504 C Didn't crash
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-10 KASAN: null-ptr-deref Write in backing_data_changed C done 3 372d 445d 0/2 auto-obsoleted due to no activity on 2024/02/08 13:32
android-5-15 KASAN: null-ptr-deref Write in backing_data_changed origin:downstream C done 1 354d 417d 2/2 fixed on 2023/12/20 15:24
Fix bisection attempts (2)
Created Duration User Patch Repo Result
2023/10/29 07:20 2h02m bisect fix android14-6.1 OK (1) job log
2023/09/26 11:06 55m bisect fix android14-6.1 OK (0) job log log

Sample crash report:
==================================================================
BUG: KASAN: null-ptr-deref in instrument_atomic_read_write include/linux/instrumented.h:102 [inline]
BUG: KASAN: null-ptr-deref in atomic_inc_return include/linux/atomic/atomic-instrumented.h:198 [inline]
BUG: KASAN: null-ptr-deref in ihold+0x20/0x60 fs/inode.c:450
Write of size 4 at addr 0000000000000170 by task syz-executor197/302

CPU: 1 PID: 302 Comm: syz-executor197 Not tainted 6.1.25-syzkaller-00052-gc2611a04b92f #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106
 print_report+0xe1/0x4e0 mm/kasan/report.c:430
 kasan_report+0x13c/0x170 mm/kasan/report.c:531
 kasan_check_range+0x294/0x2a0 mm/kasan/generic.c:189
 __kasan_check_write+0x14/0x20 mm/kasan/shadow.c:37
 instrument_atomic_read_write include/linux/instrumented.h:102 [inline]
 atomic_inc_return include/linux/atomic/atomic-instrumented.h:198 [inline]
 ihold+0x20/0x60 fs/inode.c:450
 backing_data_changed+0x1d9/0x4f0 fs/fuse/dir.c:202
 fuse_dentry_revalidate+0x826/0xe70 fs/fuse/dir.c:312
 d_revalidate fs/namei.c:856 [inline]
 lookup_dcache fs/namei.c:1565 [inline]
 __lookup_hash+0x1b3/0x290 fs/namei.c:1586
 do_renameat2+0x671/0x1480 fs/namei.c:4881
 __do_sys_rename fs/namei.c:4976 [inline]
 __se_sys_rename fs/namei.c:4974 [inline]
 __x64_sys_rename+0x86/0x90 fs/namei.c:4974
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f00dde64739
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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f00dde05218 EFLAGS: 00000246 ORIG_RAX: 0000000000000052
RAX: ffffffffffffffda RBX: 00007f00ddef33f8 RCX: 00007f00dde64739
RDX: 00007f00dde64739 RSI: 0000000020000140 RDI: 0000000020000100
RBP: 00007f00ddef33f0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f00ddec009c
R13: 000000000000006e R14: 0030656c69662f30 R15: 00007f00ddebe098
 </TASK>
==================================================================
BUG: kernel NULL pointer dereference, address: 0000000000000170
#PF: supervisor write access in kernel mode
#PF: error_code(0x0002) - not-present page
PGD 121962067 P4D 121962067 PUD 121963067 PMD 0 
Oops: 0002 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 302 Comm: syz-executor197 Tainted: G    B              6.1.25-syzkaller-00052-gc2611a04b92f #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023
RIP: 0010:arch_atomic_inc_return include/linux/atomic/atomic-arch-fallback.h:440 [inline]
RIP: 0010:atomic_inc_return include/linux/atomic/atomic-instrumented.h:199 [inline]
RIP: 0010:ihold+0x25/0x60 fs/inode.c:450
Code: 00 00 00 00 00 55 48 89 e5 41 56 53 49 89 fe e8 b1 e1 a9 ff 49 8d be 70 01 00 00 be 04 00 00 00 e8 40 33 f0 ff bb 01 00 00 00 <f0> 41 0f c1 9e 70 01 00 00 ff c3 bf 02 00 00 00 89 de e8 34 e5 a9
RSP: 0018:ffffc90000ec7800 EFLAGS: 00010246
RAX: ffff888109786500 RBX: 0000000000000001 RCX: ffff888109786540
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc90000ec7810 R08: ffffffff81445ad3 R09: fffffbfff0ea42fd
R10: 0000000000000000 R11: dffffc0000000001 R12: ffffc90000ec78a0
R13: 1ffff920001d8f0c R14: 0000000000000000 R15: ffff88811307e200
FS:  00007f00dde056c0(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000170 CR3: 0000000109440000 CR4: 00000000003506a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 backing_data_changed+0x1d9/0x4f0 fs/fuse/dir.c:202
 fuse_dentry_revalidate+0x826/0xe70 fs/fuse/dir.c:312
 d_revalidate fs/namei.c:856 [inline]
 lookup_dcache fs/namei.c:1565 [inline]
 __lookup_hash+0x1b3/0x290 fs/namei.c:1586
 do_renameat2+0x671/0x1480 fs/namei.c:4881
 __do_sys_rename fs/namei.c:4976 [inline]
 __se_sys_rename fs/namei.c:4974 [inline]
 __x64_sys_rename+0x86/0x90 fs/namei.c:4974
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f00dde64739
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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f00dde05218 EFLAGS: 00000246 ORIG_RAX: 0000000000000052
RAX: ffffffffffffffda RBX: 00007f00ddef33f8 RCX: 00007f00dde64739
RDX: 00007f00dde64739 RSI: 0000000020000140 RDI: 0000000020000100
RBP: 00007f00ddef33f0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f00ddec009c
R13: 000000000000006e R14: 0030656c69662f30 R15: 00007f00ddebe098
 </TASK>
Modules linked in:
CR2: 0000000000000170
---[ end trace 0000000000000000 ]---
RIP: 0010:arch_atomic_inc_return include/linux/atomic/atomic-arch-fallback.h:440 [inline]
RIP: 0010:atomic_inc_return include/linux/atomic/atomic-instrumented.h:199 [inline]
RIP: 0010:ihold+0x25/0x60 fs/inode.c:450
Code: 00 00 00 00 00 55 48 89 e5 41 56 53 49 89 fe e8 b1 e1 a9 ff 49 8d be 70 01 00 00 be 04 00 00 00 e8 40 33 f0 ff bb 01 00 00 00 <f0> 41 0f c1 9e 70 01 00 00 ff c3 bf 02 00 00 00 89 de e8 34 e5 a9
RSP: 0018:ffffc90000ec7800 EFLAGS: 00010246
RAX: ffff888109786500 RBX: 0000000000000001 RCX: ffff888109786540
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc90000ec7810 R08: ffffffff81445ad3 R09: fffffbfff0ea42fd
R10: 0000000000000000 R11: dffffc0000000001 R12: ffffc90000ec78a0
R13: 1ffff920001d8f0c R14: 0000000000000000 R15: ffff88811307e200
FS:  00007f00dde056c0(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000170 CR3: 0000000109440000 CR4: 00000000003506a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	00 00                	add    %al,(%rax)
   2:	00 00                	add    %al,(%rax)
   4:	00 55 48             	add    %dl,0x48(%rbp)
   7:	89 e5                	mov    %esp,%ebp
   9:	41 56                	push   %r14
   b:	53                   	push   %rbx
   c:	49 89 fe             	mov    %rdi,%r14
   f:	e8 b1 e1 a9 ff       	call   0xffa9e1c5
  14:	49 8d be 70 01 00 00 	lea    0x170(%r14),%rdi
  1b:	be 04 00 00 00       	mov    $0x4,%esi
  20:	e8 40 33 f0 ff       	call   0xfff03365
  25:	bb 01 00 00 00       	mov    $0x1,%ebx
* 2a:	f0 41 0f c1 9e 70 01 	lock xadd %ebx,0x170(%r14) <-- trapping instruction
  31:	00 00
  33:	ff c3                	inc    %ebx
  35:	bf 02 00 00 00       	mov    $0x2,%edi
  3a:	89 de                	mov    %ebx,%esi
  3c:	e8                   	.byte 0xe8
  3d:	34 e5                	xor    $0xe5,%al
  3f:	a9                   	.byte 0xa9

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/08/20 23:17 android14-6.1 c2611a04b92f d216d8a0 .config strace log report syz C [disk image] [vmlinux] [kernel image] ci2-android-6-1 KASAN: null-ptr-deref Write in backing_data_changed
* Struck through repros no longer work on HEAD.