From: Masami Hiramatsu <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, mingo@redhat.com,
syzkaller-bugs@googlegroups.com
Subject: Re: [PATCH] tracing/kprobe: Fix NULL pointer access in trace_porbe_unlink()
Date: Wed, 18 Sep 2019 15:28:40 +0900 [thread overview]
Message-ID: <20190918152840.fbbf3a874d09f0c8203c7148@kernel.org> (raw)
In-Reply-To: <20190917085643.26b86260@gandalf.local.home>
On Tue, 17 Sep 2019 08:56:43 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:
> On Tue, 17 Sep 2019 14:11:37 +0900
> Masami Hiramatsu <mhiramat@kernel.org> wrote:
>
> > Fix NULL pointer access in trace_probe_unlink() by initializing
> > trace_probe.list correctly in trace_probe_init().
> >
> > In the error case of trace_probe_init(), it can call trace_probe_unlink()
> > before initializing trace_probe.list member. This causes NULL pointer
> > dereference at list_del_init() in trace_probe_unlink().
> >
> > Syzbot reported :
> >
> > kasan: CONFIG_KASAN_INLINE enabled
> > kasan: GPF could be caused by NULL-ptr deref or user memory access
> > general protection fault: 0000 [#1] PREEMPT SMP KASAN
> > CPU: 1 PID: 8633 Comm: syz-executor797 Not tainted 5.3.0-rc8-next-20190915
> > #0
> > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> > Google 01/01/2011
> > RIP: 0010:__list_del_entry_valid+0x85/0xf5 lib/list_debug.c:51
> > Code: 0f 84 e1 00 00 00 48 b8 22 01 00 00 00 00 ad de 49 39 c4 0f 84 e2 00
> > 00 00 48 b8 00 00 00 00 00 fc ff df 4c 89 e2 48 c1 ea 03 <80> 3c 02 00 75
> > 53 49 8b 14 24 4c 39 f2 0f 85 99 00 00 00 49 8d 7d
> > RSP: 0018:ffff888090a7f9d8 EFLAGS: 00010246
> > RAX: dffffc0000000000 RBX: ffff88809b6f90c0 RCX: ffffffff817c0ca9
> > RDX: 0000000000000000 RSI: ffffffff817c0a73 RDI: ffff88809b6f90c8
> > RBP: ffff888090a7f9f0 R08: ffff88809a04e600 R09: ffffed1015d26aed
> > R10: ffffed1015d26aec R11: ffff8880ae935763 R12: 0000000000000000
> > R13: 0000000000000000 R14: ffff88809b6f90c0 R15: ffff88809b6f90d0
> > FS: 0000555556f99880(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000
> > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> > CR2: 00000000006cc090 CR3: 00000000962b2000 CR4: 00000000001406e0
> > DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> > DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> > Call Trace:
> > __list_del_entry include/linux/list.h:131 [inline]
> > list_del_init include/linux/list.h:190 [inline]
> > trace_probe_unlink+0x1f/0x200 kernel/trace/trace_probe.c:959
> > trace_probe_cleanup+0xd3/0x110 kernel/trace/trace_probe.c:973
> > trace_probe_init+0x3f2/0x510 kernel/trace/trace_probe.c:1011
> > alloc_trace_uprobe+0x5e/0x250 kernel/trace/trace_uprobe.c:353
> > create_local_trace_uprobe+0x109/0x4a0 kernel/trace/trace_uprobe.c:1508
> > perf_uprobe_init+0x131/0x210 kernel/trace/trace_event_perf.c:314
> > perf_uprobe_event_init+0x106/0x1a0 kernel/events/core.c:8898
> > perf_try_init_event+0x135/0x590 kernel/events/core.c:10184
> > perf_init_event kernel/events/core.c:10228 [inline]
> > perf_event_alloc.part.0+0x1b89/0x33d0 kernel/events/core.c:10505
> > perf_event_alloc kernel/events/core.c:10887 [inline]
> > __do_sys_perf_event_open+0xa2d/0x2d00 kernel/events/core.c:10989
> > __se_sys_perf_event_open kernel/events/core.c:10871 [inline]
> > __x64_sys_perf_event_open+0xbe/0x150 kernel/events/core.c:10871
> > do_syscall_64+0xfa/0x760 arch/x86/entry/common.c:290
> > entry_SYSCALL_64_after_hwframe+0x49/0xbe
> >
> > Reported-by: syzbot+2f807f4d3a2a4e87f18f@syzkaller.appspotmail.com
> > Fixes: ca89bc071d5e ("tracing/kprobe: Add multi-probe per event support")
> > Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
>
> Thanks Masami. I was just about to get my pull request to Linus out,
> but will now add this and start running my tests with it.
Thanks Steve, and sorry, I found another issue on multiprobe. I'll send it soon.
Thank you,
--
Masami Hiramatsu <mhiramat@kernel.org>
prev parent reply other threads:[~2019-09-18 6:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-16 23:39 general protection fault in trace_probe_unlink syzbot
2019-09-17 5:11 ` [PATCH] tracing/kprobe: Fix NULL pointer access in trace_porbe_unlink() Masami Hiramatsu
2019-09-17 12:56 ` Steven Rostedt
2019-09-18 6:28 ` Masami Hiramatsu [this message]
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=20190918152840.fbbf3a874d09f0c8203c7148@kernel.org \
--to=mhiramat@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=syzkaller-bugs@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
all inboxes | Powered by JetHome®