Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2422757iof; Wed, 8 Jun 2022 04:48:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCqC3MmsZp8ji0hK2BOuG//J09uiso2CY1A2Fqf6YRt2zMFu0yUZV4sXcSkZ1h3oqqlJE8 X-Received: by 2002:a63:ec48:0:b0:3fe:44a3:bf4d with SMTP id r8-20020a63ec48000000b003fe44a3bf4dmr853614pgj.610.1654688887344; Wed, 08 Jun 2022 04:48:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654688887; cv=none; d=google.com; s=arc-20160816; b=o2UZ3Lf1PSStQoX8jLF28c/oWUx80xwhXayU7DhmU/wDMhA692UCV+0KYdiFIpp8NE /T/62ioQ9aXcNMglBDaWXrQbd8hEQocyG+pUhUjujsuU+9J9I3BuQK+fh6l7C2qCAj+a HHqRZmepTn6sty6/AerbXXVLCqZKG1ogvegcSw4DB0dTK+VYmS6We9kBRkF111ngjSFB 2NS7rPiwio0quP6a2haEQp0cLzN+pYz31lUwKvyim6eqmAB0UUOZzKUBGBf/6EVoqFCE vU57GonEdKfxtVgXk6n6RMZ0SCZ0hSk2iELMA/NSshQwNVBE6EVVcXR0tP4yHmqWobKk b+Pg== 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=iI60Pv6rvV2wUjZLaCg6S3qbmkHAuzBMPnXhXAwLd9A=; b=agIrTXDylcc4K/CYgtpocevkEPkSu1nIW6VockoPHNedkxWsRTmmYd9sF5fVm8G4AL wa2ASDVK99JuDkHWN1ArCDG/xl3GRuNnY71isYWI9NanHVF2F0MT72BE4EzQdtk6BTiE b/cvIrNapWbFnJ5m/dFdMp9oXHffgf4OOEHfuGZCh7B2Pi2Js0mOvUumIrltKB4VI7FU 5Ki4Lmq/WPRAS3nQTyc4ozwVhJUd8E2ZY+OkDxdVUge6UM8agtuodlip7fjJWAWOLFl1 GabpBW0gTNKytbQcHhOjDl2xZ2S5W8y08QasBk89jplj1T/O7LZbKSdD4nhS25j/KjKB UbwQ== 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:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 205-20020a6302d6000000b003fccd1caadbsi25207440pgc.680.2022.06.08.04.48.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 04:48:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6008F21CBFC; Wed, 8 Jun 2022 04:15:51 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237942AbiFHLPa (ORCPT + 99 others); Wed, 8 Jun 2022 07:15:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237554AbiFHLPM (ORCPT ); Wed, 8 Jun 2022 07:15:12 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79F72280B11; Wed, 8 Jun 2022 04:15:10 -0700 (PDT) Received: from fraeml714-chm.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4LJ4Jb24NMz6802B; Wed, 8 Jun 2022 19:10:23 +0800 (CST) Received: from roberto-ThinkStation-P620.huawei.com (10.204.63.22) by fraeml714-chm.china.huawei.com (10.206.15.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 8 Jun 2022 13:15:07 +0200 From: Roberto Sassu To: , , , CC: , , , , Roberto Sassu Subject: [PATCH v2 2/3] selftests/bpf: Add test_progs opts for sign-file and kernel priv key + cert Date: Wed, 8 Jun 2022 13:12:20 +0200 Message-ID: <20220608111221.373833-3-roberto.sassu@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220608111221.373833-1-roberto.sassu@huawei.com> References: <20220608111221.373833-1-roberto.sassu@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.204.63.22] X-ClientProxiedBy: lhreml753-chm.china.huawei.com (10.201.108.203) To fraeml714-chm.china.huawei.com (10.206.15.33) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 According to the logs of the eBPF CI, built kernel and tests are copied to a virtual machine to run there. Since a test for a new helper to verify PKCS#7 signatures requires to sign data to be verified, extend test_progs to store in the test_env data structure (accessible by individual tests) the path of sign-file and of the kernel private key and cert. Signed-off-by: Roberto Sassu --- tools/testing/selftests/bpf/test_progs.c | 12 ++++++++++++ tools/testing/selftests/bpf/test_progs.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c index c639f2e56fc5..90ce2c06a15e 100644 --- a/tools/testing/selftests/bpf/test_progs.c +++ b/tools/testing/selftests/bpf/test_progs.c @@ -707,6 +707,8 @@ enum ARG_KEYS { ARG_TEST_NAME_GLOB_DENYLIST = 'd', ARG_NUM_WORKERS = 'j', ARG_DEBUG = -1, + ARG_SIGN_FILE = 'S', + ARG_KERNEL_PRIV_CERT = 'C', }; static const struct argp_option opts[] = { @@ -732,6 +734,10 @@ static const struct argp_option opts[] = { "Number of workers to run in parallel, default to number of cpus." }, { "debug", ARG_DEBUG, NULL, 0, "print extra debug information for test_progs." }, + { "sign-file", ARG_SIGN_FILE, "PATH", 0, + "sign-file path " }, + { "kernel-priv-cert", ARG_KERNEL_PRIV_CERT, "PATH", 0, + "kernel private key and cert path " }, {}, }; @@ -862,6 +868,12 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state) case ARG_DEBUG: env->debug = true; break; + case ARG_SIGN_FILE: + env->sign_file_path = arg; + break; + case ARG_KERNEL_PRIV_CERT: + env->kernel_priv_cert_path = arg; + break; case ARGP_KEY_ARG: argp_usage(state); break; diff --git a/tools/testing/selftests/bpf/test_progs.h b/tools/testing/selftests/bpf/test_progs.h index 5fe1365c2bb1..9a860a59f06a 100644 --- a/tools/testing/selftests/bpf/test_progs.h +++ b/tools/testing/selftests/bpf/test_progs.h @@ -123,6 +123,9 @@ struct test_env { pid_t *worker_pids; /* array of worker pids */ int *worker_socks; /* array of worker socks */ int *worker_current_test; /* array of current running test for each worker */ + + const char *sign_file_path; /* sign-file path */ + const char *kernel_priv_cert_path; /* kernel priv key and cert path */ }; #define MAX_LOG_TRUNK_SIZE 8192 -- 2.25.1