syzbot


general protection fault in release_udmabuf

Status: fixed on 2023/02/24 13:50
Subsystems: dri media
[Documentation on labels]
Reported-by: syzbot+c80e9ef5d8bb45894db0@syzkaller.appspotmail.com
Fix commit: d9c04a1b7a15 udmabuf: Set ubuf->sg = NULL if the creation of sg table fails
First crash: 613d, last: 558d
Cause bisection: the issue happens on the oldest tested release (bisect log)
Crash: general protection fault in release_udmabuf (log)
Repro: C syz .config
  
Discussions (10)
Title Replies (including bot) Last reply
[PATCH 5.15 000/530] 5.15.75-rc1 review 542 (542) 2023/01/10 15:19
[PATCH AUTOSEL 6.0 01/44] drm/nouveau/nouveau_bo: fix potential memory leak in nouveau_bo_alloc() 53 (53) 2022/10/25 16:45
[PATCH 5.10 000/390] 5.10.150-rc1 review 407 (407) 2022/10/25 15:12
[PATCH 5.19 000/717] 5.19.17-rc1 review 732 (732) 2022/10/24 19:01
[PATCH 6.0 000/862] 6.0.3-rc1 review 899 (899) 2022/10/21 09:08
[PATCH AUTOSEL 5.10 01/22] drm/nouveau/nouveau_bo: fix potential memory leak in nouveau_bo_alloc() 23 (23) 2022/10/10 07:36
[PATCH AUTOSEL 5.15 01/25] drm/nouveau/nouveau_bo: fix potential memory leak in nouveau_bo_alloc() 26 (26) 2022/10/10 07:36
[PATCH AUTOSEL 5.19 01/36] drm/nouveau/nouveau_bo: fix potential memory leak in nouveau_bo_alloc() 37 (37) 2022/10/10 07:35
[PATCH] udmabuf: Set ubuf->sg = NULL if the creation of sg table fails 2 (2) 2022/08/25 10:00
[syzbot] general protection fault in release_udmabuf 0 (1) 2022/08/19 00:09
Last patch testing requests (1)
Created Duration User Patch Repo Result
2022/08/19 10:51 16m hdanton@sina.com patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 7ebfc85e2cd7 OK log

Sample crash report:
general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
CPU: 1 PID: 3604 Comm: syz-executor162 Not tainted 6.0.0-rc2-syzkaller-00044-gdf0219d11b6f #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022
RIP: 0010:dma_unmap_sgtable include/linux/dma-mapping.h:378 [inline]
RIP: 0010:put_sg_table drivers/dma-buf/udmabuf.c:89 [inline]
RIP: 0010:release_udmabuf+0xcb/0x4f0 drivers/dma-buf/udmabuf.c:114
Code: 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 2b 04 00 00 48 8d 7d 0c 4c 8b 63 30 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 14 02 48 89 f8 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85 e2
RSP: 0018:ffffc9000395fc58 EFLAGS: 00010256
RAX: dffffc0000000000 RBX: ffffffff8cb681e0 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffffffff84ada4e0 RDI: 0000000000000000
RBP: fffffffffffffff4 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000000 R11: 000000000008c07c R12: ffff888147721000
R13: ffff88807404a090 R14: ffff88801bb8bdc0 R15: 0000000000000000
FS:  0000000000000000(0000) GS:ffff8880b9b00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f2fb50a7908 CR3: 000000000bc8e000 CR4: 0000000000350ee0
Call Trace:
 <TASK>
 dma_buf_release+0x157/0x2d0 drivers/dma-buf/dma-buf.c:78
 __dentry_kill+0x42b/0x640 fs/dcache.c:612
 dentry_kill fs/dcache.c:733 [inline]
 dput+0x806/0xdb0 fs/dcache.c:913
 __fput+0x39c/0x9d0 fs/file_table.c:333
 task_work_run+0xdd/0x1a0 kernel/task_work.c:177
 exit_task_work include/linux/task_work.h:38 [inline]
 do_exit+0xad5/0x29b0 kernel/exit.c:795
 do_group_exit+0xd2/0x2f0 kernel/exit.c:925
 __do_sys_exit_group kernel/exit.c:936 [inline]
 __se_sys_exit_group kernel/exit.c:934 [inline]
 __x64_sys_exit_group+0x3a/0x50 kernel/exit.c:934
 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:0x7f2fb505d109
Code: Unable to access opcode bytes at RIP 0x7f2fb505d0df.
RSP: 002b:00007fff77114458 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 00007f2fb50d8430 RCX: 00007f2fb505d109
RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000001
RBP: 0000000000000001 R08: ffffffffffffffc0 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f2fb50d8430
R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000001
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:dma_unmap_sgtable include/linux/dma-mapping.h:378 [inline]
RIP: 0010:put_sg_table drivers/dma-buf/udmabuf.c:89 [inline]
RIP: 0010:release_udmabuf+0xcb/0x4f0 drivers/dma-buf/udmabuf.c:114
Code: 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 2b 04 00 00 48 8d 7d 0c 4c 8b 63 30 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 14 02 48 89 f8 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85 e2
RSP: 0018:ffffc9000395fc58 EFLAGS: 00010256
RAX: dffffc0000000000 RBX: ffffffff8cb681e0 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffffffff84ada4e0 RDI: 0000000000000000
RBP: fffffffffffffff4 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000000 R11: 000000000008c07c R12: ffff888147721000
R13: ffff88807404a090 R14: ffff88801bb8bdc0 R15: 0000000000000000
FS:  0000000000000000(0000) GS:ffff8880b9a00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fd2ed62c300 CR3: 000000000bc8e000 CR4: 0000000000350ef0
----------------
Code disassembly (best guess):
   0:	48 89 fa             	mov    %rdi,%rdx
   3:	48 c1 ea 03          	shr    $0x3,%rdx
   7:	80 3c 02 00          	cmpb   $0x0,(%rdx,%rax,1)
   b:	0f 85 2b 04 00 00    	jne    0x43c
  11:	48 8d 7d 0c          	lea    0xc(%rbp),%rdi
  15:	4c 8b 63 30          	mov    0x30(%rbx),%r12
  19:	48 b8 00 00 00 00 00 	movabs $0xdffffc0000000000,%rax
  20:	fc ff df
  23:	48 89 fa             	mov    %rdi,%rdx
  26:	48 c1 ea 03          	shr    $0x3,%rdx
* 2a:	0f b6 14 02          	movzbl (%rdx,%rax,1),%edx <-- trapping instruction
  2e:	48 89 f8             	mov    %rdi,%rax
  31:	83 e0 07             	and    $0x7,%eax
  34:	83 c0 03             	add    $0x3,%eax
  37:	38 d0                	cmp    %dl,%al
  39:	7c 08                	jl     0x43
  3b:	84 d2                	test   %dl,%dl
  3d:	0f                   	.byte 0xf
  3e:	85 e2                	test   %esp,%edx

Crashes (31):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/08/24 07:30 upstream df0219d11b6f cea8b0f7 .config strace log report syz C ci-upstream-kasan-gce-root general protection fault in release_udmabuf
2022/08/24 07:09 upstream df0219d11b6f cea8b0f7 .config strace log report syz C ci-upstream-kasan-gce-root general protection fault in release_udmabuf
2022/08/24 06:49 upstream df0219d11b6f cea8b0f7 .config strace log report syz C ci-upstream-kasan-gce-root general protection fault in release_udmabuf
2022/08/24 06:24 upstream df0219d11b6f cea8b0f7 .config strace log report syz C ci-upstream-kasan-gce-root general protection fault in release_udmabuf
2022/08/15 02:04 upstream 7ebfc85e2cd7 8dfcaa3d .config strace log report syz C ci-upstream-kasan-gce general protection fault in release_udmabuf
2022/08/15 01:42 upstream 7ebfc85e2cd7 8dfcaa3d .config strace log report syz C ci-upstream-kasan-gce general protection fault in release_udmabuf
2022/08/15 01:21 upstream 7ebfc85e2cd7 8dfcaa3d .config strace log report syz C ci-upstream-kasan-gce general protection fault in release_udmabuf
2022/08/15 01:01 upstream 7ebfc85e2cd7 8dfcaa3d .config strace log report syz C ci-upstream-kasan-gce general protection fault in release_udmabuf
2022/08/15 00:40 upstream 7ebfc85e2cd7 8dfcaa3d .config strace log report syz C ci-upstream-kasan-gce-root general protection fault in release_udmabuf
2022/08/15 00:39 upstream 7ebfc85e2cd7 8dfcaa3d .config strace log report syz C ci-upstream-kasan-gce-selinux-root general protection fault in release_udmabuf
2022/08/15 00:24 upstream 7ebfc85e2cd7 8dfcaa3d .config strace log report syz C ci-upstream-kasan-gce general protection fault in release_udmabuf
2022/08/15 00:35 linux-next 6c8f479764eb 8dfcaa3d .config strace log report syz C ci-upstream-linux-next-kasan-gce-root general protection fault in release_udmabuf
2022/08/15 00:38 upstream 7ebfc85e2cd7 8dfcaa3d .config strace log report syz C ci-upstream-kasan-gce-smack-root BUG: unable to handle kernel paging request in release_udmabuf
2022/10/08 22:58 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 aea5da89 .config console log report syz C [disk image] [vmlinux] ci-upstream-gce-arm64 BUG: unable to handle kernel paging request in release_udmabuf
2022/10/01 17:57 upstream ffb4d94b4314 feb56351 .config console log report info ci-upstream-kasan-gce-selinux-root general protection fault in release_udmabuf
2022/09/30 05:43 upstream 511cce163b75 1d385642 .config console log report info ci-upstream-kasan-gce-selinux-root general protection fault in release_udmabuf
2022/09/29 01:44 upstream 49c13ed0316d e2556bc3 .config console log report info ci-upstream-kasan-gce-root general protection fault in release_udmabuf
2022/09/29 01:26 upstream 49c13ed0316d e2556bc3 .config console log report info ci-upstream-kasan-gce-selinux-root general protection fault in release_udmabuf
2022/09/15 20:38 upstream 3245cb65fd91 dd9a85ff .config console log report info ci-upstream-kasan-gce-root general protection fault in release_udmabuf
2022/09/15 20:00 upstream 3245cb65fd91 dd9a85ff .config console log report info [disk image] [vmlinux] ci-upstream-kasan-gce-selinux-root general protection fault in release_udmabuf
2022/09/14 18:41 upstream 3245cb65fd91 b884348d .config console log report info ci-upstream-kasan-gce-selinux-root general protection fault in release_udmabuf
2022/09/14 18:39 upstream 3245cb65fd91 b884348d .config console log report info [disk image] [vmlinux] ci-upstream-kasan-gce-root general protection fault in release_udmabuf
2022/09/06 13:54 upstream 53e99dcff61e 65aea2b9 .config console log report info ci-upstream-kasan-gce general protection fault in release_udmabuf
2022/08/15 00:20 upstream 7ebfc85e2cd7 8dfcaa3d .config console log report info ci-upstream-kasan-gce-selinux-root general protection fault in release_udmabuf
2022/08/15 00:20 upstream 7ebfc85e2cd7 8dfcaa3d .config console log report info ci-upstream-kasan-gce-root general protection fault in release_udmabuf
2022/08/15 00:06 upstream 7ebfc85e2cd7 8dfcaa3d .config console log report info ci-upstream-kasan-gce general protection fault in release_udmabuf
2022/09/15 19:43 upstream 3245cb65fd91 dd9a85ff .config console log report info ci-upstream-kasan-gce-386 general protection fault in release_udmabuf
2022/08/15 00:40 upstream 7ebfc85e2cd7 8dfcaa3d .config console log report info ci-upstream-kasan-gce-386 general protection fault in release_udmabuf
2022/08/15 00:19 linux-next 6c8f479764eb 8dfcaa3d .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in release_udmabuf
2022/08/15 00:20 upstream 7ebfc85e2cd7 8dfcaa3d .config console log report info ci-upstream-kasan-gce-smack-root BUG: unable to handle kernel paging request in release_udmabuf
2022/09/15 20:13 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci a6b443748715 dd9a85ff .config console log report info [disk image] [vmlinux] ci-upstream-gce-arm64 BUG: unable to handle kernel paging request in release_udmabuf
* Struck through repros no longer work on HEAD.