syzbot


KASAN: null-ptr-deref in llcp_sock_getname

Status: upstream: reported C repro on 2019/10/30 05:08
Reported-by: syzbot+63fbbf96a292870dd86b@syzkaller.appspotmail.com
First crash: 1884d, last: 1659d
Cause bisection: introduced by (bisect log) :
commit f7b1e143d1ade0881d8e5670f7d6789be7d068ad
Author: Eric Dumazet <edumazet@google.com>
Date: Fri Oct 4 18:08:34 2019 +0000

  nfc: fix memory leak in llcp_sock_bind()

Crash: BUG: unable to handle kernel (log)
Repro: C syz .config
  
Fix bisection the fix commit could be any of (bisect log):
  ddef1e8e3f6e Linux 4.14.151
  56dfe6252c68 Linux 4.14.188
  
Last patch testing requests (2)
Created Duration User Patch Repo Result
2023/01/24 12:32 10m retest repro linux-4.14.y report log
2022/09/07 05:27 9m retest repro linux-4.14.y report log
Fix bisection attempts (8)
Created Duration User Patch Repo Result
2020/07/11 04:24 30m bisect fix linux-4.14.y OK (2) job log
2020/06/11 04:00 24m bisect fix linux-4.14.y OK (0) job log log
2020/05/12 03:35 24m bisect fix linux-4.14.y OK (0) job log log
2020/04/12 03:12 23m bisect fix linux-4.14.y OK (0) job log log
2020/03/13 02:45 26m bisect fix linux-4.14.y OK (0) job log log
2020/02/12 01:41 23m bisect fix linux-4.14.y OK (0) job log log
2020/01/13 01:17 23m bisect fix linux-4.14.y OK (0) job log log
2019/12/14 00:53 24m bisect fix linux-4.14.y OK (0) job log log

Sample crash report:
random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
audit: type=1400 audit(1572408311.438:36): avc:  denied  { map } for  pid=6826 comm="syz-executor496" path="/root/syz-executor496605180" dev="sda1" ino=16483 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1
==================================================================
BUG: KASAN: null-ptr-deref in memcpy include/linux/string.h:347 [inline]
BUG: KASAN: null-ptr-deref in llcp_sock_getname+0x38f/0x4a0 net/nfc/llcp_sock.c:532
BUG: unable to handle kernel 
Read of size 43 at addr           (null) by task syz-executor496/6833

NULL pointer dereference
CPU: 1 PID: 6833 Comm: syz-executor496 Not tainted 4.14.151 #0
 at           (null)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
IP: memcpy_erms+0x6/0x10 arch/x86/lib/memcpy_64.S:54
Call Trace:
PGD 93d0f067 
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x138/0x197 lib/dump_stack.c:53
P4D 93d0f067 
PUD 9293b067 
 kasan_report_error mm/kasan/report.c:349 [inline]
 kasan_report mm/kasan/report.c:409 [inline]
 kasan_report.cold+0x127/0x2af mm/kasan/report.c:393
PMD 0 
 check_memory_region_inline mm/kasan/kasan.c:260 [inline]
 check_memory_region+0x123/0x190 mm/kasan/kasan.c:267
 memcpy+0x24/0x50 mm/kasan/kasan.c:302
Oops: 0000 [#1] PREEMPT SMP KASAN
 memcpy include/linux/string.h:347 [inline]
 llcp_sock_getname+0x38f/0x4a0 net/nfc/llcp_sock.c:532
Modules linked in:
 SYSC_getpeername+0x120/0x270 net/socket.c:1715
CPU: 0 PID: 6837 Comm: syz-executor496 Not tainted 4.14.151 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
task: ffff8880a9a900c0 task.stack: ffff8880a8728000
RIP: 0010:memcpy_erms+0x6/0x10 arch/x86/lib/memcpy_64.S:54
RSP: 0018:ffff8880a872fd20 EFLAGS: 00010246
 SyS_getpeername+0x24/0x30 net/socket.c:1699
RAX: ffff8880a872fe0a RBX: ffff8880a872fdf8 RCX: 000000000000002b
RDX: 000000000000002b RSI: 0000000000000000 RDI: ffff8880a872fe0a
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
RBP: ffff8880a872fd40 R08: 1ffff110150e5fc1 R09: ffffed10150e5fc7
R10: ffffed10150e5fc6 R11: ffff8880a872fe34 R12: 000000000000002b
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
R13: ffff8880a872fe0a R14: 0000000000000000 R15: ffffffff87069cc0
RIP: 0033:0x4412b9
FS:  0000000001ca0880(0000) GS:ffff8880aee00000(0000) knlGS:0000000000000000
RSP: 002b:00007fffabcaa758 EFLAGS: 00000246
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
 ORIG_RAX: 0000000000000034
CR2: 0000000000000000 CR3: 00000000916b4000 CR4: 00000000001406f0
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00000000004412b9
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000003
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
RBP: 00000000006cb018 R08: 00000000004002c8 R09: 00000000004002c8
Call Trace:
R10: 00000000004002c8 R11: 0000000000000246 R12: 0000000000402030
R13: 00000000004020c0 R14: 0000000000000000 R15: 0000000000000000
 memcpy include/linux/string.h:347 [inline]
 llcp_sock_getname+0x38f/0x4a0 net/nfc/llcp_sock.c:532
==================================================================
 SYSC_getpeername+0x120/0x270 net/socket.c:1715
 SyS_getpeername+0x24/0x30 net/socket.c:1699
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x4412b9
RSP: 002b:00007fffabcaa758 EFLAGS: 00000246 ORIG_RAX: 0000000000000034
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00000000004412b9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 00000000006cb018 R08: 00000000004002c8 R09: 00000000004002c8
R10: 00000000004002c8 R11: 0000000000000246 R12: 0000000000402030
R13: 00000000004020c0 R14: 0000000000000000 R15: 0000000000000000
Code: 90 90 90 90 90 eb 1e 0f 1f 00 48 89 f8 48 89 d1 48 c1 e9 03 83 e2 07 f3 48 a5 89 d1 f3 a4 c3 66 0f 1f 44 00 00 48 89 f8 48 89 d1 <f3> a4 c3 0f 1f 80 00 00 00 00 48 89 f8 48 83 fa 20 72 7e 40 38 
RIP: memcpy_erms+0x6/0x10 arch/x86/lib/memcpy_64.S:54 RSP: ffff8880a872fd20
CR2: 0000000000000000
BUG: unable to handle kernel NULL pointer dereference at           (null)
IP: memcpy_erms+0x6/0x10 arch/x86/lib/memcpy_64.S:54
PGD 99447067 P4D 99447067 PUD 967c6067 PMD 0 
Oops: 0000 [#2] PREEMPT SMP KASAN
Modules linked in:
CPU: 1 PID: 6835 Comm: syz-executor496 Tainted: G    B D         4.14.151 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
task: ffff888091fac380 task.stack: ffff8880a7fb8000
RIP: 0010:memcpy_erms+0x6/0x10 arch/x86/lib/memcpy_64.S:54
RSP: 0018:ffff8880a7fbfd20 EFLAGS: 00010246
RAX: ffff8880a7fbfe0a RBX: ffff8880a7fbfdf8 RCX: 000000000000002b
RDX: 000000000000002b RSI: 0000000000000000 RDI: ffff8880a7fbfe0a
RBP: ffff8880a7fbfd40 R08: 1ffff11014ff7fc1 R09: ffffed1014ff7fc7
R10: ffffed1014ff7fc6 R11: ffff8880a7fbfe34 R12: 000000000000002b
R13: ffff8880a7fbfe0a R14: 0000000000000000 R15: ffffffff87069cc0
FS:  0000000001ca0880(0000) GS:ffff8880aef00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 0000000093326000 CR4: 00000000001406e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 memcpy include/linux/string.h:347 [inline]
 llcp_sock_getname+0x38f/0x4a0 net/nfc/llcp_sock.c:532
 SYSC_getpeername+0x120/0x270 net/socket.c:1715
 SyS_getpeername+0x24/0x30 net/socket.c:1699
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x4412b9
RSP: 002b:00007fffabcaa758 EFLAGS: 00000246 ORIG_RAX: 0000000000000034
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00000000004412b9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 00000000006cb018 R08: 00000000004002c8 R09: 00000000004002c8
R10: 00000000004002c8 R11: 0000000000000246 R12: 0000000000402030
R13: 00000000004020c0 R14: 0000000000000000 R15: 0000000000000000
Code: 90 90 90 90 90 eb 1e 0f 1f 00 48 89 f8 48 89 d1 48 c1 e9 03 83 e2 07 f3 48 a5 89 d1 f3 a4 c3 66 0f 1f 44 00 00 48 89 f8 48 89 d1 <f3> a4 c3 0f 1f 80 00 00 00 00 48 89 f8 48 83 fa 20 72 7e 40 38 
RIP: memcpy_erms+0x6/0x10 arch/x86/lib/memcpy_64.S:54 RSP: ffff8880a7fbfd20
CR2: 0000000000000000
BUG: unable to handle kernel NULL pointer dereference at           (null)

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/10/30 04:07 linux-4.14.y ddef1e8e3f6e 5ea87a66 .config console log report syz C ci2-linux-4-14
* Struck through repros no longer work on HEAD.