From: Ingo Molnar <mingo@kernel.org>
To: Song Liu <songliubraving@fb.com>
Cc: Vince Weaver <vincent.weaver@maine.edu>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: perf: fuzzer leads to trace_kprobe: Could not insert message flood
Date: Thu, 12 Apr 2018 09:52:20 +0200 [thread overview]
Message-ID: <20180412075220.l7lqhk3qn4sobfz7@gmail.com> (raw)
In-Reply-To: <C0B2EFB5-C403-4BDB-9046-C14B3EE66999@fb.com>
* Song Liu <songliubraving@fb.com> wrote:
> > spamming the kernel log ...
>
> Yeah, the new API allows non-root user to trigger this message. We should only
> allow root to create kprobe with perf_event_open().
>
> On the other hand, do we need to fix this for root? In fact, a simple bash loop
> can create something similar through the text interface (with root):
>
> root@virt-test:~# for x in {0..5} ; do echo p:xx xx+$x >> /sys/kernel/debug/tracing/kprobe_events ; done
> -bash: echo: write error: No such file or directory
> -bash: echo: write error: No such file or directory
> -bash: echo: write error: No such file or directory
> -bash: echo: write error: No such file or directory
> -bash: echo: write error: No such file or directory
> -bash: echo: write error: No such file or directory
> root@virt-test:~# dmesg | tail -n 5
> [ 664.208374] trace_kprobe: Could not insert probe at xx+1: -2
> [ 664.237882] trace_kprobe: Could not insert probe at xx+2: -2
> [ 664.268067] trace_kprobe: Could not insert probe at xx+3: -2
> [ 664.297395] trace_kprobe: Could not insert probe at xx+4: -2
> [ 664.327614] trace_kprobe: Could not insert probe at xx+5: -2
>
> This happens before the new API is introduced.
>
> The following patch does capable(CAP_SYS_ADMIN) for perf_kprobe and
> perf_uprobe at an earlier stage, so non-root user cannot trigger
> this error message. Please let me know whether we need to fix this
> for root.
That's two bugs then, and yes, I think we should fix the log spamming: what's the
point? We already get an error code from the write.
I'll apply your CAP_SYS_ADMIN fix.
Thanks,
Ingo
next prev parent reply other threads:[~2018-04-12 7:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-10 14:48 Vince Weaver
2018-04-10 19:57 ` Song Liu
2018-04-11 12:04 ` Ingo Molnar
2018-04-11 18:02 ` Song Liu
2018-04-12 7:52 ` Ingo Molnar [this message]
2018-04-12 7:53 ` Ingo Molnar
2018-04-12 9:22 ` [tip:perf/urgent] perf/core: Need CAP_SYS_ADMIN to create k/uprobe with perf_event_open() tip-bot for Song Liu
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=20180412075220.l7lqhk3qn4sobfz7@gmail.com \
--to=mingo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=songliubraving@fb.com \
--cc=vincent.weaver@maine.edu \
/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®