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


Groups > linux.kernel > #1268562

Re: [PATCH 2/2] arm64: bpf: make BPF prologue and epilogue align with ARM64 AAPCS

From Z Lim <zlim.lnx@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] arm64: bpf: make BPF prologue and epilogue align with ARM64 AAPCS
Date 2015-11-13 04:30 +0100
Message-ID <quddL-11M-3@gated-at.bofh.it> (permalink)
References <qu8nL-6oo-1@gated-at.bofh.it> <qu8nM-6oo-29@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Nov 12, 2015 at 1:57 PM, Yang Shi <yang.shi@linaro.org> wrote:
>
> Save and restore FP/LR in BPF prog prologue and epilogue, save SP to FP
> in prologue in order to get the correct stack backtrace.
>
> However, ARM64 JIT used FP (x29) as eBPF fp register, FP is subjected to
> change during function call so it may cause the BPF prog stack base address
> change too.
>
> Use x25 to replace FP as BPF stack base register (fp). Since x25 is callee
> saved register, so it will keep intact during function call.
> It is initialized in BPF prog prologue when BPF prog is started to run
> everytime. When BPF prog exits, it could be just tossed.
>
> So, the BPF stack layout looks like:
>
>                                  high
>          original A64_SP =>   0:+-----+ BPF prologue
>                                 |     | FP/LR and callee saved registers
>          BPF fp register => -64:+-----+
>                                 |     |
>                                 | ... | BPF prog stack
>                                 |     |
>                                 |     |
>          current A64_SP/FP =>   +-----+
>                                 |     |
>                                 | ... | Function call stack
>                                 |     |
>                                 +-----+
>                                   low
>

Yang, for stack unwinding to work, shouldn't it be something like the following?

          | LR |
A64_FP => | FP |
          | .. |
--
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