Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp1812206imn; Mon, 1 Aug 2022 00:31:37 -0700 (PDT) X-Google-Smtp-Source: AA6agR5SzkT6O6sURUGQ/e6g5W86DHak8jvoHmiQSK2TJSzoxe3ni0YRQAzET8hqe701FJog15mF X-Received: by 2002:a50:ed82:0:b0:43d:5334:9d19 with SMTP id h2-20020a50ed82000000b0043d53349d19mr8939980edr.232.1659339096870; Mon, 01 Aug 2022 00:31:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659339096; cv=none; d=google.com; s=arc-20160816; b=BHx2KBV6X7YAKhRVZezmwmIRvWI5RWgq7p3ns2nfmwwpkywYnAT68KjRkpYwMeJ9k3 eZOGV+9M8NnL0WROxbOaxI9OFvnuMZ1WcIR0oz5e2fTKJb32ALFMKGXVIK8ZHigubWmh MwdJ7e2yb0Y7qUHHjXeLjHJ+XqBFF8aMFVvywh6IqCS6WlyoUdAqCAKH+U/8g3jPUkcw aillODp2WF2g7XrjiWrh6Vj5xJvNa6nLNf26aP5KkCd/xZCX7gbkWPJkjQzV9CIOiuSS jDlH8lzfyqRzqYCxrdmvv6bVROnFBhkhjyt1ORdJf4mFs5yst7iPidmH3Fe9oKWUHuCU /n0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=+5tBsCYzAre9SvmMqoWIRvePnotGQuROnmEeEEzgLsM=; b=EfzR73vrt7Nc7pcjgBQci7kZt5uZls+LxzCPJd////YR5fatjGkpLry/DIKjfmZXDi mtasUuUH5TWZgIjwR8r9yyBE6yfuugV3edzBuvqTYkc7bIxnETbjl0RAc+jep6coCPeV QMAeI3vcqLkfVmROKW/lxlLmC/WxNd18dBhdsGvNH3wnaFWsOuWm95rv+PMNuXbg1zQo m9kcRUbTeQEcL8nylDQJRj2f7P1CGrzDLPSOarNU49dWlDLDDkZHA08tfMEXQAq9bHpe OnUHqml0h7ozzd+L5ZaDjYrpySWa7lhjJ1sPKDzGzF0Fmh88p+w3TVJxNUqM5JyTIHHh LIsw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a4-20020a170906468400b0072b3cb29befsi8096500ejr.445.2022.08.01.00.31.12; Mon, 01 Aug 2022 00:31:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229739AbiHAH3j (ORCPT + 99 others); Mon, 1 Aug 2022 03:29:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229651AbiHAH3c (ORCPT ); Mon, 1 Aug 2022 03:29:32 -0400 Received: from out30-43.freemail.mail.aliyun.com (out30-43.freemail.mail.aliyun.com [115.124.30.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 565B832D8F; Mon, 1 Aug 2022 00:29:31 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R711e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=dtcccc@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VL2sBJ._1659338968; Received: from localhost.localdomain(mailfrom:dtcccc@linux.alibaba.com fp:SMTPD_---0VL2sBJ._1659338968) by smtp.aliyun-inc.com; Mon, 01 Aug 2022 15:29:28 +0800 From: Tianchen Ding To: Greg Kroah-Hartman , Sasha Levin Cc: Lorenz Bauer , Alexei Starovoitov , linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH 5.10 3/3] selftests: bpf: Don't run sk_lookup in verifier tests Date: Mon, 1 Aug 2022 15:29:16 +0800 Message-Id: <20220801072916.29586-4-dtcccc@linux.alibaba.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220801072916.29586-1-dtcccc@linux.alibaba.com> References: <20220801072916.29586-1-dtcccc@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,HK_RANDOM_ENVFROM,HK_RANDOM_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lorenz Bauer commit b4f894633fa14d7d46ba7676f950b90a401504bb upstream. sk_lookup doesn't allow setting data_in for bpf_prog_run. This doesn't play well with the verifier tests, since they always set a 64 byte input buffer. Allow not running verifier tests by setting bpf_test.runs to a negative value and don't run the ctx access case for sk_lookup. We have dedicated ctx access tests so skipping here doesn't reduce coverage. Signed-off-by: Lorenz Bauer Signed-off-by: Alexei Starovoitov Link: https://lore.kernel.org/bpf/20210303101816.36774-6-lmb@cloudflare.com Signed-off-by: Tianchen Ding --- tools/testing/selftests/bpf/test_verifier.c | 4 ++-- tools/testing/selftests/bpf/verifier/ctx_sk_lookup.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c index a4c55fcb0e7b..0fb92d9a319b 100644 --- a/tools/testing/selftests/bpf/test_verifier.c +++ b/tools/testing/selftests/bpf/test_verifier.c @@ -100,7 +100,7 @@ struct bpf_test { enum bpf_prog_type prog_type; uint8_t flags; void (*fill_helper)(struct bpf_test *self); - uint8_t runs; + int runs; #define bpf_testdata_struct_t \ struct { \ uint32_t retval, retval_unpriv; \ @@ -1054,7 +1054,7 @@ static void do_test_single(struct bpf_test *test, bool unpriv, run_errs = 0; run_successes = 0; - if (!alignment_prevented_execution && fd_prog >= 0) { + if (!alignment_prevented_execution && fd_prog >= 0 && test->runs >= 0) { uint32_t expected_val; int i; diff --git a/tools/testing/selftests/bpf/verifier/ctx_sk_lookup.c b/tools/testing/selftests/bpf/verifier/ctx_sk_lookup.c index 2ad5f974451c..fd3b62a084b9 100644 --- a/tools/testing/selftests/bpf/verifier/ctx_sk_lookup.c +++ b/tools/testing/selftests/bpf/verifier/ctx_sk_lookup.c @@ -239,6 +239,7 @@ .result = ACCEPT, .prog_type = BPF_PROG_TYPE_SK_LOOKUP, .expected_attach_type = BPF_SK_LOOKUP, + .runs = -1, }, /* invalid 8-byte reads from a 4-byte fields in bpf_sk_lookup */ { -- 2.27.0