提交 0fcd593b 编写于 作者: Y Yang Shi 提交者: David S. Miller

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: NYang Shi <yang.shi@linaro.org>
Reviewed-by: NZi Shen Lim <zlim.lnx@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 7729b053
...@@ -161,12 +161,12 @@ static void build_prologue(struct jit_ctx *ctx) ...@@ -161,12 +161,12 @@ static void build_prologue(struct jit_ctx *ctx)
if (ctx->tmp_used) if (ctx->tmp_used)
emit(A64_PUSH(tmp1, tmp2, A64_SP), ctx); emit(A64_PUSH(tmp1, tmp2, A64_SP), ctx);
/* Set up BPF stack */
emit(A64_SUB_I(1, A64_SP, A64_SP, stack_size), ctx);
/* Set up frame pointer */ /* Set up frame pointer */
emit(A64_MOV(1, fp, A64_SP), ctx); emit(A64_MOV(1, fp, A64_SP), ctx);
/* Set up BPF stack */
emit(A64_SUB_I(1, A64_SP, A64_SP, stack_size), ctx);
/* Clear registers A and X */ /* Clear registers A and X */
emit_a64_mov_i64(ra, 0, ctx); emit_a64_mov_i64(ra, 0, ctx);
emit_a64_mov_i64(rx, 0, ctx); emit_a64_mov_i64(rx, 0, ctx);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册