diff options
author | David S. Miller <davem@davemloft.net> | 2019-11-05 20:38:21 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-11-05 20:38:21 -0500 |
commit | 41de23e2232bbf8067cb1f6fe71a476046d9be88 (patch) | |
tree | cdc2c057c18e66169a374ce3533577bd68a86bc2 /tools | |
parent | 0763b3e81a82477363d72548604455bf9468c2fa (diff) | |
parent | 7de086909365cd60a5619a45af3f4152516fd75c (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf
Daniel Borkmann says:
====================
pull-request: bpf 2019-11-02
The following pull-request contains BPF updates for your *net* tree.
We've added 6 non-merge commits during the last 6 day(s) which contain
a total of 8 files changed, 35 insertions(+), 9 deletions(-).
The main changes are:
1) Fix ppc BPF JIT's tail call implementation by performing a second pass
to gather a stable JIT context before opcode emission, from Eric Dumazet.
2) Fix build of BPF samples sys_perf_event_open() usage to compiled out
unavailable test_attr__{enabled,open} checks. Also fix potential overflows
in bpf_map_{area_alloc,charge_init} on 32 bit archs, from Björn Töpel.
3) Fix narrow loads of bpf_sysctl context fields with offset > 0 on big endian
archs like s390x and also improve the test coverage, from Ilya Leoshkevich.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/perf-sys.h | 6 | ||||
-rw-r--r-- | tools/testing/selftests/bpf/test_sysctl.c | 8 |
2 files changed, 11 insertions, 3 deletions
diff --git a/tools/perf/perf-sys.h b/tools/perf/perf-sys.h index 63e4349a772a..15e458e150bd 100644 --- a/tools/perf/perf-sys.h +++ b/tools/perf/perf-sys.h | |||
@@ -15,7 +15,9 @@ void test_attr__init(void); | |||
15 | void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu, | 15 | void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu, |
16 | int fd, int group_fd, unsigned long flags); | 16 | int fd, int group_fd, unsigned long flags); |
17 | 17 | ||
18 | #define HAVE_ATTR_TEST | 18 | #ifndef HAVE_ATTR_TEST |
19 | #define HAVE_ATTR_TEST 1 | ||
20 | #endif | ||
19 | 21 | ||
20 | static inline int | 22 | static inline int |
21 | sys_perf_event_open(struct perf_event_attr *attr, | 23 | sys_perf_event_open(struct perf_event_attr *attr, |
@@ -27,7 +29,7 @@ sys_perf_event_open(struct perf_event_attr *attr, | |||
27 | fd = syscall(__NR_perf_event_open, attr, pid, cpu, | 29 | fd = syscall(__NR_perf_event_open, attr, pid, cpu, |
28 | group_fd, flags); | 30 | group_fd, flags); |
29 | 31 | ||
30 | #ifdef HAVE_ATTR_TEST | 32 | #if HAVE_ATTR_TEST |
31 | if (unlikely(test_attr__enabled)) | 33 | if (unlikely(test_attr__enabled)) |
32 | test_attr__open(attr, pid, cpu, fd, group_fd, flags); | 34 | test_attr__open(attr, pid, cpu, fd, group_fd, flags); |
33 | #endif | 35 | #endif |
diff --git a/tools/testing/selftests/bpf/test_sysctl.c b/tools/testing/selftests/bpf/test_sysctl.c index a320e3844b17..7c6e5b173f33 100644 --- a/tools/testing/selftests/bpf/test_sysctl.c +++ b/tools/testing/selftests/bpf/test_sysctl.c | |||
@@ -161,9 +161,14 @@ static struct sysctl_test tests[] = { | |||
161 | .descr = "ctx:file_pos sysctl:read read ok narrow", | 161 | .descr = "ctx:file_pos sysctl:read read ok narrow", |
162 | .insns = { | 162 | .insns = { |
163 | /* If (file_pos == X) */ | 163 | /* If (file_pos == X) */ |
164 | #if __BYTE_ORDER == __LITTLE_ENDIAN | ||
164 | BPF_LDX_MEM(BPF_B, BPF_REG_7, BPF_REG_1, | 165 | BPF_LDX_MEM(BPF_B, BPF_REG_7, BPF_REG_1, |
165 | offsetof(struct bpf_sysctl, file_pos)), | 166 | offsetof(struct bpf_sysctl, file_pos)), |
166 | BPF_JMP_IMM(BPF_JNE, BPF_REG_7, 0, 2), | 167 | #else |
168 | BPF_LDX_MEM(BPF_B, BPF_REG_7, BPF_REG_1, | ||
169 | offsetof(struct bpf_sysctl, file_pos) + 3), | ||
170 | #endif | ||
171 | BPF_JMP_IMM(BPF_JNE, BPF_REG_7, 4, 2), | ||
167 | 172 | ||
168 | /* return ALLOW; */ | 173 | /* return ALLOW; */ |
169 | BPF_MOV64_IMM(BPF_REG_0, 1), | 174 | BPF_MOV64_IMM(BPF_REG_0, 1), |
@@ -176,6 +181,7 @@ static struct sysctl_test tests[] = { | |||
176 | .attach_type = BPF_CGROUP_SYSCTL, | 181 | .attach_type = BPF_CGROUP_SYSCTL, |
177 | .sysctl = "kernel/ostype", | 182 | .sysctl = "kernel/ostype", |
178 | .open_flags = O_RDONLY, | 183 | .open_flags = O_RDONLY, |
184 | .seek = 4, | ||
179 | .result = SUCCESS, | 185 | .result = SUCCESS, |
180 | }, | 186 | }, |
181 | { | 187 | { |