diff options
author | Radim Krčmář <rkrcmar@redhat.com> | 2017-09-08 08:40:43 -0400 |
---|---|---|
committer | Radim Krčmář <rkrcmar@redhat.com> | 2017-09-08 08:40:43 -0400 |
commit | 5f54c8b2d4fad95d1f8ecbe023ebe6038e6d3760 (patch) | |
tree | daca83ea5f9af1bd158504bd0b5af89c5a99b7fa /tools | |
parent | 78809a68490d84eb632a215be2121d4b44c86954 (diff) | |
parent | edd03602d97236e8fea13cd76886c576186aa307 (diff) |
Merge branch 'kvm-ppc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
This fix was intended for 4.13, but didn't get in because both
maintainers were on vacation.
Paul Mackerras:
"It adds mutual exclusion between list_add_rcu and list_del_rcu calls
on the kvm->arch.spapr_tce_tables list. Without this, userspace could
potentially trigger corruption of the list and cause a host crash or
worse."
Diffstat (limited to 'tools')
-rw-r--r-- | tools/build/feature/test-bpf.c | 2 | ||||
-rw-r--r-- | tools/lib/bpf/bpf.c | 2 | ||||
-rw-r--r-- | tools/testing/selftests/bpf/test_pkt_md_access.c | 11 | ||||
-rw-r--r-- | tools/testing/selftests/bpf/test_verifier.c | 19 | ||||
-rw-r--r-- | tools/testing/selftests/futex/Makefile | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | tools/testing/selftests/kmod/kmod.sh | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | tools/testing/selftests/sysctl/sysctl.sh | 0 | ||||
-rw-r--r-- | tools/testing/selftests/timers/freq-step.c | 7 |
8 files changed, 31 insertions, 16 deletions
diff --git a/tools/build/feature/test-bpf.c b/tools/build/feature/test-bpf.c index 7598361ef1f1..da2172ff9662 100644 --- a/tools/build/feature/test-bpf.c +++ b/tools/build/feature/test-bpf.c | |||
@@ -11,6 +11,8 @@ | |||
11 | # define __NR_bpf 280 | 11 | # define __NR_bpf 280 |
12 | # elif defined(__sparc__) | 12 | # elif defined(__sparc__) |
13 | # define __NR_bpf 349 | 13 | # define __NR_bpf 349 |
14 | # elif defined(__s390__) | ||
15 | # define __NR_bpf 351 | ||
14 | # else | 16 | # else |
15 | # error __NR_bpf not defined. libbpf does not support your arch. | 17 | # error __NR_bpf not defined. libbpf does not support your arch. |
16 | # endif | 18 | # endif |
diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c index 256f571f2ab5..e5bbb090bf88 100644 --- a/tools/lib/bpf/bpf.c +++ b/tools/lib/bpf/bpf.c | |||
@@ -39,6 +39,8 @@ | |||
39 | # define __NR_bpf 280 | 39 | # define __NR_bpf 280 |
40 | # elif defined(__sparc__) | 40 | # elif defined(__sparc__) |
41 | # define __NR_bpf 349 | 41 | # define __NR_bpf 349 |
42 | # elif defined(__s390__) | ||
43 | # define __NR_bpf 351 | ||
42 | # else | 44 | # else |
43 | # error __NR_bpf not defined. libbpf does not support your arch. | 45 | # error __NR_bpf not defined. libbpf does not support your arch. |
44 | # endif | 46 | # endif |
diff --git a/tools/testing/selftests/bpf/test_pkt_md_access.c b/tools/testing/selftests/bpf/test_pkt_md_access.c index 71729d47eb85..7956302ecdf2 100644 --- a/tools/testing/selftests/bpf/test_pkt_md_access.c +++ b/tools/testing/selftests/bpf/test_pkt_md_access.c | |||
@@ -12,12 +12,23 @@ | |||
12 | 12 | ||
13 | int _version SEC("version") = 1; | 13 | int _version SEC("version") = 1; |
14 | 14 | ||
15 | #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ | ||
15 | #define TEST_FIELD(TYPE, FIELD, MASK) \ | 16 | #define TEST_FIELD(TYPE, FIELD, MASK) \ |
16 | { \ | 17 | { \ |
17 | TYPE tmp = *(volatile TYPE *)&skb->FIELD; \ | 18 | TYPE tmp = *(volatile TYPE *)&skb->FIELD; \ |
18 | if (tmp != ((*(volatile __u32 *)&skb->FIELD) & MASK)) \ | 19 | if (tmp != ((*(volatile __u32 *)&skb->FIELD) & MASK)) \ |
19 | return TC_ACT_SHOT; \ | 20 | return TC_ACT_SHOT; \ |
20 | } | 21 | } |
22 | #else | ||
23 | #define TEST_FIELD_OFFSET(a, b) ((sizeof(a) - sizeof(b)) / sizeof(b)) | ||
24 | #define TEST_FIELD(TYPE, FIELD, MASK) \ | ||
25 | { \ | ||
26 | TYPE tmp = *((volatile TYPE *)&skb->FIELD + \ | ||
27 | TEST_FIELD_OFFSET(skb->FIELD, TYPE)); \ | ||
28 | if (tmp != ((*(volatile __u32 *)&skb->FIELD) & MASK)) \ | ||
29 | return TC_ACT_SHOT; \ | ||
30 | } | ||
31 | #endif | ||
21 | 32 | ||
22 | SEC("test1") | 33 | SEC("test1") |
23 | int process(struct __sk_buff *skb) | 34 | int process(struct __sk_buff *skb) |
diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c index addea82f76c9..d3ed7324105e 100644 --- a/tools/testing/selftests/bpf/test_verifier.c +++ b/tools/testing/selftests/bpf/test_verifier.c | |||
@@ -8,6 +8,7 @@ | |||
8 | * License as published by the Free Software Foundation. | 8 | * License as published by the Free Software Foundation. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <endian.h> | ||
11 | #include <asm/types.h> | 12 | #include <asm/types.h> |
12 | #include <linux/types.h> | 13 | #include <linux/types.h> |
13 | #include <stdint.h> | 14 | #include <stdint.h> |
@@ -1098,7 +1099,7 @@ static struct bpf_test tests[] = { | |||
1098 | "check skb->hash byte load permitted", | 1099 | "check skb->hash byte load permitted", |
1099 | .insns = { | 1100 | .insns = { |
1100 | BPF_MOV64_IMM(BPF_REG_0, 0), | 1101 | BPF_MOV64_IMM(BPF_REG_0, 0), |
1101 | #ifdef __LITTLE_ENDIAN | 1102 | #if __BYTE_ORDER == __LITTLE_ENDIAN |
1102 | BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, | 1103 | BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, |
1103 | offsetof(struct __sk_buff, hash)), | 1104 | offsetof(struct __sk_buff, hash)), |
1104 | #else | 1105 | #else |
@@ -1135,7 +1136,7 @@ static struct bpf_test tests[] = { | |||
1135 | "check skb->hash byte load not permitted 3", | 1136 | "check skb->hash byte load not permitted 3", |
1136 | .insns = { | 1137 | .insns = { |
1137 | BPF_MOV64_IMM(BPF_REG_0, 0), | 1138 | BPF_MOV64_IMM(BPF_REG_0, 0), |
1138 | #ifdef __LITTLE_ENDIAN | 1139 | #if __BYTE_ORDER == __LITTLE_ENDIAN |
1139 | BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, | 1140 | BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, |
1140 | offsetof(struct __sk_buff, hash) + 3), | 1141 | offsetof(struct __sk_buff, hash) + 3), |
1141 | #else | 1142 | #else |
@@ -1244,7 +1245,7 @@ static struct bpf_test tests[] = { | |||
1244 | "check skb->hash half load permitted", | 1245 | "check skb->hash half load permitted", |
1245 | .insns = { | 1246 | .insns = { |
1246 | BPF_MOV64_IMM(BPF_REG_0, 0), | 1247 | BPF_MOV64_IMM(BPF_REG_0, 0), |
1247 | #ifdef __LITTLE_ENDIAN | 1248 | #if __BYTE_ORDER == __LITTLE_ENDIAN |
1248 | BPF_LDX_MEM(BPF_H, BPF_REG_0, BPF_REG_1, | 1249 | BPF_LDX_MEM(BPF_H, BPF_REG_0, BPF_REG_1, |
1249 | offsetof(struct __sk_buff, hash)), | 1250 | offsetof(struct __sk_buff, hash)), |
1250 | #else | 1251 | #else |
@@ -1259,7 +1260,7 @@ static struct bpf_test tests[] = { | |||
1259 | "check skb->hash half load not permitted", | 1260 | "check skb->hash half load not permitted", |
1260 | .insns = { | 1261 | .insns = { |
1261 | BPF_MOV64_IMM(BPF_REG_0, 0), | 1262 | BPF_MOV64_IMM(BPF_REG_0, 0), |
1262 | #ifdef __LITTLE_ENDIAN | 1263 | #if __BYTE_ORDER == __LITTLE_ENDIAN |
1263 | BPF_LDX_MEM(BPF_H, BPF_REG_0, BPF_REG_1, | 1264 | BPF_LDX_MEM(BPF_H, BPF_REG_0, BPF_REG_1, |
1264 | offsetof(struct __sk_buff, hash) + 2), | 1265 | offsetof(struct __sk_buff, hash) + 2), |
1265 | #else | 1266 | #else |
@@ -5422,7 +5423,7 @@ static struct bpf_test tests[] = { | |||
5422 | "check bpf_perf_event_data->sample_period byte load permitted", | 5423 | "check bpf_perf_event_data->sample_period byte load permitted", |
5423 | .insns = { | 5424 | .insns = { |
5424 | BPF_MOV64_IMM(BPF_REG_0, 0), | 5425 | BPF_MOV64_IMM(BPF_REG_0, 0), |
5425 | #ifdef __LITTLE_ENDIAN | 5426 | #if __BYTE_ORDER == __LITTLE_ENDIAN |
5426 | BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, | 5427 | BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, |
5427 | offsetof(struct bpf_perf_event_data, sample_period)), | 5428 | offsetof(struct bpf_perf_event_data, sample_period)), |
5428 | #else | 5429 | #else |
@@ -5438,7 +5439,7 @@ static struct bpf_test tests[] = { | |||
5438 | "check bpf_perf_event_data->sample_period half load permitted", | 5439 | "check bpf_perf_event_data->sample_period half load permitted", |
5439 | .insns = { | 5440 | .insns = { |
5440 | BPF_MOV64_IMM(BPF_REG_0, 0), | 5441 | BPF_MOV64_IMM(BPF_REG_0, 0), |
5441 | #ifdef __LITTLE_ENDIAN | 5442 | #if __BYTE_ORDER == __LITTLE_ENDIAN |
5442 | BPF_LDX_MEM(BPF_H, BPF_REG_0, BPF_REG_1, | 5443 | BPF_LDX_MEM(BPF_H, BPF_REG_0, BPF_REG_1, |
5443 | offsetof(struct bpf_perf_event_data, sample_period)), | 5444 | offsetof(struct bpf_perf_event_data, sample_period)), |
5444 | #else | 5445 | #else |
@@ -5454,7 +5455,7 @@ static struct bpf_test tests[] = { | |||
5454 | "check bpf_perf_event_data->sample_period word load permitted", | 5455 | "check bpf_perf_event_data->sample_period word load permitted", |
5455 | .insns = { | 5456 | .insns = { |
5456 | BPF_MOV64_IMM(BPF_REG_0, 0), | 5457 | BPF_MOV64_IMM(BPF_REG_0, 0), |
5457 | #ifdef __LITTLE_ENDIAN | 5458 | #if __BYTE_ORDER == __LITTLE_ENDIAN |
5458 | BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, | 5459 | BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, |
5459 | offsetof(struct bpf_perf_event_data, sample_period)), | 5460 | offsetof(struct bpf_perf_event_data, sample_period)), |
5460 | #else | 5461 | #else |
@@ -5481,7 +5482,7 @@ static struct bpf_test tests[] = { | |||
5481 | "check skb->data half load not permitted", | 5482 | "check skb->data half load not permitted", |
5482 | .insns = { | 5483 | .insns = { |
5483 | BPF_MOV64_IMM(BPF_REG_0, 0), | 5484 | BPF_MOV64_IMM(BPF_REG_0, 0), |
5484 | #ifdef __LITTLE_ENDIAN | 5485 | #if __BYTE_ORDER == __LITTLE_ENDIAN |
5485 | BPF_LDX_MEM(BPF_H, BPF_REG_0, BPF_REG_1, | 5486 | BPF_LDX_MEM(BPF_H, BPF_REG_0, BPF_REG_1, |
5486 | offsetof(struct __sk_buff, data)), | 5487 | offsetof(struct __sk_buff, data)), |
5487 | #else | 5488 | #else |
@@ -5497,7 +5498,7 @@ static struct bpf_test tests[] = { | |||
5497 | "check skb->tc_classid half load not permitted for lwt prog", | 5498 | "check skb->tc_classid half load not permitted for lwt prog", |
5498 | .insns = { | 5499 | .insns = { |
5499 | BPF_MOV64_IMM(BPF_REG_0, 0), | 5500 | BPF_MOV64_IMM(BPF_REG_0, 0), |
5500 | #ifdef __LITTLE_ENDIAN | 5501 | #if __BYTE_ORDER == __LITTLE_ENDIAN |
5501 | BPF_LDX_MEM(BPF_H, BPF_REG_0, BPF_REG_1, | 5502 | BPF_LDX_MEM(BPF_H, BPF_REG_0, BPF_REG_1, |
5502 | offsetof(struct __sk_buff, tc_classid)), | 5503 | offsetof(struct __sk_buff, tc_classid)), |
5503 | #else | 5504 | #else |
diff --git a/tools/testing/selftests/futex/Makefile b/tools/testing/selftests/futex/Makefile index e2fbb890aef9..7c647f619d63 100644 --- a/tools/testing/selftests/futex/Makefile +++ b/tools/testing/selftests/futex/Makefile | |||
@@ -14,7 +14,7 @@ all: | |||
14 | done | 14 | done |
15 | 15 | ||
16 | override define RUN_TESTS | 16 | override define RUN_TESTS |
17 | @if [ `dirname $(OUTPUT)` = $(PWD) ]; then ./run.sh; fi | 17 | $(OUTPUT)/run.sh |
18 | endef | 18 | endef |
19 | 19 | ||
20 | override define INSTALL_RULE | 20 | override define INSTALL_RULE |
diff --git a/tools/testing/selftests/kmod/kmod.sh b/tools/testing/selftests/kmod/kmod.sh index 8cecae9a8bca..7956ea3be667 100644..100755 --- a/tools/testing/selftests/kmod/kmod.sh +++ b/tools/testing/selftests/kmod/kmod.sh | |||
@@ -473,8 +473,8 @@ usage() | |||
473 | echo " all Runs all tests (default)" | 473 | echo " all Runs all tests (default)" |
474 | echo " -t Run test ID the number amount of times is recommended" | 474 | echo " -t Run test ID the number amount of times is recommended" |
475 | echo " -w Watch test ID run until it runs into an error" | 475 | echo " -w Watch test ID run until it runs into an error" |
476 | echo " -c Run test ID once" | 476 | echo " -s Run test ID once" |
477 | echo " -s Run test ID x test-count number of times" | 477 | echo " -c Run test ID x test-count number of times" |
478 | echo " -l List all test ID list" | 478 | echo " -l List all test ID list" |
479 | echo " -h|--help Help" | 479 | echo " -h|--help Help" |
480 | echo | 480 | echo |
diff --git a/tools/testing/selftests/sysctl/sysctl.sh b/tools/testing/selftests/sysctl/sysctl.sh index ec232c3cfcaa..ec232c3cfcaa 100644..100755 --- a/tools/testing/selftests/sysctl/sysctl.sh +++ b/tools/testing/selftests/sysctl/sysctl.sh | |||
diff --git a/tools/testing/selftests/timers/freq-step.c b/tools/testing/selftests/timers/freq-step.c index e8c61830825a..22312eb4c941 100644 --- a/tools/testing/selftests/timers/freq-step.c +++ b/tools/testing/selftests/timers/freq-step.c | |||
@@ -229,10 +229,9 @@ static void init_test(void) | |||
229 | printf("CLOCK_MONOTONIC_RAW+CLOCK_MONOTONIC precision: %.0f ns\t\t", | 229 | printf("CLOCK_MONOTONIC_RAW+CLOCK_MONOTONIC precision: %.0f ns\t\t", |
230 | 1e9 * precision); | 230 | 1e9 * precision); |
231 | 231 | ||
232 | if (precision > MAX_PRECISION) { | 232 | if (precision > MAX_PRECISION) |
233 | printf("[SKIP]\n"); | 233 | ksft_exit_skip("precision: %.0f ns > MAX_PRECISION: %.0f ns\n", |
234 | ksft_exit_skip(); | 234 | 1e9 * precision, 1e9 * MAX_PRECISION); |
235 | } | ||
236 | 235 | ||
237 | printf("[OK]\n"); | 236 | printf("[OK]\n"); |
238 | srand(ts.tv_sec ^ ts.tv_nsec); | 237 | srand(ts.tv_sec ^ ts.tv_nsec); |