KASAN: null-ptr-deref Read in llcp_sock_getname

22 views
Skip to first unread message

syzbot

unread,
Oct 14, 2019, 5:43:07 AM10/14/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: e132c8d7 Linux 4.14.149
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1319ad80e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=65c18705ca007f2
dashboard link: https://syzkaller.appspot.com/bug?extid=9a64168be267f1ef3094
compiler: gcc (GCC) 9.0.0 20181231 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+9a6416...@syzkaller.appspotmail.com

SELinux: unrecognized netlink message: protocol=0 nlmsg_type=12039
sclass=netlink_route_socket pig=11730 comm=syz-executor.3
==================================================================
SELinux: unrecognized netlink message: protocol=0 nlmsg_type=12039
sclass=netlink_route_socket pig=11738 comm=syz-executor.3
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
Read of size 3 at addr (null) by task syz-executor.0/11735

CPU: 0 PID: 11735 Comm: syz-executor.0 Not tainted 4.14.149 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x138/0x197 lib/dump_stack.c:53
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
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
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:0x459a59
RSP: 002b:00007f64f9919c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000034
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000459a59
RDX: 0000000020001780 RSI: 0000000020001700 RDI: 0000000000000005
RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f64f991a6d4
R13: 00000000004c056b R14: 00000000004d2ce8 R15: 00000000ffffffff
==================================================================
overlayfs: failed to resolve './Y��Z file1': -2
Scheduler tracepoints stat_sleep, stat_iowait, stat_blocked and
stat_runtime require the kernel parameter schedstats=enable or
kernel.sched_schedstats=1


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Oct 19, 2019, 2:08:07 AM10/19/19
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following crash on:

HEAD commit: b98aebd2 Linux 4.14.150
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=167e7590e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=c52c93b368dac5a7
dashboard link: https://syzkaller.appspot.com/bug?extid=9a64168be267f1ef3094
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17829837600000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=131886f7600000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+9a6416...@syzkaller.appspotmail.com

audit: type=1400 audit(1571465084.817:36): avc: denied { map } for
pid=6900 comm="syz-executor906" path="/root/syz-executor906558893"
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
Read of size 43 at addr (null) by task syz-executor906/6914

CPU: 1 PID: 6914 Comm: syz-executor906 Not tainted 4.14.150 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x138/0x197 lib/dump_stack.c:53
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
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
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:00007ffd72866208 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
==================================================================
BUG: unable to handle kernel NULL pointer dereference at (null)
IP: memcpy_erms+0x6/0x10 arch/x86/lib/memcpy_64.S:54
PGD 95e76067 P4D 95e76067 PUD 8eb54067 PMD 0
Oops: 0000 [#1] PREEMPT SMP KASAN
Modules linked in:
CPU: 1 PID: 6973 Comm: syz-executor906 Tainted: G B 4.14.150 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
task: ffff8880a709e5c0 task.stack: ffff8880a7018000
RIP: 0010:memcpy_erms+0x6/0x10 arch/x86/lib/memcpy_64.S:54
RSP: 0018:ffff8880a701fd20 EFLAGS: 00010246
RAX: ffff8880a701fe0a RBX: ffff8880a701fdf8 RCX: 000000000000002b
RDX: 000000000000002b RSI: 0000000000000000 RDI: ffff8880a701fe0a
RBP: ffff8880a701fd40 R08: 1ffff11014e03fc1 R09: ffffed1014e03fc7
R10: ffffed1014e03fc6 R11: ffff8880a701fe34 R12: 000000000000002b
R13: ffff8880a701fe0a R14: 0000000000000000 R15: ffffffff87069c40
FS: 00000000017c2880(0000) GS:ffff8880aef00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 00000000837cc000 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:00007ffd72866208 EFLAGS: 00000246 ORIG_RAX: 0000000000000034
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00000000004412b9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 000000000000b0ef 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: ffff8880a701fd20
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 96a2e067 P4D 96a2e067 PUD 90a8d067 PMD 0
Oops: 0000 [#2] PREEMPT SMP KASAN
Modules linked in:
CPU: 0 PID: 6974 Comm: syz-executor906 Tainted: G B D 4.14.150 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
task: ffff8880990866c0 task.stack: ffff8880a7100000
RIP: 0010:memcpy_erms+0x6/0x10 arch/x86/lib/memcpy_64.S:54
RSP: 0018:ffff8880a7107d20 EFLAGS: 00010246
RAX: ffff8880a7107e0a RBX: ffff8880a7107df8 RCX: 000000000000002b
RDX: 000000000000002b RSI: 0000000000000000 RDI: ffff8880a7107e0a
RBP: ffff8880a7107d40 R08: 1ffff11014e20fc1 R09: ffffed1014e20fc7
R10: ffffed1014e20fc6 R11: ffff8880a7107e34 R12: 000000000000002b
R13: ffff8880a7107e0a R14: 0000000000000000 R15: ffffffff87069c40
FS: 00000000017c2880(0000) GS:ffff8880aee00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 0000000097417000 CR4: 00000000001406f0
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:00007ffd72866208 EFLAGS: 00000246 ORIG_RAX: 0000000000000034
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00000000004412b9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 000000000000b0f2 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: ffff8880a7107d20
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 99f9a067 P4D 99f9a067 PUD 96803067 PMD 0
Oops: 0000 [#3] PREEMPT SMP KASAN
Modules linked in:
CPU: 1 PID: 6915 Comm: syz-executor906 Tainted: G B D 4.14.150 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
task: ffff88808892c100 task.stack: ffff8880881c8000
RIP: 0010:memcpy_erms+0x6/0x10 arch/x86/lib/memcpy_64.S:54
RSP: 0018:ffff8880881cfd20 EFLAGS: 00010246
RAX: ffff8880881cfe0a RBX: ffff8880881cfdf8 RCX: 000000000000002b
RDX: 000000000000002b RSI: 0000000000000000 RDI: ffff8880881cfe0a
RBP: ffff8880881cfd40 R08: 1ffff11011039fc1 R09: ffffed1011039fc7
R10: ffffed1011039fc6 R11: ffff8880881cfe34 R12: 000000000000002b
R13: ffff8880881cfe0a R14: 0000000000000000 R15: ffffffff87069c40
FS: 00000000017c2880(0000) GS:ffff8880aef00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 00000000a8980000 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:00007ffd72866208 EFLAGS: 00000246 ORIG_RAX: 0000000000000034
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00000000004412b9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 000000000000b0e5 R08: 00000000004002c8 R09: 00000000004002c8
R10: 00000000004002c8 R11: 0000000000000246 R12: 0000000000402030
---[ end trace 7bf8b6abaa530d5e ]---
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

Reply all
Reply to author
Forward
0 new messages