From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 3EE37A0471 for ; Fri, 21 Jun 2019 16:26:58 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EE1CB1D554; Fri, 21 Jun 2019 16:26:57 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 47FB71D533; Fri, 21 Jun 2019 16:26:56 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Jun 2019 07:26:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,400,1557212400"; d="scan'208";a="187184721" Received: from sivswdev08.ir.intel.com ([10.237.217.47]) by fmsmga002.fm.intel.com with ESMTP; 21 Jun 2019 07:26:53 -0700 From: Konstantin Ananyev To: dev@dpdk.org Cc: michel@digirati.com.br, Konstantin Ananyev , stable@dpdk.org Date: Fri, 21 Jun 2019 15:26:49 +0100 Message-Id: <20190621142649.14125-1-konstantin.ananyev@intel.com> X-Mailer: git-send-email 2.18.0 Subject: [dpdk-dev] [PATCH] bpf: fix invalid array size 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" Array ins_chk in lib/librte_bpf/bpf_validate.c has 255 entries. So the instruction with opcode == 255 will reading beyond array boundaries. For more details please refer to: https://bugs.dpdk.org/show_bug.cgi?id=283 Fixes: 6e12ec4c4d6d ("bpf: add more checks") Cc: stable@dpdk.org Reported-by: Michel Machado Signed-off-by: Konstantin Ananyev --- lib/librte_bpf/bpf_validate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_bpf/bpf_validate.c b/lib/librte_bpf/bpf_validate.c index 83983efc4..d0e683b5b 100644 --- a/lib/librte_bpf/bpf_validate.c +++ b/lib/librte_bpf/bpf_validate.c @@ -1084,7 +1084,7 @@ eval_jcc(struct bpf_verifier *bvf, const struct ebpf_insn *ins) /* * validate parameters for each instruction type. */ -static const struct bpf_ins_check ins_chk[UINT8_MAX] = { +static const struct bpf_ins_check ins_chk[UINT8_MAX + 1] = { /* ALU IMM 32-bit instructions */ [(BPF_ALU | BPF_ADD | BPF_K)] = { .mask = {.dreg = WRT_REGS, .sreg = ZERO_REG}, -- 2.17.1