[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <564D02C5.1020200@linaro.org>
Date: Wed, 18 Nov 2015 14:59:17 -0800
From: "Shi, Yang" <yang.shi@...aro.org>
To: Z Lim <zlim.lnx@...il.com>
CC: "David S. Miller" <davem@...emloft.net>,
Alexei Starovoitov <ast@...nel.org>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will.deacon@....com>,
Daniel Borkmann <daniel@...earbox.net>,
Xi Wang <xi.wang@...il.com>,
LKML <linux-kernel@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
Network Development <netdev@...r.kernel.org>
Subject: Re: [PATCH] arm64: bpf: fix buffer pointer
On 11/18/2015 1:41 PM, Z Lim wrote:
> On Wed, Nov 18, 2015 at 1:07 PM, Shi, Yang <yang.shi@...aro.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.
OK, I see. The buffer grows from low to high.
Thanks for the elaboration.
Acked-by: Yang Shi <yang.shi@...aro.org>
Yang
>
>>
>> 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 netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists