remarkable-linux/samples
Alexei Starovoitov 3c731eba48 bpf: mini eBPF library, test stubs and verifier testsuite
1.
the library includes a trivial set of BPF syscall wrappers:
int bpf_create_map(int key_size, int value_size, int max_entries);
int bpf_update_elem(int fd, void *key, void *value);
int bpf_lookup_elem(int fd, void *key, void *value);
int bpf_delete_elem(int fd, void *key);
int bpf_get_next_key(int fd, void *key, void *next_key);
int bpf_prog_load(enum bpf_prog_type prog_type,
		  const struct sock_filter_int *insns, int insn_len,
		  const char *license);
bpf_prog_load() stores verifier log into global bpf_log_buf[] array

and BPF_*() macros to build instructions

2.
test stubs configure eBPF infra with 'unspec' map and program types.
These are fake types used by user space testsuite only.

3.
verifier tests valid and invalid programs and expects predefined
error log messages from kernel.
40 tests so far.

$ sudo ./test_verifier
 #0 add+sub+mul OK
 #1 unreachable OK
 #2 unreachable2 OK
 #3 out of range jump OK
 #4 out of range jump2 OK
 #5 test1 ld_imm64 OK
 ...

Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2014-09-26 15:05:15 -04:00
..
bpf bpf: mini eBPF library, test stubs and verifier testsuite 2014-09-26 15:05:15 -04:00
hidraw HID: samples/hidraw: add .gitignore file 2013-08-20 12:48:58 +02: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/: avoid world-writable sysfs files. 2014-05-14 10:53:57 +09:30
kprobes tile: support kprobes on tilegx 2013-08-30 11:55:53 -04:00
rpmsg misc: remove __dev* attributes. 2013-01-03 15:57:16 -08:00
seccomp samples/seccomp/Makefile: do not build tests if cross-compiling for MIPS 2014-04-03 16:21:06 -07:00
trace_events tracing: Change trace event sample to use strlcpy instead of strncpy 2014-07-01 07:13:33 -04:00
uhid HID: uhid: improve uhid example client 2013-09-04 11:35:14 +02:00
Kconfig tracing: Remove tracepoint sample code 2013-01-25 11:22:11 -05:00
Makefile tracing: Remove tracepoint sample code 2013-01-25 11:22:11 -05:00