linux-stable/tools/testing/selftests/bpf
Jakub Kicinski 83d163124c bpf: verifier: propagate liveness on all frames
Commit 7640ead939 ("bpf: verifier: make sure callees don't prune
with caller differences") connected up parentage chains of all
frames of the stack.  It didn't, however, ensure propagate_liveness()
propagates all liveness information along those chains.

This means pruning happening in the callee may generate explored
states with incomplete liveness for the chains in lower frames
of the stack.

The included selftest is similar to the prior one from commit
7640ead939 ("bpf: verifier: make sure callees don't prune with
caller differences"), where callee would prune regardless of the
difference in r8 state.

Now we also initialize r9 to 0 or 1 based on a result from get_random().
r9 is never read so the walk with r9 = 0 gets pruned (correctly) after
the walk with r9 = 1 completes.

The selftest is so arranged that the pruning will happen in the
callee.  Since callee does not propagate read marks of r8, the
explored state at the pruning point prior to the callee will
now ignore r8.

Propagate liveness on all frames of the stack when pruning.

Fixes: f4d7e40a5b ("bpf: introduce function calls (verification)")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2019-03-21 19:57:02 -07:00
..
gnu
include/uapi/linux
prog_tests selftests/bpf: fix segfault of test_progs when prog loading failed 2019-03-12 21:55:54 +01:00
progs bpf: Add an example for bpf_get_listener_sock 2019-03-13 12:04:35 -07:00
verifier bpf: verifier: propagate liveness on all frames 2019-03-21 19:57:02 -07:00
.gitignore selftests/bpf: fix btf_dedup testing code 2019-03-01 01:31:47 +01:00
bpf_endian.h
bpf_helpers.h bpf: Add an example for bpf_get_listener_sock 2019-03-13 12:04:35 -07:00
bpf_rand.h bpf: add ld64 imm test cases 2018-05-14 19:11:45 -07:00
bpf_rlimit.h bpf: unify rlimit handling in selftests 2018-02-26 20:11:23 -08:00
bpf_util.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2019-02-16 22:56:34 -08:00
cgroup_helpers.c selftests/bpf: fix incorrect users of create_and_get_cgroup 2019-01-07 13:15:55 -08:00
cgroup_helpers.h selftests/bpf: Fix const'ness in cgroup_helpers 2018-07-15 00:08:41 +02:00
config selftests/bpf: add config fragment CONFIG_FTRACE_SYSCALLS 2018-11-28 22:13:06 +01:00
flow_dissector_load.c selftests/bpf: add simple BPF_PROG_TEST_RUN examples for flow dissector 2019-01-29 01:08:29 +01:00
flow_dissector_load.h selftests/bpf: add simple BPF_PROG_TEST_RUN examples for flow dissector 2019-01-29 01:08:29 +01:00
get_cgroup_id_user.c tools/bpf: fix selftest get_cgroup_id_user 2018-06-08 00:10:07 +02:00
Makefile selftests: bpf: fix compilation with out-of-tree $(OUTPUT) 2019-03-07 10:44:32 +01:00
netcnt_common.h selftests/bpf: cgroup local storage-based network counters 2018-10-01 16:18:33 +02:00
tcp_client.py selftests/bpf: use localhost in tcp_{server,client}.py 2019-02-04 21:29:27 +01:00
tcp_server.py selftests/bpf: use localhost in tcp_{server,client}.py 2019-02-04 21:29:27 +01:00
test_align.c bpf: Add BPF_F_ANY_ALIGNMENT. 2018-11-30 21:38:48 -08:00
test_btf.c selftests/bpf: add fwd enum resolution test for btf_dedup 2019-03-14 13:53:18 -07:00
test_cgroup_storage.c selftests/bpf: fix incorrect users of create_and_get_cgroup 2019-01-07 13:15:55 -08:00
test_dev_cgroup.c selftests/bpf: fix incorrect users of create_and_get_cgroup 2019-01-07 13:15:55 -08:00
test_flow_dissector.c selftests: bpf: remove duplicated include 2019-01-29 00:09:26 +01:00
test_flow_dissector.sh selftests/bpf: rename flow dissector section to flow_dissector 2018-11-10 15:56:10 -08:00
test_iptunnel_common.h
test_kmod.sh selftests: bpf: notification about privilege required to run test_kmod.sh testing script 2018-06-22 00:30:02 +02:00
test_libbpf.sh selftests/bpf: enable (uncomment) all tests in test_libbpf.sh 2018-11-07 22:20:56 +01:00
test_libbpf_open.c tools: libbpf: add a correctly named define for map iteration 2019-03-01 00:53:45 +01:00
test_lirc_mode2.sh media: bpf: add bpf function to report mouse movement 2018-12-09 14:37:18 -08:00
test_lirc_mode2_user.c media: bpf: add bpf function to report mouse movement 2018-12-09 14:37:18 -08:00
test_lpm_map.c bpf, lpm: fix lookup bug in map_delete_elem 2019-02-22 16:17:53 +01:00
test_lru_map.c bpf: unify rlimit handling in selftests 2018-02-26 20:11:23 -08:00
test_lwt_ip_encap.sh selftests/bpf: test that GSO works in lwt_ip_encap 2019-03-07 10:41:40 +01:00
test_lwt_seg6local.sh selftests/bpf: update test_lwt_seg6local.sh according to iproute2 2018-08-03 10:19:33 +02:00
test_maps.c bpf: test_maps: fix possible out of bound access warning 2019-02-06 15:48:43 +01:00
test_netcnt.c selftests/bpf: fix incorrect users of create_and_get_cgroup 2019-01-07 13:15:55 -08:00
test_offload.py selftests/bpf: test reading the offloaded program 2019-02-06 15:35:42 +01:00
test_progs.c selftests: bpf: break up test_progs - misc 2019-03-02 11:10:40 -08:00
test_progs.h selftests: bpf: break up test_progs - misc 2019-03-02 11:10:40 -08:00
test_queue_stack_map.h selftests/bpf: add test cases for queue and stack maps 2018-10-19 13:24:31 -07:00
test_section_names.c selftests/bpf: Test libbpf_{prog,attach}_type_by_name 2018-09-27 21:14:59 +02:00
test_select_reuseport.c bpf: Test BPF_PROG_TYPE_SK_REUSEPORT 2018-08-11 01:58:46 +02:00
test_select_reuseport_common.h bpf: Test BPF_PROG_TYPE_SK_REUSEPORT 2018-08-11 01:58:46 +02:00
test_skb_cgroup_id.sh kselftests/bpf: use ping6 as the default ipv6 ping binary if it exists 2018-10-31 23:05:30 +01:00
test_skb_cgroup_id_user.c selftests/bpf: fix incorrect users of create_and_get_cgroup 2019-01-07 13:15:55 -08:00
test_sock.c tools/bpf: add log_level to bpf_load_program_attr 2019-02-07 18:22:31 -08:00
test_sock_addr.c selftests/bpf: fix incorrect users of create_and_get_cgroup 2019-01-07 13:15:55 -08:00
test_sock_addr.sh kselftests/bpf: use ping6 as the default ipv6 ping binary if it exists 2018-10-31 23:05:30 +01:00
test_sock_fields.c bpf: Add an example for bpf_get_listener_sock 2019-03-13 12:04:35 -07:00
test_socket_cookie.c libbpf: Show supported ELF section names when failing to guess prog/attach type 2019-01-23 12:27:04 +01:00
test_sockmap.c selftests: bpf: remove duplicated include 2019-01-29 00:09:26 +01:00
test_sockmap_kern.h bpf: test_sockmap, add options for msg_pop_data() helper 2018-11-28 22:07:57 +01:00
test_tag.c bpf: unify rlimit handling in selftests 2018-02-26 20:11:23 -08:00
test_tcpbpf.h selftests/bpf: Test case for BPF_SOCK_OPS_TCP_LISTEN_CB 2018-07-15 00:08:41 +02:00
test_tcpbpf_user.c selftests/bpf: fix incorrect users of create_and_get_cgroup 2019-01-07 13:15:55 -08:00
test_tcpnotify.h selftests/bpf: add a test case for sock_ops perf-event notification 2018-11-09 09:40:17 +01:00
test_tcpnotify_user.c selftests/bpf: don't hardcode iptables/nc path in test_tcpnotify_user 2019-01-23 12:56:30 +01:00
test_tunnel.sh bpf, selftests: delete xfrm tunnel when test exits. 2018-06-15 03:31:52 +02:00
test_verifier.c selftests/bpf: add bpf_spin_lock verifier tests 2019-02-01 20:55:39 +01:00
test_verifier_log.c bpf: unify rlimit handling in selftests 2018-02-26 20:11:23 -08:00
test_xdp_meta.sh tools/bpf: fix batch-mode test failure of test_xdp_redirect.sh 2018-02-06 11:34:42 +01:00
test_xdp_redirect.sh tools/bpf: fix batch-mode test failure of test_xdp_redirect.sh 2018-02-06 11:34:42 +01:00
test_xdp_vlan.sh selftests/bpf: add XDP selftests for modifying and popping VLAN headers 2018-10-09 21:59:09 -07:00
trace_helpers.c bpf, libbpf: simplify and cleanup perf ring buffer walk 2018-10-20 23:13:32 -07:00
trace_helpers.h trace_helpers.c: Add helpers to poll multiple perf FDs for events 2018-06-27 11:01:03 +02:00
urandom_read.c bpf: add selftest for stackmap with build_id in NMI context 2018-05-14 23:29:45 +02:00
with_addr.sh selftests/bpf: test bpf flow dissection 2018-09-14 12:04:33 -07:00
with_tunnels.sh selftests/bpf: test bpf flow dissection 2018-09-14 12:04:33 -07:00