• Sargun Dhillon's avatar
    samples/bpf: Add test/example of using bpf_probe_write_user bpf helper · cf9b1199
    Sargun Dhillon authored
    This example shows using a kprobe to act as a dnat mechanism to divert
    traffic for arbitrary endpoints. It rewrite the arguments to a syscall
    while they're still in userspace, and before the syscall has a chance
    to copy the argument into kernel space.
    
    Although this is an example, it also acts as a test because the mapped
    address is 255.255.255.255:555 -> real address, and that's not a legal
    address to connect to. If the helper is broken, the example will fail
    on the intermediate steps, as well as the final step to verify the
    rewrite of userspace memory succeeded.
    Signed-off-by: default avatarSargun Dhillon <sargun@sargun.me>
    Cc: Alexei Starovoitov <ast@kernel.org>
    Cc: Daniel Borkmann <daniel@iogearbox.net>
    Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    cf9b1199
Name
Last commit
Last update
..
Makefile Loading commit data...
README.rst Loading commit data...
bpf_helpers.h Loading commit data...
bpf_load.c Loading commit data...
bpf_load.h Loading commit data...
fds_example.c Loading commit data...
lathist_kern.c Loading commit data...
lathist_user.c Loading commit data...
libbpf.c Loading commit data...
libbpf.h Loading commit data...
map_perf_test_kern.c Loading commit data...
map_perf_test_user.c Loading commit data...
offwaketime_kern.c Loading commit data...
offwaketime_user.c Loading commit data...
parse_ldabs.c Loading commit data...
parse_simple.c Loading commit data...
parse_varlen.c Loading commit data...
sock_example.c Loading commit data...
sockex1_kern.c Loading commit data...
sockex1_user.c Loading commit data...
sockex2_kern.c Loading commit data...
sockex2_user.c Loading commit data...
sockex3_kern.c Loading commit data...
sockex3_user.c Loading commit data...
spintest_kern.c Loading commit data...
spintest_user.c Loading commit data...
tcbpf1_kern.c Loading commit data...
test_cgrp2_array_pin.c Loading commit data...
test_cgrp2_tc.sh Loading commit data...
test_cgrp2_tc_kern.c Loading commit data...
test_cls_bpf.sh Loading commit data...
test_maps.c Loading commit data...
test_overhead_kprobe_kern.c Loading commit data...
test_overhead_tp_kern.c Loading commit data...
test_overhead_user.c Loading commit data...
test_probe_write_user_kern.c Loading commit data...
test_probe_write_user_user.c Loading commit data...
test_verifier.c Loading commit data...
trace_output_kern.c Loading commit data...
trace_output_user.c Loading commit data...
tracex1_kern.c Loading commit data...
tracex1_user.c Loading commit data...
tracex2_kern.c Loading commit data...
tracex2_user.c Loading commit data...
tracex3_kern.c Loading commit data...
tracex3_user.c Loading commit data...
tracex4_kern.c Loading commit data...
tracex4_user.c Loading commit data...
tracex5_kern.c Loading commit data...
tracex5_user.c Loading commit data...
tracex6_kern.c Loading commit data...
tracex6_user.c Loading commit data...
xdp1_kern.c Loading commit data...
xdp1_user.c Loading commit data...
xdp2_kern.c Loading commit data...