Re: [RFC PATCH] panic: Add new taint flag for fault injection

From: Steven Rostedt
Date: Thu Dec 01 2022 - 16:25:34 EST


On Thu, 1 Dec 2022 16:00:03 -0500
Chris Mason <clm@xxxxxxxx> wrote:

> On 12/1/22 2:14 PM, Steven Rostedt wrote:
> > On Thu, 1 Dec 2022 08:53:02 -0800
> > Kees Cook <keescook@xxxxxxxxxxxx> wrote:
> >
> >>> Have you not been reading this thread?
> >>
> >> I skimmed it -- trying to catch up from turkey week. If this was already
> >> covered, then please ignore me. It just wasn't obvious from the commit
> >> log why it was included.
> >
> > That's a better request :-)
> >
> > That is, please add why this is needed for BPF (and also include a Link:
> > tag to this thread).
>
> Sorry, I'm completely failing to parse. Is this directed at Kees or
> Benjamin? I'm also not sure what the this is in "why this is needed for
> BPF"?
>

It was directed towards Kees. I don't even know who "Benjamin" is. I don't
see a "Benjamin" in the Cc list.

And "this" is for:

--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -2137,6 +2137,8 @@ int perf_event_attach_bpf_prog(struct perf_event *event,
goto unlock;

/* set the new array to event->tp_event and set event->prog */
+ if (prog->kprobe_override)
+ add_taint(TAINT_FAULT_INJECTED, LOCKDEP_NOW_UNRELIABLE);
event->prog = prog;
event->bpf_cookie = bpf_cookie;
rcu_assign_pointer(event->tp_event->prog_array, new_array);

-- Steve