summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-04-17 22:51:58 +0300
committerDavid S. Miller <davem@davemloft.net>2017-04-17 22:51:58 +0300
commitacf167f3f2495f0b6565f6e8ac9bd87158a0e98d (patch)
tree82226511f5f60faf8c8bf820051da232e104c026
parent0aa8c13eb512823bc4d60397d666a6b6260bb965 (diff)
parentc2002f983767ea0a53acbb3e21f771e7a7e2ed28 (diff)
downloadlinux-acf167f3f2495f0b6565f6e8ac9bd87158a0e98d.tar.xz
Merge branch 'bpf-fixes'
Daniel Borkmann says: ==================== Two BPF fixes The set fixes cb_access and xdp_adjust_head bits in struct bpf_prog, that are used for requirement checks on the program rather than f.e. heuristics. Thus, for tail calls, we cannot make any assumptions and are forced to set them. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--kernel/bpf/syscall.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 7af0dcc5d755..821f9e807de5 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -617,6 +617,14 @@ static void fixup_bpf_calls(struct bpf_prog *prog)
if (insn->imm == BPF_FUNC_xdp_adjust_head)
prog->xdp_adjust_head = 1;
if (insn->imm == BPF_FUNC_tail_call) {
+ /* If we tail call into other programs, we
+ * cannot make any assumptions since they
+ * can be replaced dynamically during runtime
+ * in the program array.
+ */
+ prog->cb_access = 1;
+ prog->xdp_adjust_head = 1;
+
/* mark bpf_tail_call as different opcode
* to avoid conditional branch in
* interpeter for every normal call