diff options
author | Daniel Borkmann <daniel@iogearbox.net> | 2017-09-20 00:44:21 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-09-19 16:38:53 -0700 |
commit | 7c30013133964aaa2f45c17d6e9782ac6cfd7f5f (patch) | |
tree | 4ce9a1dd192a35dfb8a3ee4b66e37f2c8c9a90d2 /net/ipv6 | |
parent | f55956065ec94e3e9371463d693a1029c4cc3007 (diff) | |
download | linux-7c30013133964aaa2f45c17d6e9782ac6cfd7f5f.tar.bz2 |
bpf: fix ri->map_owner pointer on bpf_prog_realloc
Commit 109980b894e9 ("bpf: don't select potentially stale
ri->map from buggy xdp progs") passed the pointer to the prog
itself to be loaded into r4 prior on bpf_redirect_map() helper
call, so that we can store the owner into ri->map_owner out of
the helper.
Issue with that is that the actual address of the prog is still
subject to change when subsequent rewrites occur that require
slow path in bpf_prog_realloc() to alloc more memory, e.g. from
patching inlining helper functions or constant blinding. Thus,
we really need to take prog->aux as the address we're holding,
which also works with prog clones as they share the same aux
object.
Instead of then fetching aux->prog during runtime, which could
potentially incur cache misses due to false sharing, we are
going to just use aux for comparison on the map owner. This
will also keep the patchlet of the same size, and later check
in xdp_map_invalid() only accesses read-only aux pointer from
the prog, it's also in the same cacheline already from prior
access when calling bpf_func.
Fixes: 109980b894e9 ("bpf: don't select potentially stale ri->map from buggy xdp progs")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
0 files changed, 0 insertions, 0 deletions