diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/bpf/bpftool/main.c | 2 | ||||
| -rw-r--r-- | tools/bpf/bpftool/prog.c | 3 | ||||
| -rw-r--r-- | tools/lib/bpf/libbpf.c | 5 | ||||
| -rw-r--r-- | tools/testing/selftests/bpf/.gitignore | 1 | ||||
| -rw-r--r-- | tools/testing/selftests/bpf/test_maps.c | 2 | ||||
| -rw-r--r-- | tools/testing/selftests/bpf/test_tcpbpf_kern.c | 1 | ||||
| -rw-r--r-- | tools/testing/selftests/bpf/test_verifier.c | 26 |
7 files changed, 36 insertions, 4 deletions
diff --git a/tools/bpf/bpftool/main.c b/tools/bpf/bpftool/main.c index 3a0396d87c42..185acfa229b5 100644 --- a/tools/bpf/bpftool/main.c +++ b/tools/bpf/bpftool/main.c | |||
| @@ -244,7 +244,7 @@ static int do_batch(int argc, char **argv) | |||
| 244 | } | 244 | } |
| 245 | 245 | ||
| 246 | if (errno && errno != ENOENT) { | 246 | if (errno && errno != ENOENT) { |
| 247 | perror("reading batch file failed"); | 247 | p_err("reading batch file failed: %s", strerror(errno)); |
| 248 | err = -1; | 248 | err = -1; |
| 249 | } else { | 249 | } else { |
| 250 | p_info("processed %d lines", lines); | 250 | p_info("processed %d lines", lines); |
diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c index e8e2baaf93c2..e549e329be82 100644 --- a/tools/bpf/bpftool/prog.c +++ b/tools/bpf/bpftool/prog.c | |||
| @@ -774,6 +774,9 @@ static int do_dump(int argc, char **argv) | |||
| 774 | n < 0 ? strerror(errno) : "short write"); | 774 | n < 0 ? strerror(errno) : "short write"); |
| 775 | goto err_free; | 775 | goto err_free; |
| 776 | } | 776 | } |
| 777 | |||
| 778 | if (json_output) | ||
| 779 | jsonw_null(json_wtr); | ||
| 777 | } else { | 780 | } else { |
| 778 | if (member_len == &info.jited_prog_len) { | 781 | if (member_len == &info.jited_prog_len) { |
| 779 | const char *name = NULL; | 782 | const char *name = NULL; |
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 97073d649c1a..5bbbf285af74 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c | |||
| @@ -1060,11 +1060,12 @@ bpf_program__reloc_text(struct bpf_program *prog, struct bpf_object *obj, | |||
| 1060 | prog->insns = new_insn; | 1060 | prog->insns = new_insn; |
| 1061 | prog->main_prog_cnt = prog->insns_cnt; | 1061 | prog->main_prog_cnt = prog->insns_cnt; |
| 1062 | prog->insns_cnt = new_cnt; | 1062 | prog->insns_cnt = new_cnt; |
| 1063 | pr_debug("added %zd insn from %s to prog %s\n", | ||
| 1064 | text->insns_cnt, text->section_name, | ||
| 1065 | prog->section_name); | ||
| 1063 | } | 1066 | } |
| 1064 | insn = &prog->insns[relo->insn_idx]; | 1067 | insn = &prog->insns[relo->insn_idx]; |
| 1065 | insn->imm += prog->main_prog_cnt - relo->insn_idx; | 1068 | insn->imm += prog->main_prog_cnt - relo->insn_idx; |
| 1066 | pr_debug("added %zd insn from %s to prog %s\n", | ||
| 1067 | text->insns_cnt, text->section_name, prog->section_name); | ||
| 1068 | return 0; | 1069 | return 0; |
| 1069 | } | 1070 | } |
| 1070 | 1071 | ||
diff --git a/tools/testing/selftests/bpf/.gitignore b/tools/testing/selftests/bpf/.gitignore index cc15af2e54fe..9cf83f895d98 100644 --- a/tools/testing/selftests/bpf/.gitignore +++ b/tools/testing/selftests/bpf/.gitignore | |||
| @@ -11,3 +11,4 @@ test_progs | |||
| 11 | test_tcpbpf_user | 11 | test_tcpbpf_user |
| 12 | test_verifier_log | 12 | test_verifier_log |
| 13 | feature | 13 | feature |
| 14 | test_libbpf_open | ||
diff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c index 436c4c72414f..9e03a4c356a4 100644 --- a/tools/testing/selftests/bpf/test_maps.c +++ b/tools/testing/selftests/bpf/test_maps.c | |||
| @@ -126,6 +126,8 @@ static void test_hashmap_sizes(int task, void *data) | |||
| 126 | fd = bpf_create_map(BPF_MAP_TYPE_HASH, i, j, | 126 | fd = bpf_create_map(BPF_MAP_TYPE_HASH, i, j, |
| 127 | 2, map_flags); | 127 | 2, map_flags); |
| 128 | if (fd < 0) { | 128 | if (fd < 0) { |
| 129 | if (errno == ENOMEM) | ||
| 130 | return; | ||
| 129 | printf("Failed to create hashmap key=%d value=%d '%s'\n", | 131 | printf("Failed to create hashmap key=%d value=%d '%s'\n", |
| 130 | i, j, strerror(errno)); | 132 | i, j, strerror(errno)); |
| 131 | exit(1); | 133 | exit(1); |
diff --git a/tools/testing/selftests/bpf/test_tcpbpf_kern.c b/tools/testing/selftests/bpf/test_tcpbpf_kern.c index 57119ad57a3f..3e645ee41ed5 100644 --- a/tools/testing/selftests/bpf/test_tcpbpf_kern.c +++ b/tools/testing/selftests/bpf/test_tcpbpf_kern.c | |||
| @@ -5,7 +5,6 @@ | |||
| 5 | #include <linux/if_ether.h> | 5 | #include <linux/if_ether.h> |
| 6 | #include <linux/if_packet.h> | 6 | #include <linux/if_packet.h> |
| 7 | #include <linux/ip.h> | 7 | #include <linux/ip.h> |
| 8 | #include <linux/in6.h> | ||
| 9 | #include <linux/types.h> | 8 | #include <linux/types.h> |
| 10 | #include <linux/socket.h> | 9 | #include <linux/socket.h> |
| 11 | #include <linux/tcp.h> | 10 | #include <linux/tcp.h> |
diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c index c0f16e93f9bd..c73592fa3d41 100644 --- a/tools/testing/selftests/bpf/test_verifier.c +++ b/tools/testing/selftests/bpf/test_verifier.c | |||
| @@ -2587,6 +2587,32 @@ static struct bpf_test tests[] = { | |||
| 2587 | .result = ACCEPT, | 2587 | .result = ACCEPT, |
| 2588 | }, | 2588 | }, |
| 2589 | { | 2589 | { |
| 2590 | "runtime/jit: pass negative index to tail_call", | ||
| 2591 | .insns = { | ||
| 2592 | BPF_MOV64_IMM(BPF_REG_3, -1), | ||
| 2593 | BPF_LD_MAP_FD(BPF_REG_2, 0), | ||
| 2594 | BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, | ||
| 2595 | BPF_FUNC_tail_call), | ||
| 2596 | BPF_MOV64_IMM(BPF_REG_0, 0), | ||
| 2597 | BPF_EXIT_INSN(), | ||
| 2598 | }, | ||
| 2599 | .fixup_prog = { 1 }, | ||
| 2600 | .result = ACCEPT, | ||
| 2601 | }, | ||
| 2602 | { | ||
| 2603 | "runtime/jit: pass > 32bit index to tail_call", | ||
| 2604 | .insns = { | ||
| 2605 | BPF_LD_IMM64(BPF_REG_3, 0x100000000ULL), | ||
| 2606 | BPF_LD_MAP_FD(BPF_REG_2, 0), | ||
| 2607 | BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, | ||
| 2608 | BPF_FUNC_tail_call), | ||
| 2609 | BPF_MOV64_IMM(BPF_REG_0, 0), | ||
| 2610 | BPF_EXIT_INSN(), | ||
| 2611 | }, | ||
| 2612 | .fixup_prog = { 2 }, | ||
| 2613 | .result = ACCEPT, | ||
| 2614 | }, | ||
| 2615 | { | ||
| 2590 | "stack pointer arithmetic", | 2616 | "stack pointer arithmetic", |
| 2591 | .insns = { | 2617 | .insns = { |
| 2592 | BPF_MOV64_IMM(BPF_REG_1, 4), | 2618 | BPF_MOV64_IMM(BPF_REG_1, 4), |
