netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/2] bpf: add bpf_probe_write helper & example
@ 2016-07-22  1:08 Sargun Dhillon
  0 siblings, 0 replies; only message in thread
From: Sargun Dhillon @ 2016-07-22  1:08 UTC (permalink / raw)
  To: linux-kernel, netdev; +Cc: alexei.starovoitov, daniel

This patch series contains two patches that add support for a probe_write
helper to BPF programs. This allows them to manipulate user memory during
the course of tracing. The second patch in the series has an example that
uses it, in one the intended ways to divert execution.

Thanks to Alexei Starovoitov, and Daniel Borkmann for review, I've made 
changes based on their recommendations.

This helper should be considered experimental, so we print a warning
to dmesg when it is first invoked. Subsequent invocations print the 
command and pid

---
v1->v2: restrict writing to user space, as opposed to globally
v2->v3: Fixed formatting issues
v3->v4: Rename copy_to_user -> bpf_probe_write
	Simplify checking of whether or not it's safe to write
	Add warnings to dmesg

Sargun Dhillon (2):
  bpf: Add bpf_probe_write BPF helper to be called in tracers (kprobes)
  samples/bpf: Add example of using bpf_probe_write in bpf kprobes

 include/uapi/linux/bpf.h   | 12 ++++++++
 kernel/bpf/verifier.c      |  9 ++++++
 kernel/trace/bpf_trace.c   | 37 +++++++++++++++++++++++
 samples/bpf/Makefile       |  4 +++
 samples/bpf/bpf_helpers.h  |  2 ++
 samples/bpf/tracex7_kern.c | 51 +++++++++++++++++++++++++++++++
 samples/bpf/tracex7_user.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 190 insertions(+)
 create mode 100644 samples/bpf/tracex7_kern.c
 create mode 100644 samples/bpf/tracex7_user.c

-- 
2.7.4

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-07-22  1:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-22  1:08 [PATCH v4 0/2] bpf: add bpf_probe_write helper & example Sargun Dhillon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).