syzbot


general protection fault in dma_fence_array_first

Status: fixed on 2023/04/12 21:18
Subsystems: dri media
[Documentation on labels]
Reported-by: syzbot+5c943fe38e86d615cac2@syzkaller.appspotmail.com
Fix commit: 21d139d73f77 dma-buf/sync-file: fix logic error in new fence merge code
First crash: 722d, last: 720d
Cause bisection: introduced by (bisect log) :
commit 519f490db07e1a539490612f376487f61e48e39c
Author: Christian KΓΆnig <christian.koenig@amd.com>
Date: Fri Mar 11 09:32:26 2022 +0000

  dma-buf/sync-file: fix warning about fence containers

Crash: general protection fault in dma_fence_array_first (log)
Repro: C syz .config
  
Discussions (2)
Title Replies (including bot) Last reply
[PATCH next] dma-buf/sync-file: do not allow zero size allocations 6 (6) 2022/04/03 15:05
[syzbot] general protection fault in dma_fence_array_first 1 (3) 2022/03/29 22:12
Last patch testing requests (2)
Created Duration User Patch Repo Result
2022/11/09 17:30 10m retest repro linux-next error OK
2022/03/29 22:02 9m paskripkin@gmail.com patch linux-next OK

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: 1 PID: 3595 Comm: syz-executor814 Not tainted 5.17.0-next-20220328-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:dma_fence_array_first+0x78/0xb0 drivers/dma-buf/dma-fence-array.c:234
Code: 00 00 fc ff df 48 89 fa 48 c1 ea 03 80 3c 02 00 75 43 48 8b 9b 88 00 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 da 48 c1 ea 03 <80> 3c 02 00 75 1b 4c 8b 23 e8 fa a9 e0 fc 4c 89 e0 5b 41 5c c3 45
RSP: 0018:ffffc90003a4fd48 EFLAGS: 00010202
RAX: dffffc0000000000 RBX: 0000000000000010 RCX: 0000000000000000
RDX: 0000000000000002 RSI: ffffffff84980052 RDI: ffff888015c76388
RBP: ffff888015c76300 R08: 0000000000000000 R09: ffff888015c7633b
R10: ffffffff8498f6ba R11: 0000000000000000 R12: ffff888015c76300
R13: ffff888015c76690 R14: 00000000c0383e04 R15: 0000000020001840
FS:  0000555556872300(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020001528 CR3: 000000001e82f000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 __dma_fence_unwrap_array include/linux/dma-fence-unwrap.h:42 [inline]
 dma_fence_unwrap_first include/linux/dma-fence-unwrap.h:57 [inline]
 sync_file_ioctl_fence_info drivers/dma-buf/sync_file.c:414 [inline]
 sync_file_ioctl+0x248/0x22c0 drivers/dma-buf/sync_file.c:477
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:870 [inline]
 __se_sys_ioctl fs/ioctl.c:856 [inline]
 __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:856
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0x80 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7f6aae8951b9
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:00007ffedd290238 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f6aae8951b9
RDX: 0000000020001840 RSI: 00000000c0383e04 RDI: 0000000000000007
RBP: 00007f6aae8591a0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f6aae859230
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:dma_fence_array_first+0x78/0xb0 drivers/dma-buf/dma-fence-array.c:234
Code: 00 00 fc ff df 48 89 fa 48 c1 ea 03 80 3c 02 00 75 43 48 8b 9b 88 00 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 da 48 c1 ea 03 <80> 3c 02 00 75 1b 4c 8b 23 e8 fa a9 e0 fc 4c 89 e0 5b 41 5c c3 45
RSP: 0018:ffffc90003a4fd48 EFLAGS: 00010202
RAX: dffffc0000000000 RBX: 0000000000000010 RCX: 0000000000000000
RDX: 0000000000000002 RSI: ffffffff84980052 RDI: ffff888015c76388
RBP: ffff888015c76300 R08: 0000000000000000 R09: ffff888015c7633b
R10: ffffffff8498f6ba R11: 0000000000000000 R12: ffff888015c76300
R13: ffff888015c76690 R14: 00000000c0383e04 R15: 0000000020001840
FS:  0000555556872300(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020001528 CR3: 000000001e82f000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess), 4 bytes skipped:
   0:	df 48 89             	fisttps -0x77(%rax)
   3:	fa                   	cli
   4:	48 c1 ea 03          	shr    $0x3,%rdx
   8:	80 3c 02 00          	cmpb   $0x0,(%rdx,%rax,1)
   c:	75 43                	jne    0x51
   e:	48 8b 9b 88 00 00 00 	mov    0x88(%rbx),%rbx
  15:	48 b8 00 00 00 00 00 	movabs $0xdffffc0000000000,%rax
  1c:	fc ff df
  1f:	48 89 da             	mov    %rbx,%rdx
  22:	48 c1 ea 03          	shr    $0x3,%rdx
* 26:	80 3c 02 00          	cmpb   $0x0,(%rdx,%rax,1) <-- trapping instruction
  2a:	75 1b                	jne    0x47
  2c:	4c 8b 23             	mov    (%rbx),%r12
  2f:	e8 fa a9 e0 fc       	callq  0xfce0aa2e
  34:	4c 89 e0             	mov    %r12,%rax
  37:	5b                   	pop    %rbx
  38:	41 5c                	pop    %r12
  3a:	c3                   	retq
  3b:	45                   	rex.RB

Crashes (7):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/03/28 21:06 linux-next 8515d05bf6bc ee339263 .config console log report syz C ci-upstream-linux-next-kasan-gce-root general protection fault in dma_fence_array_first
2022/03/29 19:50 linux-next c2528a0cdebd 6bdac766 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in dma_fence_array_first
2022/03/29 15:23 linux-next c2528a0cdebd 6bdac766 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in dma_fence_array_first
2022/03/29 15:18 linux-next c2528a0cdebd 6bdac766 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in dma_fence_array_first
2022/03/29 10:50 linux-next c2528a0cdebd 6bdac766 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in dma_fence_array_first
2022/03/28 20:52 linux-next 8515d05bf6bc ee339263 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in dma_fence_array_first
2022/03/28 09:13 linux-next 8515d05bf6bc 89bc8608 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in dma_fence_array_first
* Struck through repros no longer work on HEAD.