All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2][v5] Add the ability to do BPF directed error injection
@ 2017-11-07 20:28 Josef Bacik
  2017-11-07 20:28 ` [PATCH 1/2] bpf: add a bpf_override_function helper Josef Bacik
                   ` (3 more replies)
  0 siblings, 4 replies; 31+ messages in thread
From: Josef Bacik @ 2017-11-07 20:28 UTC (permalink / raw)
  To: rostedt, mingo, davem, netdev, linux-kernel, ast, kernel-team, daniel

I'm sending this through Dave since it'll conflict with other BPF changes in his
tree, but since it touches tracing as well Dave would like a review from
somebody on the tracing side.

v4->v5:
- disallow kprobe_override programs from being put in the prog map array so we
  don't tail call into something we didn't check.  This allows us to make the
  normal path still fast without a bunch of percpu operations.

v3->v4:
- fix a build error found by kbuild test bot (I didn't wait long enough
  apparently.)
- Added a warning message as per Daniels suggestion.

v2->v3:
- added a ->kprobe_override flag to bpf_prog.
- added some sanity checks to disallow attaching bpf progs that have
  ->kprobe_override set that aren't for ftrace kprobes.
- added the trace_kprobe_ftrace helper to check if the trace_event_call is a
  ftrace kprobe.
- renamed bpf_kprobe_state to bpf_kprobe_override, fixed it so we only read this
  value in the kprobe path, and thus only write to it if we're overriding or
  clearing the override.

v1->v2:
- moved things around to make sure that bpf_override_return could really only be
  used for an ftrace kprobe.
- killed the special return values from trace_call_bpf.
- renamed pc_modified to bpf_kprobe_state so bpf_override_return could tell if
  it was being called from an ftrace kprobe context.
- reworked the logic in kprobe_perf_func to take advantage of bpf_kprobe_state.
- updated the test as per Alexei's review.

- Original message -

A lot of our error paths are not well tested because we have no good way of
injecting errors generically.  Some subystems (block, memory) have ways to
inject errors, but they are random so it's hard to get reproduceable results.

With BPF we can add determinism to our error injection.  We can use kprobes and
other things to verify we are injecting errors at the exact case we are trying
to test.  This patch gives us the tool to actual do the error injection part.
It is very simple, we just set the return value of the pt_regs we're given to
whatever we provide, and then override the PC with a dummy function that simply
returns.

Right now this only works on x86, but it would be simple enough to expand to
other architectures.  Thanks,

Josef

^ permalink raw reply	[flat|nested] 31+ messages in thread
* [PATCH 0/2][v4] Add the ability to do BPF directed error injection
@ 2017-11-02 14:37 Josef Bacik
  2017-11-02 14:37 ` [PATCH 1/2] bpf: add a bpf_override_function helper Josef Bacik
  0 siblings, 1 reply; 31+ messages in thread
From: Josef Bacik @ 2017-11-02 14:37 UTC (permalink / raw)
  To: rostedt, mingo, davem, netdev, linux-kernel, ast, kernel-team, daniel

I'm sending this through Dave since it'll conflict with other BPF changes in his
tree, but since it touches tracing as well Dave would like a review from
somebody on the tracing side.

v3->v4:
- fix a build error found by kbuild test bot (I didn't wait long enough
  apparently.)
- Added a warning message as per Daniels suggestion.

v2->v3:
- added a ->kprobe_override flag to bpf_prog.
- added some sanity checks to disallow attaching bpf progs that have
  ->kprobe_override set that aren't for ftrace kprobes.
- added the trace_kprobe_ftrace helper to check if the trace_event_call is a
  ftrace kprobe.
- renamed bpf_kprobe_state to bpf_kprobe_override, fixed it so we only read this
  value in the kprobe path, and thus only write to it if we're overriding or
  clearing the override.

v1->v2:
- moved things around to make sure that bpf_override_return could really only be
  used for an ftrace kprobe.
- killed the special return values from trace_call_bpf.
- renamed pc_modified to bpf_kprobe_state so bpf_override_return could tell if
  it was being called from an ftrace kprobe context.
- reworked the logic in kprobe_perf_func to take advantage of bpf_kprobe_state.
- updated the test as per Alexei's review.

- Original message -

A lot of our error paths are not well tested because we have no good way of
injecting errors generically.  Some subystems (block, memory) have ways to
inject errors, but they are random so it's hard to get reproduceable results.

With BPF we can add determinism to our error injection.  We can use kprobes and
other things to verify we are injecting errors at the exact case we are trying
to test.  This patch gives us the tool to actual do the error injection part.
It is very simple, we just set the return value of the pt_regs we're given to
whatever we provide, and then override the PC with a dummy function that simply
returns.

Right now this only works on x86, but it would be simple enough to expand to
other architectures.  Thanks,

Josef

^ permalink raw reply	[flat|nested] 31+ messages in thread
* [PATCH 0/2][v3] Add the ability to do BPF directed error injection
@ 2017-11-01 17:00 Josef Bacik
  2017-11-01 17:00 ` [PATCH 1/2] bpf: add a bpf_override_function helper Josef Bacik
  0 siblings, 1 reply; 31+ messages in thread
From: Josef Bacik @ 2017-11-01 17:00 UTC (permalink / raw)
  To: rostedt, mingo, davem, netdev, linux-kernel, ast, kernel-team

I'm sending this through Dave since it'll conflict with other BPF changes in his
tree, but since it touches tracing as well Dave would like a review from
somebody on the tracing side.

v2->v3:
- added a ->kprobe_override flag to bpf_prog.
- added some sanity checks to disallow attaching bpf progs that have
  ->kprobe_override set that aren't for ftrace kprobes.
- added the trace_kprobe_ftrace helper to check if the trace_event_call is a
  ftrace kprobe.
- renamed bpf_kprobe_state to bpf_kprobe_override, fixed it so we only read this
  value in the kprobe path, and thus only write to it if we're overriding or
  clearing the override.

v1->v2:
- moved things around to make sure that bpf_override_return could really only be
  used for an ftrace kprobe.
- killed the special return values from trace_call_bpf.
- renamed pc_modified to bpf_kprobe_state so bpf_override_return could tell if
  it was being called from an ftrace kprobe context.
- reworked the logic in kprobe_perf_func to take advantage of bpf_kprobe_state.
- updated the test as per Alexei's review.

- Original message - 

A lot of our error paths are not well tested because we have no good way of
injecting errors generically.  Some subystems (block, memory) have ways to
inject errors, but they are random so it's hard to get reproduceable results.

With BPF we can add determinism to our error injection.  We can use kprobes and
other things to verify we are injecting errors at the exact case we are trying
to test.  This patch gives us the tool to actual do the error injection part.
It is very simple, we just set the return value of the pt_regs we're given to
whatever we provide, and then override the PC with a dummy function that simply
returns.

Right now this only works on x86, but it would be simple enough to expand to
other architectures.  Thanks,

Josef

^ permalink raw reply	[flat|nested] 31+ messages in thread
* [PATCH 0/2][v2] Add the ability to do BPF directed error injection
@ 2017-10-31 15:45 Josef Bacik
  2017-10-31 15:45 ` [PATCH 1/2] bpf: add a bpf_override_function helper Josef Bacik
  0 siblings, 1 reply; 31+ messages in thread
From: Josef Bacik @ 2017-10-31 15:45 UTC (permalink / raw)
  To: davem, netdev, linux-kernel, ast, kernel-team

v1->v2:
- moved things around to make sure that bpf_override_return could really only be
  used for an ftrace kprobe.
- killed the special return values from trace_call_bpf.
- renamed pc_modified to bpf_kprobe_state so bpf_override_return could tell if
  it was being called from an ftrace kprobe context.
- reworked the logic in kprobe_perf_func to take advantage of bpf_kprobe_state.
- updated the test as per Alexei's review.

A lot of our error paths are not well tested because we have no good way of
injecting errors generically.  Some subystems (block, memory) have ways to
inject errors, but they are random so it's hard to get reproduceable results.

With BPF we can add determinism to our error injection.  We can use kprobes and
other things to verify we are injecting errors at the exact case we are trying
to test.  This patch gives us the tool to actual do the error injection part.
It is very simple, we just set the return value of the pt_regs we're given to
whatever we provide, and then override the PC with a dummy function that simply
returns.

Right now this only works on x86, but it would be simple enough to expand to
other architectures.  Thanks,

Josef

^ permalink raw reply	[flat|nested] 31+ messages in thread
* [PATCH 0/2] Add the ability to do BPF directed error injection
@ 2017-10-30 21:19 Josef Bacik
  2017-10-30 21:19 ` [PATCH 1/2] bpf: add a bpf_override_function helper Josef Bacik
  0 siblings, 1 reply; 31+ messages in thread
From: Josef Bacik @ 2017-10-30 21:19 UTC (permalink / raw)
  To: davem, netdev, linux-kernel, ast, kernel-team

A lot of our error paths are not well tested because we have no good way of
injecting errors generically.  Some subystems (block, memory) have ways to
inject errors, but they are random so it's hard to get reproduceable results.

With BPF we can add determinism to our error injection.  We can use kprobes and
other things to verify we are injecting errors at the exact case we are trying
to test.  This patch gives us the tool to actual do the error injection part.
It is very simple, we just set the return value of the pt_regs we're given to
whatever we provide, and then override the PC with a dummy function that simply
returns.

Right now this only works on x86, but it would be simple enough to expand to
other architectures.  Thanks,

Josef

^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2017-11-15  7:35 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-07 20:28 [PATCH 0/2][v5] Add the ability to do BPF directed error injection Josef Bacik
2017-11-07 20:28 ` [PATCH 1/2] bpf: add a bpf_override_function helper Josef Bacik
2017-11-08  2:28   ` Daniel Borkmann
2017-11-10  9:34   ` Ingo Molnar
2017-11-10 17:14     ` Josef Bacik
2017-11-11  8:14       ` Ingo Molnar
2017-11-11 11:51         ` Josef Bacik
2017-11-12  6:49         ` Alexei Starovoitov
2017-11-12 10:38           ` Ingo Molnar
2017-11-13 15:57             ` Josef Bacik
2017-11-15  7:34               ` Ingo Molnar
2017-11-07 20:28 ` [PATCH 2/2] samples/bpf: add a test for bpf_override_return Josef Bacik
2017-11-08  2:29   ` Daniel Borkmann
2017-11-07 21:43 ` [PATCH 0/2][v5] Add the ability to do BPF directed error injection Alexei Starovoitov
2017-11-10  9:06   ` David Miller
2017-11-10  9:20   ` Peter Zijlstra
2017-11-11  3:18 ` David Miller
2017-11-11  8:16   ` Ingo Molnar
2017-11-11  9:25     ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2017-11-02 14:37 [PATCH 0/2][v4] " Josef Bacik
2017-11-02 14:37 ` [PATCH 1/2] bpf: add a bpf_override_function helper Josef Bacik
2017-11-02 23:12   ` Daniel Borkmann
2017-11-03 14:31     ` Josef Bacik
2017-11-03 16:52       ` Daniel Borkmann
2017-11-03 21:07         ` Alexei Starovoitov
2017-11-01 17:00 [PATCH 0/2][v3] Add the ability to do BPF directed error injection Josef Bacik
2017-11-01 17:00 ` [PATCH 1/2] bpf: add a bpf_override_function helper Josef Bacik
2017-11-01 17:18   ` Alexei Starovoitov
2017-11-02  1:08   ` Daniel Borkmann
2017-10-31 15:45 [PATCH 0/2][v2] Add the ability to do BPF directed error injection Josef Bacik
2017-10-31 15:45 ` [PATCH 1/2] bpf: add a bpf_override_function helper Josef Bacik
2017-11-01  4:47   ` Alexei Starovoitov
2017-10-30 21:19 [PATCH 0/2] Add the ability to do BPF directed error injection Josef Bacik
2017-10-30 21:19 ` [PATCH 1/2] bpf: add a bpf_override_function helper Josef Bacik
2017-10-31  1:35   ` Alexei Starovoitov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.