From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CEF41A0471 for ; Mon, 12 Aug 2019 10:49:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A386D2629; Mon, 12 Aug 2019 10:49:39 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 9AEAC1252; Mon, 12 Aug 2019 10:49:37 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Aug 2019 01:49:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,376,1559545200"; d="scan'208";a="375870566" Received: from irsmsx101.ger.corp.intel.com ([163.33.3.153]) by fmsmga006.fm.intel.com with ESMTP; 12 Aug 2019 01:49:35 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.73]) by IRSMSX101.ger.corp.intel.com ([169.254.1.61]) with mapi id 14.03.0439.000; Mon, 12 Aug 2019 09:49:35 +0100 From: "Ananyev, Konstantin" To: "jerinj@marvell.com" , "dev@dpdk.org" CC: "thomas@monjalon.net" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] bpf: fix to allow ptr stack program type Thread-Index: AQHVTs+w6eiuBSAK7kqssbVdAgwC16b3NM2A Date: Mon, 12 Aug 2019 08:49:34 +0000 Message-ID: <2601191342CEEE43887BDE71AB977258018115CEAE@irsmsx105.ger.corp.intel.com> References: <20190809162919.5967-1-jerinj@marvell.com> In-Reply-To: <20190809162919.5967-1-jerinj@marvell.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYjZkODBjODAtN2FmNy00N2Q2LThiZWQtNjNiNjI1ZTFlNjQyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiOXdIaWN5MUxMbUMreFdYK3ZvXC9ZVmh2K1d0STJtRG1nam5xSXlTVjNJNGV2ajNlVDM4XC9jQjc0ZVNOSllGSW9QIn0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] bpf: fix to allow ptr stack program type X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Jerin, >=20 > bpf_validate does not allow to execute > RTE_BPF_ARG_PTR_STACK for no reason. I believe there is a reason, ARG_PTR_STACK is reserved for memory within BPF program internal stack only= . User that calls BPF program should never pass parameter with that type. If the user allocates parameter for bpf function on the stack, he can still use RTE_BPF_ARG_PTR for it. Konstantin > Fix it by enhancing the prog_arg.type check. >=20 > Fixes: 6e12ec4c4d6d ("bpf: add more checks") > Cc: stable@dpdk.org >=20 > Signed-off-by: Jerin Jacob > --- > lib/librte_bpf/bpf_validate.c | 1 + > 1 file changed, 1 insertion(+) >=20 > diff --git a/lib/librte_bpf/bpf_validate.c b/lib/librte_bpf/bpf_validate.= c > index 0cf41fa27..c75777b6d 100644 > --- a/lib/librte_bpf/bpf_validate.c > +++ b/lib/librte_bpf/bpf_validate.c > @@ -2216,6 +2216,7 @@ bpf_validate(struct rte_bpf *bpf) >=20 > /* check input argument type, don't allow mbuf ptr on 32-bit */ > if (bpf->prm.prog_arg.type !=3D RTE_BPF_ARG_RAW && > + bpf->prm.prog_arg.type !=3D RTE_BPF_ARG_PTR_STACK && > bpf->prm.prog_arg.type !=3D RTE_BPF_ARG_PTR && > (sizeof(uint64_t) !=3D sizeof(uintptr_t) || > bpf->prm.prog_arg.type !=3D RTE_BPF_ARG_PTR_MBUF)) { > -- > 2.22.0