lkml.org 
[lkml]   [2018]   [Apr]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: perf: fuzzer leads to trace_kprobe: Could not insert message flood

* 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

\
 
 \ /
  Last update: 2018-04-12 09:53    [W:0.071 / U:0.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site