Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1268304

[PATCH 1/2] arm64: bpf: fix JIT frame pointer setup

From Yang Shi <yang.shi@linaro.org>
Newsgroups linux.kernel
Subject [PATCH 1/2] arm64: bpf: fix JIT frame pointer setup
Date 2015-11-12 23:20 +0100
Message-ID <qu8nM-6oo-37@gated-at.bofh.it> (permalink)
References <qu8nL-6oo-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 arch/arm64/net/bpf_jit_comp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c
index a44e529..ac8b548 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)
 	if (ctx->tmp_used)
 		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 */
 	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 */
 	emit_a64_mov_i64(ra, 0, ctx);
 	emit_a64_mov_i64(rx, 0, ctx);
-- 
2.0.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH V2 0/2] arm64: bpf: correct JIT stack setup and make it align with ARM64 AAPCS Yang Shi <yang.shi@linaro.org> - 2015-11-12 23:20 +0100
  [PATCH 2/2] arm64: bpf: make BPF prologue and epilogue align with ARM64 AAPCS Yang Shi <yang.shi@linaro.org> - 2015-11-12 23:20 +0100
    Re: [PATCH 2/2] arm64: bpf: make BPF prologue and epilogue align with  ARM64 AAPCS Z Lim <zlim.lnx@gmail.com> - 2015-11-13 04:30 +0100
      Re: [PATCH 2/2] arm64: bpf: make BPF prologue and epilogue align  with ARM64 AAPCS "Shi, Yang" <yang.shi@linaro.org> - 2015-11-13 18:30 +0100
  [PATCH 1/2] arm64: bpf: fix JIT frame pointer setup Yang Shi <yang.shi@linaro.org> - 2015-11-12 23:20 +0100
    Re: [PATCH 1/2] arm64: bpf: fix JIT frame pointer setup Z Lim <zlim.lnx@gmail.com> - 2015-11-13 04:30 +0100

csiph-web