From: Dmitry Vyukov <dvyukov@google.com>
To: Lauro Ramos Venancio <lauro.venancio@openbossa.org>,
Aloisio Almeida Jr <aloisio.almeida@openbossa.org>,
Samuel Ortiz <sameo@linux.intel.com>,
"David S. Miller" <davem@davemloft.net>,
linux-wireless@vger.kernel.org, netdev <netdev@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Cc: syzkaller <syzkaller@googlegroups.com>,
Kostya Serebryany <kcc@google.com>,
Alexander Potapenko <glider@google.com>,
Sasha Levin <sasha.levin@oracle.com>,
Eric Dumazet <edumazet@google.com>
Subject: net/nfc: GPF in llcp_sock_getname
Date: Fri, 1 Jan 2016 14:58:06 +0100 [thread overview]
Message-ID: <CACT4Y+baorktL_dBHEWcz_jHYTzhM_-DJoms81bzVx8FbYk63w@mail.gmail.com> (raw)
Hello,
The following program triggers GPF in llcp_sock_getname:
// autogenerated by syzkaller (http://github.com/google/syzkaller)
#include <unistd.h>
#include <sys/syscall.h>
#include <string.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <linux/nfc.h>
#include <pthread.h>
int fd;
void *thr(void *arg)
{
struct sockaddr_nfc_llcp sa;
sa.sa_family = AF_NFC;
sa.dev_idx = 0;
sa.target_idx = 0x24a8;
sa.nfc_protocol = 0;
sa.dsap = 0;
sa.ssap = 2;
sa.service_name[0] = 7;
sa.service_name[1] = 9;
sa.service_name[2] = 3;
sa.service_name_len = 3;
bind(fd, (struct sockaddr*)&sa, sizeof(sa));
return 0;
}
int main()
{
fd = socket(AF_NFC, 0x2ul, 0x1ul);
pthread_t th;
pthread_create(&th, 0, thr, 0);
struct sockaddr_nfc_llcp sa;
int len = sizeof(sa);
getsockname(fd, (struct sockaddr*)&sa, &len);
return 0;
}
kasan: GPF could be caused by NULL-ptr deref or user memory
accessgeneral protection fault: 0000 [#51] SMP KASAN
Modules linked in:
CPU: 2 PID: 4207 Comm: a.out Not tainted 4.4.0-rc7+ #184
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
task: ffff8800683e9780 ti: ffff880064c70000 task.ti: ffff880064c70000
RIP: 0010:[<ffffffff816d1d5b>] [<ffffffff816d1d5b>]
kasan_report_error+0x1b/0x560
RSP: 0018:ffff880064c77c90 EFLAGS: 00010286
RAX: dffffc0000000000 RBX: 0000000000000003 RCX: dffffc0000000000
RDX: 0000000000000000 RSI: 0000000000000003 RDI: ffff880064c77c98
RBP: ffff880064c77cc0 R08: ffffed000c98efd6 R09: ffff880064c77e58
R10: ffff8800639670a0 R11: ffff880063967098 R12: ffff880064c77e6a
R13: 0000000000000000 R14: 0000000000000000 R15: ffff880063967088
FS: 00000000018ca880(0063) GS:ffff88006da00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 000000c8200012e0 CR3: 0000000064c59000 CR4: 00000000000006e0
Stack:
ffffffff816d25d4 0000000000000000 0000000000000018 0000000000000003
0000000300004000 ffffffff816d17ed ffff880064c77cd0 ffffffff816d1264
ffff880064c77cf8 ffffffff816d17ed 0000000000000000 ffff880064c77e58
Call Trace:
[< inline >] check_memory_region mm/kasan/kasan.c:264
[<ffffffff816d1264>] __asan_loadN+0x124/0x1a0 mm/kasan/kasan.c:512
[<ffffffff816d17ed>] memcpy+0x1d/0x40 mm/kasan/kasan.c:297
[<ffffffff85becf44>] llcp_sock_getname+0x424/0x600 net/nfc/llcp_sock.c:519
[<ffffffff84b5ab4d>] SYSC_getsockname+0x1bd/0x220 net/socket.c:1570
[<ffffffff84b60244>] SyS_getsockname+0x24/0x30 net/socket.c:1555
[<ffffffff85c8eaf6>] entry_SYSCALL_64_fastpath+0x16/0x7a
arch/x86/entry/entry_64.S:185
Code: 48 01 c7 e8 38 2b fc ff 5d c3 66 0f 1f 44 00 00 48 8b 17 48 b9
00 00 00 00 00 fc ff df 48 8b 77 10 48 89 d0 48 c1 e8 03 48 01 c8 <80>
38 00 75 1d 48 01 d6 eb 13 48 83 c2 08 48 89 d0 48 c1 e8 03
RIP [<ffffffff816d1d5b>] kasan_report_error+0x1b/0x560 mm/kasan/report.c:214
RSP <ffff880064c77c90>
---[ end trace b0c68fb0d02b9447 ]---
On commit 8513342170278468bac126640a5d2d12ffbff106 (Dec 28).
GPF seems to be caused by a data race on socket state.
next reply other threads:[~2016-01-01 13:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-01 13:58 Dmitry Vyukov [this message]
2016-01-01 20:58 ` net/nfc: GPF in llcp_sock_getname Cong Wang
2016-01-01 23:28 ` Cong Wang
2016-01-01 23:48 ` Cong Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CACT4Y+baorktL_dBHEWcz_jHYTzhM_-DJoms81bzVx8FbYk63w@mail.gmail.com \
--to=dvyukov@google.com \
--cc=aloisio.almeida@openbossa.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=glider@google.com \
--cc=kcc@google.com \
--cc=lauro.venancio@openbossa.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sameo@linux.intel.com \
--cc=sasha.levin@oracle.com \
--cc=syzkaller@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).