syzbot


KASAN: null-ptr-deref Write in sock_setsockopt
Status: fixed on 2022/03/08 16:11
Reported-by: syzbot+@syzkaller.appspotmail.com
Fix commit: d00c8ee31729 net: fix possible NULL deref in sock_reserve_memory
First crash: 202d, last: 94d

Sample crash report:
general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
CPU: 0 PID: 3597 Comm: syz-executor346 Not tainted 5.17.0-rc3-syzkaller-00150-g143de8d97d79 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:sk_prot_mem_limits include/net/sock.h:1523 [inline]
RIP: 0010:sock_reserve_memory net/core/sock.c:1000 [inline]
RIP: 0010:sock_setsockopt+0x23e0/0x2cb0 net/core/sock.c:1446
Code: fa 48 c1 ea 03 80 3c 02 00 0f 85 3c 05 00 00 48 8b 83 20 01 00 00 ba ff ff 37 00 48 c1 e2 2a 48 8d 78 08 48 89 f9 48 c1 e9 03 <80> 3c 11 00 0f 85 11 08 00 00 48 8b 40 08 48 8b b5 90 fe ff ff 48
RSP: 0018:ffffc90001b4fc70 EFLAGS: 00010202
RAX: 0000000000000000 RBX: ffffffff8c40e2c0 RCX: 0000000000000001
RDX: dffffc0000000000 RSI: 0000000000000008 RDI: 0000000000000008
RBP: ffffc90001b4fde8 R08: 0000000000000001 R09: ffffffff90696527
R10: fffffbfff20d2ca4 R11: 0000000000000000 R12: ffff888011fe5234
R13: ffff888011fe54a0 R14: 0000000000000001 R15: ffff888011fe5000
FS:  0000555555d35300(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fdb819cd130 CR3: 000000007b774000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 __sys_setsockopt+0x4f8/0x610 net/socket.c:2176
 __do_sys_setsockopt net/socket.c:2191 [inline]
 __se_sys_setsockopt net/socket.c:2188 [inline]
 __x64_sys_setsockopt+0xba/0x150 net/socket.c:2188
 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+0x44/0xae
RIP: 0033:0x7fdb8195bdc9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 51 15 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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fff2abf03d8 EFLAGS: 00000246 ORIG_RAX: 0000000000000036
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007fdb8195bdc9
RDX: 0000000000000049 RSI: 0000000000000001 RDI: 0000000000000004
RBP: 0000000000000000 R08: 0000000000000004 R09: 00007fff2abf0400
R10: 0000000020000000 R11: 0000000000000246 R12: 00007fff2abf03fc
R13: 00007fff2abf0410 R14: 00007fff2abf0450 R15: 0000000000000000
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:sk_prot_mem_limits include/net/sock.h:1523 [inline]
RIP: 0010:sock_reserve_memory net/core/sock.c:1000 [inline]
RIP: 0010:sock_setsockopt+0x23e0/0x2cb0 net/core/sock.c:1446
Code: fa 48 c1 ea 03 80 3c 02 00 0f 85 3c 05 00 00 48 8b 83 20 01 00 00 ba ff ff 37 00 48 c1 e2 2a 48 8d 78 08 48 89 f9 48 c1 e9 03 <80> 3c 11 00 0f 85 11 08 00 00 48 8b 40 08 48 8b b5 90 fe ff ff 48
RSP: 0018:ffffc90001b4fc70 EFLAGS: 00010202
RAX: 0000000000000000 RBX: ffffffff8c40e2c0 RCX: 0000000000000001
RDX: dffffc0000000000 RSI: 0000000000000008 RDI: 0000000000000008
RBP: ffffc90001b4fde8 R08: 0000000000000001 R09: ffffffff90696527
R10: fffffbfff20d2ca4 R11: 0000000000000000 R12: ffff888011fe5234
R13: ffff888011fe54a0 R14: 0000000000000001 R15: ffff888011fe5000
FS:  0000555555d35300(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fdb819cd130 CR3: 000000007b774000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	fa                   	cli
   1:	48 c1 ea 03          	shr    $0x3,%rdx
   5:	80 3c 02 00          	cmpb   $0x0,(%rdx,%rax,1)
   9:	0f 85 3c 05 00 00    	jne    0x54b
   f:	48 8b 83 20 01 00 00 	mov    0x120(%rbx),%rax
  16:	ba ff ff 37 00       	mov    $0x37ffff,%edx
  1b:	48 c1 e2 2a          	shl    $0x2a,%rdx
  1f:	48 8d 78 08          	lea    0x8(%rax),%rdi
  23:	48 89 f9             	mov    %rdi,%rcx
  26:	48 c1 e9 03          	shr    $0x3,%rcx
* 2a:	80 3c 11 00          	cmpb   $0x0,(%rcx,%rdx,1) <-- trapping instruction
  2e:	0f 85 11 08 00 00    	jne    0x845
  34:	48 8b 40 08          	mov    0x8(%rax),%rax
  38:	48 8b b5 90 fe ff ff 	mov    -0x170(%rbp),%rsi
  3f:	48                   	rex.W

Crashes (45):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-net-this-kasan-gce 2022/02/13 17:59 net 143de8d97d79 8b9ca619 .config log report syz C general protection fault in sock_setsockopt
ci-upstream-net-kasan-gce 2022/02/13 16:09 net-next 5a8fb33e5305 8b9ca619 .config log report syz C general protection fault in sock_setsockopt
ci-qemu-upstream 2021/11/10 23:00 upstream 89d714ab6043 75b04091 .config log report info KASAN: null-ptr-deref Write in sock_setsockopt
ci-qemu-upstream 2021/11/10 10:56 upstream cb690f5238d7 55fa030c .config log report info KASAN: null-ptr-deref Write in sock_setsockopt
ci-qemu-upstream 2021/11/08 08:49 upstream 6b75d88fa81b 4c1be0be .config log report info KASAN: null-ptr-deref Write in sock_setsockopt
ci-qemu-upstream 2021/11/07 08:24 upstream 512b7931ad05 4c1be0be .config log report info KASAN: null-ptr-deref Write in sock_setsockopt
ci-qemu-upstream 2021/11/07 01:45 upstream 512b7931ad05 4c1be0be .config log report info KASAN: null-ptr-deref Write in sock_setsockopt
ci-qemu-upstream 2021/11/06 14:31 upstream fe91c4725aee 4c1be0be .config log report info KASAN: null-ptr-deref Write in sock_setsockopt
ci-qemu-upstream 2021/11/06 13:08 upstream fe91c4725aee 4c1be0be .config log report info KASAN: null-ptr-deref Write in sock_setsockopt
ci-qemu-upstream 2021/11/05 15:28 upstream d4439a1189f9 4c1be0be .config log report info KASAN: null-ptr-deref Write in sock_setsockopt
ci-qemu-upstream 2021/11/03 10:54 upstream 56d33754481f 17f3edd2 .config log report info KASAN: null-ptr-deref Write in sock_setsockopt
ci-qemu-upstream-386 2021/11/11 01:15 upstream 89d714ab6043 75b04091 .config log report info KASAN: null-ptr-deref Write in sock_setsockopt
ci-qemu-upstream-386 2021/11/07 04:08 upstream 512b7931ad05 4c1be0be .config log report info KASAN: null-ptr-deref Write in sock_setsockopt
ci-qemu-upstream-386 2021/11/06 19:43 upstream fe91c4725aee 4c1be0be .config log report info KASAN: null-ptr-deref Write in sock_setsockopt
ci-qemu-upstream-386 2021/11/06 10:06 upstream fe91c4725aee 4c1be0be .config log report info KASAN: null-ptr-deref Write in sock_setsockopt
ci-qemu-upstream-386 2021/11/06 04:59 upstream fe91c4725aee 4c1be0be .config log report info KASAN: null-ptr-deref Write in sock_setsockopt
ci-qemu-upstream-386 2021/11/04 16:12 upstream ce840177930f 4c1be0be .config log report info KASAN: null-ptr-deref Write in sock_setsockopt
ci-qemu-upstream-386 2021/11/03 12:02 upstream 56d33754481f 17f3edd2 .config log report info KASAN: null-ptr-deref Write in sock_setsockopt
ci-upstream-kasan-gce-selinux-root 2022/02/13 15:35 upstream b81b1829e7e3 8b9ca619 .config log report info general protection fault in sock_setsockopt
ci-upstream-kasan-gce-root 2022/02/13 15:26 upstream b81b1829e7e3 8b9ca619 .config log report info general protection fault in sock_setsockopt
ci-upstream-kasan-gce-selinux-root 2022/01/17 08:43 upstream 79e06c4c4950 723cfaf0 .config log report info general protection fault in sock_setsockopt
ci-upstream-kasan-gce-selinux-root 2022/01/16 20:14 upstream d0a231f01e5b 723cfaf0 .config log report info general protection fault in sock_setsockopt
ci-upstream-kasan-gce-selinux-root 2022/01/16 16:22 upstream d0a231f01e5b 723cfaf0 .config log report info general protection fault in sock_setsockopt
ci-upstream-kasan-gce-selinux-root 2022/01/14 00:53 upstream 455e73a07f6e b8d780ab .config log report info general protection fault in sock_setsockopt
ci-upstream-kasan-gce-selinux-root 2022/01/12 22:23 upstream daadb3bd0e8d 44d1319a .config log report info general protection fault in sock_setsockopt
ci-upstream-kasan-gce-selinux-root 2022/01/12 21:19 upstream daadb3bd0e8d 44d1319a .config log report info general protection fault in sock_setsockopt
ci-upstream-kasan-gce-selinux-root 2021/12/19 16:54 upstream 3f667b5d4053 44068e19 .config log report info general protection fault in sock_setsockopt
ci-upstream-kasan-gce 2021/12/14 05:36 upstream 5472f14a3742 5d14b1ea .config log report info general protection fault in sock_setsockopt
ci-qemu-upstream 2021/11/11 20:05 upstream debe436e77c7 75b04091 .config log report info general protection fault in sock_setsockopt
ci-upstream-net-this-kasan-gce 2022/02/13 17:20 net 143de8d97d79 8b9ca619 .config log report info general protection fault in sock_setsockopt
ci-upstream-net-this-kasan-gce 2022/02/06 04:58 net 59085208e4a2 a7dab638 .config log report info general protection fault in sock_setsockopt
ci-upstream-net-this-kasan-gce 2022/01/23 11:37 net afa114d987c4 214351e1 .config log report info general protection fault in sock_setsockopt
ci-upstream-net-this-kasan-gce 2022/01/22 11:26 net afa114d987c4 214351e1 .config log report info general protection fault in sock_setsockopt
ci-upstream-net-kasan-gce 2022/02/18 14:47 net-next 5a8fb33e5305 3cd800e4 .config log report info general protection fault in sock_setsockopt
ci-upstream-net-kasan-gce 2022/02/18 09:37 net-next 5a8fb33e5305 3cd800e4 .config log report info general protection fault in sock_setsockopt
ci-upstream-net-kasan-gce 2022/02/13 15:30 net-next 5a8fb33e5305 8b9ca619 .config log report info general protection fault in sock_setsockopt
ci-upstream-net-kasan-gce 2022/02/01 14:48 net-next 9a90986efcff c1c1631d .config log report info general protection fault in sock_setsockopt
ci-upstream-net-kasan-gce 2022/01/16 22:44 net-next fe8152b38d3a 723cfaf0 .config log report info general protection fault in sock_setsockopt
ci-upstream-net-kasan-gce 2022/01/16 02:50 net-next fe8152b38d3a 723cfaf0 .config log report info general protection fault in sock_setsockopt
ci-upstream-net-kasan-gce 2022/01/13 22:37 net-next fe8152b38d3a b8d780ab .config log report info general protection fault in sock_setsockopt
ci-upstream-net-kasan-gce 2022/01/07 08:44 net-next e4a3d6a6a19a 6acc789a .config log report info general protection fault in sock_setsockopt
ci-upstream-net-kasan-gce 2022/01/02 07:27 net-next e63a02348958 e1768e9c .config log report info general protection fault in sock_setsockopt
ci-upstream-net-kasan-gce 2021/12/23 12:27 net-next e087cba11677 6caa12e4 .config log report info general protection fault in sock_setsockopt
ci-upstream-linux-next-kasan-gce-root 2022/02/19 05:36 linux-next ef6b35306dd8 3cd800e4 .config log report info general protection fault in sock_setsockopt
ci-upstream-linux-next-kasan-gce-root 2022/02/13 15:26 linux-next ef6b35306dd8 8b9ca619 .config log report info general protection fault in sock_setsockopt