aboutsummaryrefslogtreecommitdiffstats
path: root/net/bpf/test_run.c
diff options
context:
space:
mode:
authorMatt Mullins <mmullins@fb.com>2019-04-26 14:49:51 -0400
committerAlexei Starovoitov <ast@kernel.org>2019-04-26 22:04:19 -0400
commite950e843367d7990b9d7ea964e3c33876d477c4b (patch)
tree9fe461c7f01adec95c4f66d9a4748afa3348643b /net/bpf/test_run.c
parent4635b0ae4d26f87cf68dbab6740955dd1ad67cf4 (diff)
selftests: bpf: test writable buffers in raw tps
This tests that: * a BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE cannot be attached if it uses either: * a variable offset to the tracepoint buffer, or * an offset beyond the size of the tracepoint buffer * a tracer can modify the buffer provided when attached to a writable tracepoint in bpf_prog_test_run Signed-off-by: Matt Mullins <mmullins@fb.com> Acked-by: Yonghong Song <yhs@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'net/bpf/test_run.c')
-rw-r--r--net/bpf/test_run.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
index 8606e5aef0b6..6c4694ae4241 100644
--- a/net/bpf/test_run.c
+++ b/net/bpf/test_run.c
@@ -13,6 +13,9 @@
13#include <net/sock.h> 13#include <net/sock.h>
14#include <net/tcp.h> 14#include <net/tcp.h>
15 15
16#define CREATE_TRACE_POINTS
17#include <trace/events/bpf_test_run.h>
18
16static int bpf_test_run(struct bpf_prog *prog, void *ctx, u32 repeat, 19static int bpf_test_run(struct bpf_prog *prog, void *ctx, u32 repeat,
17 u32 *retval, u32 *time) 20 u32 *retval, u32 *time)
18{ 21{
@@ -100,6 +103,7 @@ static int bpf_test_finish(const union bpf_attr *kattr,
100 if (err != -ENOSPC) 103 if (err != -ENOSPC)
101 err = 0; 104 err = 0;
102out: 105out:
106 trace_bpf_test_finish(&err);
103 return err; 107 return err;
104} 108}
105 109