linux-IllusionX/samples
Sargun Dhillon 96ae522795 bpf: Add bpf_probe_write_user BPF helper to be called in tracers
This allows user memory to be written to during the course of a kprobe.
It shouldn't be used to implement any kind of security mechanism
because of TOC-TOU attacks, but rather to debug, divert, and
manipulate execution of semi-cooperative processes.

Although it uses probe_kernel_write, we limit the address space
the probe can write into by checking the space with access_ok.
We do this as opposed to calling copy_to_user directly, in order
to avoid sleeping. In addition we ensure the threads's current fs
/ segment is USER_DS and the thread isn't exiting nor a kernel thread.

Given this feature is meant for experiments, and it has a risk of
crashing the system, and running programs, we print a warning on
when a proglet that attempts to use this helper is installed,
along with the pid and process name.

Signed-off-by: Sargun Dhillon <sargun@sargun.me>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-25 18:07:48 -07:00
..
bpf bpf: Add bpf_probe_write_user BPF helper to be called in tracers 2016-07-25 18:07:48 -07:00
configfs configfs: remove old API 2015-10-13 22:17:57 -07:00
connector samples: connector: from Documentation to samples directory 2016-04-28 07:47:35 -06:00
hidraw HID: samples/hidraw: make it possible to select device 2015-03-15 10:11:21 -04:00
hw_breakpoint perf: Add context field to perf_event 2011-07-01 11:06:38 +02:00
kdb kdb: Add kdb kernel module sample 2010-10-29 13:14:39 -05:00
kfifo kfifo API type safety 2013-11-15 09:32:23 +09:00
kobject samples/kobject: be explicit in the module license 2015-03-25 13:41:42 +01:00
kprobes samples/kprobes: print out the symbol name for the hooks 2016-05-20 17:58:30 -07:00
livepatch livepatch: reuse module loader code to write relocations 2016-04-01 15:00:11 +02:00
pktgen samples: Add an IPv6 '-6' option to the pktgen scripts 2016-07-20 22:16:02 -07:00
rpmsg rpmsg: use module_rpmsg_driver in existing drivers and examples 2016-05-06 11:09:01 -07:00
seccomp samples/seccomp: improve label helper 2015-02-17 14:34:55 -08:00
trace_events Sample: Trace_event: Correct the comments 2015-11-02 14:09:15 -05:00
uhid HID: uhid: improve uhid example client 2013-09-04 11:35:14 +02:00
v4l [media] samples: v4l: from Documentation to samples directory 2016-05-09 18:34:37 -03:00
Kconfig samples: connector: from Documentation to samples directory 2016-04-28 07:47:35 -06:00
Makefile [media] samples: v4l: from Documentation to samples directory 2016-05-09 18:34:37 -03:00