Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2547117rwb; Mon, 19 Sep 2022 06:43:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM59mqkfBMEe+4Bgsbs210D16Xie0yci7i8Cl+M2YPREmUka9W2FL23PipSbCbBnRlXkbmbN X-Received: by 2002:a17:90a:d50b:b0:200:76c6:9cef with SMTP id t11-20020a17090ad50b00b0020076c69cefmr20886357pju.232.1663595027395; Mon, 19 Sep 2022 06:43:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663595027; cv=none; d=google.com; s=arc-20160816; b=dJJgMMnOY8a7PT6bsXfFz2/3y7/8dk+bZgdtDhj+bfRvq16YZqkHuTlkiBY2sRqaqh NuqdBODpg0+yvDB/udBblCPMTYlF2IRLr9Fh25swlRA/8FRjXEMIYC5eooTNsEm3HG9s fcTHxuO1dLQjolaXRXi3qU9mZz/5eaHbP4IIaGsjoeXr4Ml8WJWnSEJb8vb3tDg/hn2y lzAWuUc0cb/QgPE8KRWkm3SSEHjKH2wy6bwf/yephaUFgKzaRkqPdpFwawNuD2oW6yka vpRQTjpKeLuw/I8/e2BtW8VbjzEdBWnuVWQNb3AOKSaHMAlH6tZX57BWwUBCRPOpdb8J /JOg== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=GhUv/EF1jWR2GD02ju1QK38nEf8JC2tace/EmGICNRQ=; b=ZxUyI8j/bWLVEAnDnUmvq4OfbeeHd59tPde5fLmyYkw8J2/NIypyfY/Ov9CJIpUxFI Tp224PyUM46jXy4Wdnz/qLJE1OcjDYwbu9qyq3qciWc3p11JJkBEHnhd2Yh3+tPSmZH9 sZnnTOQk6ePJp7gdxYk754rgoY00GuKCIpIwjQwxN1G6jBwza8YeB2NydHG/zum+hmkG 0M+XurzJt75PZ6a7L09K7QFnBGAbdZoLDSd+IWl4Quw8qXu+VWSM6ODbqs2lurcSgYMN yAgEy24vP+EPaejlesp0ekaJ1eDbOe+G3UDgPEYXlhDJkLgdaqp++MSkaIqJ5yQnxw32 pLXQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f1-20020a636a01000000b0043a256f5b17si3657705pgc.555.2022.09.19.06.43.34; Mon, 19 Sep 2022 06:43:47 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229731AbiISNKd (ORCPT + 99 others); Mon, 19 Sep 2022 09:10:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229732AbiISNK0 (ORCPT ); Mon, 19 Sep 2022 09:10:26 -0400 Received: from frasgout11.his.huawei.com (frasgout11.his.huawei.com [14.137.139.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 009C217061; Mon, 19 Sep 2022 06:10:22 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.18.147.229]) by frasgout11.his.huawei.com (SkyGuard) with ESMTP id 4MWPyn1jNKz9v7gP; Mon, 19 Sep 2022 21:04:33 +0800 (CST) Received: from roberto-ThinkStation-P620 (unknown [10.204.63.22]) by APP2 (Coremail) with SMTP id GxC2BwCHA14TaihjId9cAA--.3S2; Mon, 19 Sep 2022 14:09:53 +0100 (CET) Message-ID: <64e8ef59363bcd0f314d4e1eb7483f4dd2b7dbcf.camel@huaweicloud.com> Subject: Re: [PATCH v17 11/12] selftests/bpf: Add test for bpf_verify_pkcs7_signature() kfunc From: Roberto Sassu To: KP Singh Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, sdf@google.com, haoluo@google.com, jolsa@kernel.org, mykolal@fb.com, dhowells@redhat.com, jarkko@kernel.org, rostedt@goodmis.org, mingo@redhat.com, paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com, shuah@kernel.org, bpf@vger.kernel.org, keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, deso@posteo.net, memxor@gmail.com, Roberto Sassu , Joanne Koong Date: Mon, 19 Sep 2022 15:09:37 +0200 In-Reply-To: <045a177ebb15bbf406c4c4d75f48dd45e810be8e.camel@huaweicloud.com> References: <20220909120736.1027040-1-roberto.sassu@huaweicloud.com> <20220909120736.1027040-12-roberto.sassu@huaweicloud.com> <045a177ebb15bbf406c4c4d75f48dd45e810be8e.camel@huaweicloud.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5-0ubuntu1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-CM-TRANSID: GxC2BwCHA14TaihjId9cAA--.3S2 X-Coremail-Antispam: 1UD129KBjvJXoW7WFy7Xw4ftw1UJFWUuF1UAwb_yoW8ZFW3pF 18Ga1DGr48tr17Gw1Iv3WYqrWxt395Xr1UWr1UX34j9r92qr9rCr4xKrW5ur9IqrZYkr4Y v3y2g3ya9rn5u3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkjb4IE77IF4wAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4 vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Jr0_JF4l84ACjcxK6xIIjxv20xvEc7Cj xVAFwI0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8JVWxJwA2z4x0Y4vEx4A2jsIEc7CjxV AFwI0_Gr0_Gr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40E x7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x 0Yz7v_Jr0_Gr1lF7xvr2IY64vIr41lFIxGxcIEc7CjxVA2Y2ka0xkIwI1l42xK82IYc2Ij 64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x 8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r4a6rW5MIIYrxkI7VAKI48JMIIF0xvE 2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42 xK8VAvwI8IcIk0rVWrZr1j6s0DMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIE c7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x07UAkuxUUUUU= X-CM-SenderInfo: purev21wro2thvvxqx5xdzvxpfor3voofrz/1tbiAQAABF1jj4M3uwAAs7 X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham 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 On Mon, 2022-09-19 at 13:17 +0200, Roberto Sassu wrote: > On Thu, 2022-09-15 at 17:11 +0100, KP Singh wrote: > > On Fri, Sep 9, 2022 at 1:10 PM Roberto Sassu > > wrote: > > > From: Roberto Sassu > > > > > > > [...] > > > > > +} > > > diff --git > > > a/tools/testing/selftests/bpf/progs/test_verify_pkcs7_sig.c > > > b/tools/testing/selftests/bpf/progs/test_verify_pkcs7_sig.c > > > new file mode 100644 > > > index 000000000000..4ceab545d99a > > > --- /dev/null > > > +++ b/tools/testing/selftests/bpf/progs/test_verify_pkcs7_sig.c > > > @@ -0,0 +1,100 @@ > > > +// SPDX-License-Identifier: GPL-2.0 > > > + > > > +/* > > > + * Copyright (C) 2022 Huawei Technologies Duesseldorf GmbH > > > + * > > > + * Author: Roberto Sassu > > > + */ > > > + > > > +#include "vmlinux.h" > > > +#include > > > +#include > > > +#include > > > + > > > +#define MAX_DATA_SIZE (1024 * 1024) > > > +#define MAX_SIG_SIZE 1024 > > > + > > > +typedef __u8 u8; > > > +typedef __u16 u16; > > > +typedef __u32 u32; > > > +typedef __u64 u64; > > > > I think you can avoid this and just use u32 and u64 directly. > > Thanks, yes. > > > + > > > +struct bpf_dynptr { > > > + __u64 :64; > > > + __u64 :64; > > > +} __attribute__((aligned(8))); > > > + > > > > I think you are doing this because including the uapi headers > > causes > > type conflicts. > > This does happen quite often. What do other folks think about doing > > something like > > > > #define DYNPTR(x) ((void *)x) > > > > It seems like this will be an issue anytime we use the helpers with > > vmlinux.h and users > > will always have to define this type in their tests. > > It seems it is sufficient to use struct bpf_dynptr somehow in the > kernel code. That causes the definition to be exported with BTF. Not > sure what would be the proper place to do that. When I tried, I > declared a unused variable. Easier: BTF_TYPE_EMIT(struct bpf_dynptr); I added it in bpf_dynptr_from_mem(), right? Thanks Roberto