diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-07-30 04:04:58 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-07-30 04:04:58 -0400 |
commit | 8a7b5d0f75f757fa88b0d17c19523161b27b8e80 (patch) | |
tree | 54a3e7f1f995583ed924ff32cf5dacc800119800 /tools | |
parent | 7bab01ecc6c43da882333c6db39741cb43677004 (diff) | |
parent | acb1872577b346bd15ab3a3f8dff780d6cca4b70 (diff) |
Merge 4.18-rc7 into usb-next
We want the USB fixes in here as well to handle merge issues.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/bpf/bpftool/common.c | 11 | ||||
-rw-r--r-- | tools/objtool/elf.c | 6 | ||||
-rw-r--r-- | tools/testing/selftests/bpf/Makefile | 2 | ||||
-rw-r--r-- | tools/testing/selftests/bpf/test_verifier.c | 63 | ||||
-rw-r--r-- | tools/testing/selftests/ftrace/test.d/00basic/snapshot.tc | 28 | ||||
-rwxr-xr-x | tools/testing/selftests/net/fib_tests.sh | 41 | ||||
-rwxr-xr-x | tools/testing/selftests/net/udpgso_bench.sh | 3 |
7 files changed, 103 insertions, 51 deletions
diff --git a/tools/bpf/bpftool/common.c b/tools/bpf/bpftool/common.c index 32f9e397a6c0..3f140eff039f 100644 --- a/tools/bpf/bpftool/common.c +++ b/tools/bpf/bpftool/common.c | |||
@@ -217,6 +217,14 @@ int do_pin_any(int argc, char **argv, int (*get_fd_by_id)(__u32)) | |||
217 | int err; | 217 | int err; |
218 | int fd; | 218 | int fd; |
219 | 219 | ||
220 | if (argc < 3) { | ||
221 | p_err("too few arguments, id ID and FILE path is required"); | ||
222 | return -1; | ||
223 | } else if (argc > 3) { | ||
224 | p_err("too many arguments"); | ||
225 | return -1; | ||
226 | } | ||
227 | |||
220 | if (!is_prefix(*argv, "id")) { | 228 | if (!is_prefix(*argv, "id")) { |
221 | p_err("expected 'id' got %s", *argv); | 229 | p_err("expected 'id' got %s", *argv); |
222 | return -1; | 230 | return -1; |
@@ -230,9 +238,6 @@ int do_pin_any(int argc, char **argv, int (*get_fd_by_id)(__u32)) | |||
230 | } | 238 | } |
231 | NEXT_ARG(); | 239 | NEXT_ARG(); |
232 | 240 | ||
233 | if (argc != 1) | ||
234 | usage(); | ||
235 | |||
236 | fd = get_fd_by_id(id); | 241 | fd = get_fd_by_id(id); |
237 | if (fd < 0) { | 242 | if (fd < 0) { |
238 | p_err("can't get prog by id (%u): %s", id, strerror(errno)); | 243 | p_err("can't get prog by id (%u): %s", id, strerror(errno)); |
diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index 0d1acb704f64..7ec85d567598 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c | |||
@@ -519,10 +519,12 @@ struct section *elf_create_section(struct elf *elf, const char *name, | |||
519 | sec->sh.sh_flags = SHF_ALLOC; | 519 | sec->sh.sh_flags = SHF_ALLOC; |
520 | 520 | ||
521 | 521 | ||
522 | /* Add section name to .shstrtab */ | 522 | /* Add section name to .shstrtab (or .strtab for Clang) */ |
523 | shstrtab = find_section_by_name(elf, ".shstrtab"); | 523 | shstrtab = find_section_by_name(elf, ".shstrtab"); |
524 | if (!shstrtab) | ||
525 | shstrtab = find_section_by_name(elf, ".strtab"); | ||
524 | if (!shstrtab) { | 526 | if (!shstrtab) { |
525 | WARN("can't find .shstrtab section"); | 527 | WARN("can't find .shstrtab or .strtab section"); |
526 | return NULL; | 528 | return NULL; |
527 | } | 529 | } |
528 | 530 | ||
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index 7a6214e9ae58..a362e3d7abc6 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile | |||
@@ -105,7 +105,7 @@ $(OUTPUT)/test_xdp_noinline.o: CLANG_FLAGS += -fno-inline | |||
105 | 105 | ||
106 | BTF_LLC_PROBE := $(shell $(LLC) -march=bpf -mattr=help 2>&1 | grep dwarfris) | 106 | BTF_LLC_PROBE := $(shell $(LLC) -march=bpf -mattr=help 2>&1 | grep dwarfris) |
107 | BTF_PAHOLE_PROBE := $(shell $(BTF_PAHOLE) --help 2>&1 | grep BTF) | 107 | BTF_PAHOLE_PROBE := $(shell $(BTF_PAHOLE) --help 2>&1 | grep BTF) |
108 | BTF_OBJCOPY_PROBE := $(shell $(LLVM_OBJCOPY) --version 2>&1 | grep LLVM) | 108 | BTF_OBJCOPY_PROBE := $(shell $(LLVM_OBJCOPY) --help 2>&1 | grep -i 'usage.*llvm') |
109 | 109 | ||
110 | ifneq ($(BTF_LLC_PROBE),) | 110 | ifneq ($(BTF_LLC_PROBE),) |
111 | ifneq ($(BTF_PAHOLE_PROBE),) | 111 | ifneq ($(BTF_PAHOLE_PROBE),) |
diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c index 2ecd27b670d7..41106d9d5cc7 100644 --- a/tools/testing/selftests/bpf/test_verifier.c +++ b/tools/testing/selftests/bpf/test_verifier.c | |||
@@ -4975,6 +4975,24 @@ static struct bpf_test tests[] = { | |||
4975 | .prog_type = BPF_PROG_TYPE_LWT_XMIT, | 4975 | .prog_type = BPF_PROG_TYPE_LWT_XMIT, |
4976 | }, | 4976 | }, |
4977 | { | 4977 | { |
4978 | "make headroom for LWT_XMIT", | ||
4979 | .insns = { | ||
4980 | BPF_MOV64_REG(BPF_REG_6, BPF_REG_1), | ||
4981 | BPF_MOV64_IMM(BPF_REG_2, 34), | ||
4982 | BPF_MOV64_IMM(BPF_REG_3, 0), | ||
4983 | BPF_EMIT_CALL(BPF_FUNC_skb_change_head), | ||
4984 | /* split for s390 to succeed */ | ||
4985 | BPF_MOV64_REG(BPF_REG_1, BPF_REG_6), | ||
4986 | BPF_MOV64_IMM(BPF_REG_2, 42), | ||
4987 | BPF_MOV64_IMM(BPF_REG_3, 0), | ||
4988 | BPF_EMIT_CALL(BPF_FUNC_skb_change_head), | ||
4989 | BPF_MOV64_IMM(BPF_REG_0, 0), | ||
4990 | BPF_EXIT_INSN(), | ||
4991 | }, | ||
4992 | .result = ACCEPT, | ||
4993 | .prog_type = BPF_PROG_TYPE_LWT_XMIT, | ||
4994 | }, | ||
4995 | { | ||
4978 | "invalid access of tc_classid for LWT_IN", | 4996 | "invalid access of tc_classid for LWT_IN", |
4979 | .insns = { | 4997 | .insns = { |
4980 | BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, | 4998 | BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, |
@@ -11987,6 +12005,46 @@ static struct bpf_test tests[] = { | |||
11987 | .prog_type = BPF_PROG_TYPE_XDP, | 12005 | .prog_type = BPF_PROG_TYPE_XDP, |
11988 | }, | 12006 | }, |
11989 | { | 12007 | { |
12008 | "xadd/w check whether src/dst got mangled, 1", | ||
12009 | .insns = { | ||
12010 | BPF_MOV64_IMM(BPF_REG_0, 1), | ||
12011 | BPF_MOV64_REG(BPF_REG_6, BPF_REG_0), | ||
12012 | BPF_MOV64_REG(BPF_REG_7, BPF_REG_10), | ||
12013 | BPF_STX_MEM(BPF_DW, BPF_REG_10, BPF_REG_0, -8), | ||
12014 | BPF_STX_XADD(BPF_DW, BPF_REG_10, BPF_REG_0, -8), | ||
12015 | BPF_STX_XADD(BPF_DW, BPF_REG_10, BPF_REG_0, -8), | ||
12016 | BPF_JMP_REG(BPF_JNE, BPF_REG_6, BPF_REG_0, 3), | ||
12017 | BPF_JMP_REG(BPF_JNE, BPF_REG_7, BPF_REG_10, 2), | ||
12018 | BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_10, -8), | ||
12019 | BPF_EXIT_INSN(), | ||
12020 | BPF_MOV64_IMM(BPF_REG_0, 42), | ||
12021 | BPF_EXIT_INSN(), | ||
12022 | }, | ||
12023 | .result = ACCEPT, | ||
12024 | .prog_type = BPF_PROG_TYPE_SCHED_CLS, | ||
12025 | .retval = 3, | ||
12026 | }, | ||
12027 | { | ||
12028 | "xadd/w check whether src/dst got mangled, 2", | ||
12029 | .insns = { | ||
12030 | BPF_MOV64_IMM(BPF_REG_0, 1), | ||
12031 | BPF_MOV64_REG(BPF_REG_6, BPF_REG_0), | ||
12032 | BPF_MOV64_REG(BPF_REG_7, BPF_REG_10), | ||
12033 | BPF_STX_MEM(BPF_W, BPF_REG_10, BPF_REG_0, -8), | ||
12034 | BPF_STX_XADD(BPF_W, BPF_REG_10, BPF_REG_0, -8), | ||
12035 | BPF_STX_XADD(BPF_W, BPF_REG_10, BPF_REG_0, -8), | ||
12036 | BPF_JMP_REG(BPF_JNE, BPF_REG_6, BPF_REG_0, 3), | ||
12037 | BPF_JMP_REG(BPF_JNE, BPF_REG_7, BPF_REG_10, 2), | ||
12038 | BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_10, -8), | ||
12039 | BPF_EXIT_INSN(), | ||
12040 | BPF_MOV64_IMM(BPF_REG_0, 42), | ||
12041 | BPF_EXIT_INSN(), | ||
12042 | }, | ||
12043 | .result = ACCEPT, | ||
12044 | .prog_type = BPF_PROG_TYPE_SCHED_CLS, | ||
12045 | .retval = 3, | ||
12046 | }, | ||
12047 | { | ||
11990 | "bpf_get_stack return R0 within range", | 12048 | "bpf_get_stack return R0 within range", |
11991 | .insns = { | 12049 | .insns = { |
11992 | BPF_MOV64_REG(BPF_REG_6, BPF_REG_1), | 12050 | BPF_MOV64_REG(BPF_REG_6, BPF_REG_1), |
@@ -12554,8 +12612,11 @@ static void do_test_single(struct bpf_test *test, bool unpriv, | |||
12554 | } | 12612 | } |
12555 | 12613 | ||
12556 | if (fd_prog >= 0) { | 12614 | if (fd_prog >= 0) { |
12615 | __u8 tmp[TEST_DATA_LEN << 2]; | ||
12616 | __u32 size_tmp = sizeof(tmp); | ||
12617 | |||
12557 | err = bpf_prog_test_run(fd_prog, 1, test->data, | 12618 | err = bpf_prog_test_run(fd_prog, 1, test->data, |
12558 | sizeof(test->data), NULL, NULL, | 12619 | sizeof(test->data), tmp, &size_tmp, |
12559 | &retval, NULL); | 12620 | &retval, NULL); |
12560 | if (err && errno != 524/*ENOTSUPP*/ && errno != EPERM) { | 12621 | if (err && errno != 524/*ENOTSUPP*/ && errno != EPERM) { |
12561 | printf("Unexpected bpf_prog_test_run error\n"); | 12622 | printf("Unexpected bpf_prog_test_run error\n"); |
diff --git a/tools/testing/selftests/ftrace/test.d/00basic/snapshot.tc b/tools/testing/selftests/ftrace/test.d/00basic/snapshot.tc new file mode 100644 index 000000000000..3b1f45e13a2e --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/00basic/snapshot.tc | |||
@@ -0,0 +1,28 @@ | |||
1 | #!/bin/sh | ||
2 | # description: Snapshot and tracing setting | ||
3 | # flags: instance | ||
4 | |||
5 | [ ! -f snapshot ] && exit_unsupported | ||
6 | |||
7 | echo "Set tracing off" | ||
8 | echo 0 > tracing_on | ||
9 | |||
10 | echo "Allocate and take a snapshot" | ||
11 | echo 1 > snapshot | ||
12 | |||
13 | # Since trace buffer is empty, snapshot is also empty, but allocated | ||
14 | grep -q "Snapshot is allocated" snapshot | ||
15 | |||
16 | echo "Ensure keep tracing off" | ||
17 | test `cat tracing_on` -eq 0 | ||
18 | |||
19 | echo "Set tracing on" | ||
20 | echo 1 > tracing_on | ||
21 | |||
22 | echo "Take a snapshot again" | ||
23 | echo 1 > snapshot | ||
24 | |||
25 | echo "Ensure keep tracing on" | ||
26 | test `cat tracing_on` -eq 1 | ||
27 | |||
28 | exit 0 | ||
diff --git a/tools/testing/selftests/net/fib_tests.sh b/tools/testing/selftests/net/fib_tests.sh index 78245d60d8bc..0f45633bd634 100755 --- a/tools/testing/selftests/net/fib_tests.sh +++ b/tools/testing/selftests/net/fib_tests.sh | |||
@@ -740,13 +740,6 @@ ipv6_rt_add() | |||
740 | run_cmd "$IP -6 ro add unreachable 2001:db8:104::/64" | 740 | run_cmd "$IP -6 ro add unreachable 2001:db8:104::/64" |
741 | log_test $? 2 "Attempt to add duplicate route - reject route" | 741 | log_test $? 2 "Attempt to add duplicate route - reject route" |
742 | 742 | ||
743 | # iproute2 prepend only sets NLM_F_CREATE | ||
744 | # - adds a new route; does NOT convert existing route to ECMP | ||
745 | add_route6 "2001:db8:104::/64" "via 2001:db8:101::2" | ||
746 | run_cmd "$IP -6 ro prepend 2001:db8:104::/64 via 2001:db8:103::2" | ||
747 | check_route6 "2001:db8:104::/64 via 2001:db8:101::2 dev veth1 metric 1024 2001:db8:104::/64 via 2001:db8:103::2 dev veth3 metric 1024" | ||
748 | log_test $? 0 "Add new route for existing prefix (w/o NLM_F_EXCL)" | ||
749 | |||
750 | # route append with same prefix adds a new route | 743 | # route append with same prefix adds a new route |
751 | # - iproute2 sets NLM_F_CREATE | NLM_F_APPEND | 744 | # - iproute2 sets NLM_F_CREATE | NLM_F_APPEND |
752 | add_route6 "2001:db8:104::/64" "via 2001:db8:101::2" | 745 | add_route6 "2001:db8:104::/64" "via 2001:db8:101::2" |
@@ -754,27 +747,6 @@ ipv6_rt_add() | |||
754 | check_route6 "2001:db8:104::/64 metric 1024 nexthop via 2001:db8:101::2 dev veth1 weight 1 nexthop via 2001:db8:103::2 dev veth3 weight 1" | 747 | check_route6 "2001:db8:104::/64 metric 1024 nexthop via 2001:db8:101::2 dev veth1 weight 1 nexthop via 2001:db8:103::2 dev veth3 weight 1" |
755 | log_test $? 0 "Append nexthop to existing route - gw" | 748 | log_test $? 0 "Append nexthop to existing route - gw" |
756 | 749 | ||
757 | add_route6 "2001:db8:104::/64" "via 2001:db8:101::2" | ||
758 | run_cmd "$IP -6 ro append 2001:db8:104::/64 dev veth3" | ||
759 | check_route6 "2001:db8:104::/64 metric 1024 nexthop via 2001:db8:101::2 dev veth1 weight 1 nexthop dev veth3 weight 1" | ||
760 | log_test $? 0 "Append nexthop to existing route - dev only" | ||
761 | |||
762 | # multipath route can not have a nexthop that is a reject route | ||
763 | add_route6 "2001:db8:104::/64" "via 2001:db8:101::2" | ||
764 | run_cmd "$IP -6 ro append unreachable 2001:db8:104::/64" | ||
765 | log_test $? 2 "Append nexthop to existing route - reject route" | ||
766 | |||
767 | # reject route can not be converted to multipath route | ||
768 | run_cmd "$IP -6 ro flush 2001:db8:104::/64" | ||
769 | run_cmd "$IP -6 ro add unreachable 2001:db8:104::/64" | ||
770 | run_cmd "$IP -6 ro append 2001:db8:104::/64 via 2001:db8:103::2" | ||
771 | log_test $? 2 "Append nexthop to existing reject route - gw" | ||
772 | |||
773 | run_cmd "$IP -6 ro flush 2001:db8:104::/64" | ||
774 | run_cmd "$IP -6 ro add unreachable 2001:db8:104::/64" | ||
775 | run_cmd "$IP -6 ro append 2001:db8:104::/64 dev veth3" | ||
776 | log_test $? 2 "Append nexthop to existing reject route - dev only" | ||
777 | |||
778 | # insert mpath directly | 750 | # insert mpath directly |
779 | add_route6 "2001:db8:104::/64" "nexthop via 2001:db8:101::2 nexthop via 2001:db8:103::2" | 751 | add_route6 "2001:db8:104::/64" "nexthop via 2001:db8:101::2 nexthop via 2001:db8:103::2" |
780 | check_route6 "2001:db8:104::/64 metric 1024 nexthop via 2001:db8:101::2 dev veth1 weight 1 nexthop via 2001:db8:103::2 dev veth3 weight 1" | 752 | check_route6 "2001:db8:104::/64 metric 1024 nexthop via 2001:db8:101::2 dev veth1 weight 1 nexthop via 2001:db8:103::2 dev veth3 weight 1" |
@@ -819,13 +791,6 @@ ipv6_rt_replace_single() | |||
819 | check_route6 "2001:db8:104::/64 metric 1024 nexthop via 2001:db8:101::3 dev veth1 weight 1 nexthop via 2001:db8:103::2 dev veth3 weight 1" | 791 | check_route6 "2001:db8:104::/64 metric 1024 nexthop via 2001:db8:101::3 dev veth1 weight 1 nexthop via 2001:db8:103::2 dev veth3 weight 1" |
820 | log_test $? 0 "Single path with multipath" | 792 | log_test $? 0 "Single path with multipath" |
821 | 793 | ||
822 | # single path with reject | ||
823 | # | ||
824 | add_initial_route6 "nexthop via 2001:db8:101::2" | ||
825 | run_cmd "$IP -6 ro replace unreachable 2001:db8:104::/64" | ||
826 | check_route6 "unreachable 2001:db8:104::/64 dev lo metric 1024" | ||
827 | log_test $? 0 "Single path with reject route" | ||
828 | |||
829 | # single path with single path using MULTIPATH attribute | 794 | # single path with single path using MULTIPATH attribute |
830 | # | 795 | # |
831 | add_initial_route6 "via 2001:db8:101::2" | 796 | add_initial_route6 "via 2001:db8:101::2" |
@@ -873,12 +838,6 @@ ipv6_rt_replace_mpath() | |||
873 | check_route6 "2001:db8:104::/64 via 2001:db8:101::3 dev veth1 metric 1024" | 838 | check_route6 "2001:db8:104::/64 via 2001:db8:101::3 dev veth1 metric 1024" |
874 | log_test $? 0 "Multipath with single path via multipath attribute" | 839 | log_test $? 0 "Multipath with single path via multipath attribute" |
875 | 840 | ||
876 | # multipath with reject | ||
877 | add_initial_route6 "nexthop via 2001:db8:101::2 nexthop via 2001:db8:103::2" | ||
878 | run_cmd "$IP -6 ro replace unreachable 2001:db8:104::/64" | ||
879 | check_route6 "unreachable 2001:db8:104::/64 dev lo metric 1024" | ||
880 | log_test $? 0 "Multipath with reject route" | ||
881 | |||
882 | # route replace fails - invalid nexthop 1 | 841 | # route replace fails - invalid nexthop 1 |
883 | add_initial_route6 "nexthop via 2001:db8:101::2 nexthop via 2001:db8:103::2" | 842 | add_initial_route6 "nexthop via 2001:db8:101::2 nexthop via 2001:db8:103::2" |
884 | run_cmd "$IP -6 ro replace 2001:db8:104::/64 nexthop via 2001:db8:111::3 nexthop via 2001:db8:103::3" | 843 | run_cmd "$IP -6 ro replace 2001:db8:104::/64 nexthop via 2001:db8:111::3 nexthop via 2001:db8:103::3" |
diff --git a/tools/testing/selftests/net/udpgso_bench.sh b/tools/testing/selftests/net/udpgso_bench.sh index 792fa4d0285e..850767befa47 100755 --- a/tools/testing/selftests/net/udpgso_bench.sh +++ b/tools/testing/selftests/net/udpgso_bench.sh | |||
@@ -35,9 +35,6 @@ run_udp() { | |||
35 | 35 | ||
36 | echo "udp gso" | 36 | echo "udp gso" |
37 | run_in_netns ${args} -S | 37 | run_in_netns ${args} -S |
38 | |||
39 | echo "udp gso zerocopy" | ||
40 | run_in_netns ${args} -S -z | ||
41 | } | 38 | } |
42 | 39 | ||
43 | run_tcp() { | 40 | run_tcp() { |