Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757341AbbKRW7Y (ORCPT ); Wed, 18 Nov 2015 17:59:24 -0500 Received: from mail-ig0-f171.google.com ([209.85.213.171]:34151 "EHLO mail-ig0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755375AbbKRW7V (ORCPT ); Wed, 18 Nov 2015 17:59:21 -0500 Message-ID: <564D02C5.1020200@linaro.org> Date: Wed, 18 Nov 2015 14:59:17 -0800 From: "Shi, Yang" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Z Lim CC: "David S. Miller" , Alexei Starovoitov , Catalin Marinas , Will Deacon , Daniel Borkmann , Xi Wang , LKML , "linux-arm-kernel@lists.infradead.org" , Network Development Subject: Re: [PATCH] arm64: bpf: fix buffer pointer References: <1447836962-4086-1-git-send-email-zlim.lnx@gmail.com> <564CE886.5010109@linaro.org> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1492 Lines: 46 On 11/18/2015 1:41 PM, Z Lim wrote: > On Wed, Nov 18, 2015 at 1:07 PM, Shi, Yang 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 > >> >> 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/