1
0
Fork 0
alistair23-linux/tools/testing/selftests/bpf
Daniel Borkmann 20182390c4 bpf: fix replace_map_fd_with_map_ptr's ldimm64 second imm field
Non-zero imm value in the second part of the ldimm64 instruction for
BPF_PSEUDO_MAP_FD is invalid, and thus must be rejected. The map fd
only ever sits in the first instructions' imm field. None of the BPF
loaders known to us are using it, so risk of regression is minimal.
For clarity and consistency, the few insn->{src_reg,imm} occurrences
are rewritten into insn[0].{src_reg,imm}. Add a test case to the BPF
selftest suite as well.

Fixes: 0246e64d9a ("bpf: handle pseudo BPF_LD_IMM64 insn")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2019-03-07 08:47:13 -08:00
..
gnu selftests/bpf: get rid of -D__x86_64__ 2017-05-03 09:51:25 -04:00
include/uapi/linux License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
prog_tests selftests: bpf: test_progs: initialize duration in singal_pending test 2019-03-07 10:46:25 +01:00
progs tools/bpf: selftests: add map lookup to test_map_in_map bpf prog 2019-02-27 17:03:13 -08:00
verifier bpf: fix replace_map_fd_with_map_ptr's ldimm64 second imm field 2019-03-07 08:47:13 -08:00
.gitignore selftests/bpf: fix btf_dedup testing code 2019-03-01 01:31:47 +01:00
Makefile selftests: bpf: fix compilation with out-of-tree $(OUTPUT) 2019-03-07 10:44:32 +01:00
bpf_endian.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bpf_helpers.h bpf: sync bpf.h to tools and update bpf_helpers.h 2019-03-02 10:48:27 -08: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
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 btf_dedup test of FWD/STRUCT resolution 2019-03-01 01:31:48 +01: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 selftests/bpf: add a test for basic XDP functionality 2017-04-01 12:45:57 -07:00
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 selftests/bpf: set unlimited RLIMIT_MEMLOCK for test_sock_fields 2019-03-02 01:06:23 +01: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