Commit 8690f47d authored by Nicolas Schichan's avatar Nicolas Schichan Committed by David S. Miller

ARM: net: make BPF_LD | BPF_IND instruction trigger r_X initialisation to 0.

Without this patch, if the only instructions using r_X are of the
BPF_LD | BPF_IND type, r_X would not be reset to 0, using whatever
value was there when entering the jited code. With this patch, r_X
will be correctly marked as used so it will be reset to 0 in the
prologue code.

This fix also makes the test "LD_IND byte default X" pass in the
test_bpf module when the ARM JIT is enabled.
Signed-off-by: default avatarNicolas Schichan <nschichan@freebox.fr>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 598c12d0
...@@ -614,6 +614,7 @@ static int build_body(struct jit_ctx *ctx) ...@@ -614,6 +614,7 @@ static int build_body(struct jit_ctx *ctx)
case BPF_LD | BPF_B | BPF_IND: case BPF_LD | BPF_B | BPF_IND:
load_order = 0; load_order = 0;
load_ind: load_ind:
update_on_xread(ctx);
OP_IMM3(ARM_ADD, r_off, r_X, k, ctx); OP_IMM3(ARM_ADD, r_off, r_X, k, ctx);
goto load_common; goto load_common;
case BPF_LDX | BPF_IMM: case BPF_LDX | BPF_IMM:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment