From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4E8E6A0C41 for ; Tue, 30 Nov 2021 17:40:58 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 49093410F7; Tue, 30 Nov 2021 17:40:58 +0100 (CET) Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by mails.dpdk.org (Postfix) with ESMTP id 3AF8541177 for ; Tue, 30 Nov 2021 17:40:56 +0100 (CET) Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 15AA53FFF1 for ; Tue, 30 Nov 2021 16:40:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1638290456; bh=J0PRaY/UTTUl9cROEJGnCx/5YfLuOVYrinHpjMvnfd4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=AISn5khyc/Oh1ZPkaxjP8BejgGPLgObWdn76ixN+g8IXD6OdwR/vrRacJ/QxeIJbO p3E4lo/CW2S1y8Sqd41qnpT14EhS9KhZg+umktnNiSZEF+km0Zw1Dn+ktJx6aXG0vM yt4yAGG3UWOz2eEknKMgBjlJwDgcpJp0EtcSNqC86NA/Gch1TEPMcYYjbei6biYnlE +uBkeJX5zFyAMrve0zsob6mgdAZkAV/p4Yl7cXTUgQjH3An+2w15IAEFeh8qET0Y0g GaN5nyLDAbfUKPfOVSrA8ynrzph5wPRbIQxhdCnZVAt5ohnyBQS+0czqSa5ViRskSE TL69uVnDvdzZA== Received: by mail-ed1-f70.google.com with SMTP id q17-20020aa7da91000000b003e7c0641b9cso17471839eds.12 for ; Tue, 30 Nov 2021 08:40:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=J0PRaY/UTTUl9cROEJGnCx/5YfLuOVYrinHpjMvnfd4=; b=cnOovYd/mJ+yembHhnLopEy5yeygw8JYWkjgHf89tZwKgsPcXpxy6J9oz8m6JsJbsW qbg2PeDeIjcRkCUdENSvd0kPcs+lierWOzJC+vtVdVskaWhyeokBIk14pawzJy1A0txD nuJV1Rk41sjTNs4xD8noSRNIqvb6bMXJLb450OWYU/1mdnvHRFTHkRBeXpFycT7ODwIR LcSyBF8d8hrhroJ96+DZQx+ijci8w5TRnDeGuQ00UQkg71adoofVbJVtaRCI7yu8KUGW VWM5DJ52evz3p0H7174ukzpzSvzKCAmilBju+a082d2y68U7LhkUuwdG1oC6Gcj6jftV B2dw== X-Gm-Message-State: AOAM530idprmaHnNoWXYIfj4ZOwMcvaYVSSM3kcDFqSNRossItuYVf6R TDob+FgSAPt+jrihv/BJeo1uqTE65CaOeSfuPjIC5cNTRum+H1xvBP8i4+SbDK/qH5dXlbB5BR4 PFJY9ZdqUgzH30j4ssjRT9SNq X-Received: by 2002:a17:907:1c82:: with SMTP id nb2mr252863ejc.218.1638290455122; Tue, 30 Nov 2021 08:40:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJwgp7Up/2FXr/9FNIoohAjCCDBOVWDZJ/QbSpWe9D2oKtbTxrAcd7HIk692QeghZfbHxf8h7Q== X-Received: by 2002:a17:907:1c82:: with SMTP id nb2mr252839ejc.218.1638290454934; Tue, 30 Nov 2021 08:40:54 -0800 (PST) Received: from localhost.localdomain ([2001:67c:1560:8007::aac:c4ad]) by smtp.gmail.com with ESMTPSA id gz26sm9213928ejc.100.2021.11.30.08.40.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Nov 2021 08:40:54 -0800 (PST) From: christian.ehrhardt@canonical.com To: Stephen Hemminger Cc: Konstantin Ananyev , dpdk stable Subject: patch 'bpf: allow self-xor operation' has been queued to stable release 19.11.11 Date: Tue, 30 Nov 2021 17:34:56 +0100 Message-Id: <20211130163605.2460997-92-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211130163605.2460997-1-christian.ehrhardt@canonical.com> References: <20211130163605.2460997-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 19.11.11 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before December 10th 2021. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/fb117f17e22d0cb862884798348f4232f6a2c270 Thanks. Christian Ehrhardt --- >From fb117f17e22d0cb862884798348f4232f6a2c270 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 20 Oct 2021 14:42:27 -0700 Subject: [PATCH] bpf: allow self-xor operation [ upstream commit 80da61198b6be66ab16964eb0944c79c0325c40e ] Some BPF programs may use XOR of a register with itself as a way to zero register in one instruction. The BPF filter converter generates this in the prolog to the generated code. The BPF validator would not allow this because the value of register was undefined. But after this operation it always zero. Fixes: 8021917293d0 ("bpf: add extra validation for input BPF program") Acked-by: Konstantin Ananyev Signed-off-by: Stephen Hemminger --- lib/librte_bpf/bpf_validate.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/librte_bpf/bpf_validate.c b/lib/librte_bpf/bpf_validate.c index 21ee106649..a7c588a92a 100644 --- a/lib/librte_bpf/bpf_validate.c +++ b/lib/librte_bpf/bpf_validate.c @@ -621,8 +621,15 @@ eval_alu(struct bpf_verifier *bvf, const struct ebpf_insn *ins) op = BPF_OP(ins->code); + /* Allow self-xor as way to zero register */ + if (op == BPF_XOR && BPF_SRC(ins->code) == BPF_X && + ins->src_reg == ins->dst_reg) { + eval_fill_imm(&rs, UINT64_MAX, 0); + eval_fill_imm(rd, UINT64_MAX, 0); + } + err = eval_defined((op != EBPF_MOV) ? rd : NULL, - (op != BPF_NEG) ? &rs : NULL); + (op != BPF_NEG) ? &rs : NULL); if (err != NULL) return err; -- 2.34.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-11-30 16:50:11.269763275 +0100 +++ 0092-bpf-allow-self-xor-operation.patch 2021-11-30 16:50:05.890874264 +0100 @@ -1 +1 @@ -From 80da61198b6be66ab16964eb0944c79c0325c40e Mon Sep 17 00:00:00 2001 +From fb117f17e22d0cb862884798348f4232f6a2c270 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 80da61198b6be66ab16964eb0944c79c0325c40e ] + @@ -15 +16,0 @@ -Cc: stable@dpdk.org @@ -20 +21 @@ - lib/bpf/bpf_validate.c | 9 ++++++++- + lib/librte_bpf/bpf_validate.c | 9 ++++++++- @@ -23,5 +24,5 @@ -diff --git a/lib/bpf/bpf_validate.c b/lib/bpf/bpf_validate.c -index 7b1291b382..853279fee5 100644 ---- a/lib/bpf/bpf_validate.c -+++ b/lib/bpf/bpf_validate.c -@@ -661,8 +661,15 @@ eval_alu(struct bpf_verifier *bvf, const struct ebpf_insn *ins) +diff --git a/lib/librte_bpf/bpf_validate.c b/lib/librte_bpf/bpf_validate.c +index 21ee106649..a7c588a92a 100644 +--- a/lib/librte_bpf/bpf_validate.c ++++ b/lib/librte_bpf/bpf_validate.c +@@ -621,8 +621,15 @@ eval_alu(struct bpf_verifier *bvf, const struct ebpf_insn *ins)