diff options
author | Yang Shi <yang.shi@linaro.org> | 2015-11-12 16:57:00 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-11-16 14:38:42 -0500 |
commit | 0fcd593b943bfcc21ad84d3321422401de071d8a (patch) | |
tree | 8f39ef257eb47c668f0f4643856aa48e109f9bed | |
parent | 7729b053814ac91af340f5055970afc87d7fee21 (diff) |
arm64: bpf: fix JIT frame pointer setup
BPF fp should point to the top of the BPF prog stack. The original
implementation made it point to the bottom incorrectly.
Move A64_SP to fp before reserve BPF prog stack space.
CC: Zi Shen Lim <zlim.lnx@gmail.com>
CC: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Yang Shi <yang.shi@linaro.org>
Reviewed-by: Zi Shen Lim <zlim.lnx@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | arch/arm64/net/bpf_jit_comp.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c index a44e5293c6f5..ac8b548ce493 100644 --- a/arch/arm64/net/bpf_jit_comp.c +++ b/arch/arm64/net/bpf_jit_comp.c | |||
@@ -161,12 +161,12 @@ static void build_prologue(struct jit_ctx *ctx) | |||
161 | if (ctx->tmp_used) | 161 | if (ctx->tmp_used) |
162 | emit(A64_PUSH(tmp1, tmp2, A64_SP), ctx); | 162 | emit(A64_PUSH(tmp1, tmp2, A64_SP), ctx); |
163 | 163 | ||
164 | /* Set up BPF stack */ | ||
165 | emit(A64_SUB_I(1, A64_SP, A64_SP, stack_size), ctx); | ||
166 | |||
167 | /* Set up frame pointer */ | 164 | /* Set up frame pointer */ |
168 | emit(A64_MOV(1, fp, A64_SP), ctx); | 165 | emit(A64_MOV(1, fp, A64_SP), ctx); |
169 | 166 | ||
167 | /* Set up BPF stack */ | ||
168 | emit(A64_SUB_I(1, A64_SP, A64_SP, stack_size), ctx); | ||
169 | |||
170 | /* Clear registers A and X */ | 170 | /* Clear registers A and X */ |
171 | emit_a64_mov_i64(ra, 0, ctx); | 171 | emit_a64_mov_i64(ra, 0, ctx); |
172 | emit_a64_mov_i64(rx, 0, ctx); | 172 | emit_a64_mov_i64(rx, 0, ctx); |