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


Groups > linux.kernel > #1272604

Re: [PATCH] arm64: bpf: fix buffer pointer

From Z Lim <zlim.lnx@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] arm64: bpf: fix buffer pointer
Date 2015-11-18 22:50 +0100
Message-ID <qwiM1-iJ-7@gated-at.bofh.it> (permalink)
References <qw6KU-Af-53@gated-at.bofh.it> <qwi9k-8vZ-31@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Nov 18, 2015 at 1:07 PM, Shi, Yang <yang.shi@linaro.org> wrote:
> On 11/18/2015 12:56 AM, Zi Shen Lim wrote:
>>                 emit_a64_mov_i64(r3, size, ctx);
>> -               emit(A64_ADD_I(1, r4, fp, MAX_BPF_STACK), ctx);
>> +               emit(A64_SUB_I(1, r4, fp, STACK_SIZE), ctx);
>
>
> Should not it sub MAX_BPF_STACK?

No, if it's at (BPF_FP - MAX_BPF_STACK), we'll be writing into the BPF
stack area, which should only be used by the BPF program.

> If you sub STACK_SIZE here, the buffer pointer will point to bottom of the
> reserved area.

Yes, that's the idea. The buffer is allocated in here. Right now we're
using this "reserved" space for this buffer only.

>
> You stack layout change also shows this:
>
> +        *                        +-----+ <= (BPF_FP - MAX_BPF_STACK)
> +        *                        |RSVD | JIT scratchpad
> +        * current A64_SP =>      +-----+ <= (BPF_FP - STACK_SIZE)

Yes, this diagram reflects the code and intention.


Thanks for reviewing, we definitely need more of these :)
--
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] arm64: bpf: fix buffer pointer Zi Shen Lim <zlim.lnx@gmail.com> - 2015-11-18 10:00 +0100
  Re: [PATCH] arm64: bpf: fix buffer pointer David Miller <davem@davemloft.net> - 2015-11-18 21:40 +0100
  Re: [PATCH] arm64: bpf: fix buffer pointer "Shi, Yang" <yang.shi@linaro.org> - 2015-11-18 22:10 +0100
    Re: [PATCH] arm64: bpf: fix buffer pointer Z Lim <zlim.lnx@gmail.com> - 2015-11-18 22:50 +0100
      Re: [PATCH] arm64: bpf: fix buffer pointer "Shi, Yang" <yang.shi@linaro.org> - 2015-11-19 00:00 +0100
  Re: [PATCH] arm64: bpf: fix buffer pointer David Miller <davem@davemloft.net> - 2015-11-19 04:40 +0100

csiph-web