Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2590196rdb; Fri, 8 Dec 2023 12:36:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IGfE749y/0fN45GvG7tjrygiAQVx3+zWqwq3qrNPxslk71DMFL36dPOW06X01dXKRGiWo6C X-Received: by 2002:a17:902:d490:b0:1d2:f388:6df7 with SMTP id c16-20020a170902d49000b001d2f3886df7mr774884plg.16.1702067778611; Fri, 08 Dec 2023 12:36:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702067778; cv=none; d=google.com; s=arc-20160816; b=ZRvG9wAXlcEgV+wT4pZsUv8f979SQlc04MNN0xnSPRFXD6HwTzYKukDXpdBlqjTatK eeXAvP96VXRewL67jfd1uedyaR6Hb+E1Sq47XTu9JNucDT+pzA5U2HENtV2OX/vozUKN 7XYWl84dvdrXHN8Dyz+Pe/AnL5/l6YUPQDGszlbE7B429zGw/DPTv0R0BTi6IZm0+2ud g7tuqZh4UpC3O12p6TYvGdzcDvIxUTi5913gANtjhTciTWQcL053ll2TNZfNTEaBGqhO /AdjUYD3HQHrfIAYa8XWqdkQViu7fZX4ZtLMSYWFUbxFSjX89JAkHvrmjEU2ASe/6RJ6 KHyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Vwp6H7hbWYuJntJS7kS+l0fw/Z+oOc8mMbOkVe4byro=; fh=31pHNESfIDSRXSirSss2cSA7Q2Y3tA2WaWyHSS2Dgno=; b=rD0b3gkkV1PwhMFxCrSIgbssftU0AeGJOraWbWp6m9+Ne70WcJwaFrak/CQl66YxTc a7sDifp3UmUfiTtGtwt9moJ1cPwXQ55UtUFZWouyN7WRtUYT0SukG3la7mA+zqaVd8NS YeVh98HzkGju0RXNe7olJCNSfYau0sfFGKO7QF2HCqTwu8BmFRahXSK/vo53/RgZ5Ap0 UkNI3bPDIN139jpQedQHwvgPU/essB2xHJE4CjOqhuv/223mpywKe0gRzq/U/AMhWoZ6 /IywbSK///3ezWPRLLEuSw3p5/Zt4JMKaPIRNPJ1zw4IM5QqF5D2ZNz/W6+K0dcufk4K LrrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="VXkjzuM/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id t8-20020a1709028c8800b001d069748938si1998156plo.105.2023.12.08.12.36.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 12:36:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="VXkjzuM/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id BFC1A81F9647; Fri, 8 Dec 2023 12:36:15 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233862AbjLHUgB (ORCPT + 99 others); Fri, 8 Dec 2023 15:36:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229772AbjLHUf7 (ORCPT ); Fri, 8 Dec 2023 15:35:59 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E962210F8; Fri, 8 Dec 2023 12:36:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Vwp6H7hbWYuJntJS7kS+l0fw/Z+oOc8mMbOkVe4byro=; b=VXkjzuM/7GoObftnaEWoZgdFYY L5xDBcOtO5SXticci6clYrj1K1KscYr+MoTjFYUkZz0ZWWNRoMSMcKuxO0tsaM3zEfH6eF3zU5j8O cUQI6yZ66caIvr7dscGTiK/hdDneafs8+XW2NtmcUWud886gJjMgBetRpivFI+2k3nYvnsQp65YfB hU4YX9RUqEib/aVz06p8+wivpoxMEz+kH1paTVnnirP857fswwl5sTiNJ8EbLZQRfKs655qDWsKpA jp0nWHX5uHWgqj/v4iexBNwei3DfCgzFy0X4rATHIUUHZG65pJYjJNbS3wxpBgX7DtbfBf97DzDCW GFrHBhQQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1rBhZP-006WtK-Ib; Fri, 08 Dec 2023 20:35:35 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 3799630050D; Fri, 8 Dec 2023 21:35:35 +0100 (CET) Date: Fri, 8 Dec 2023 21:35:35 +0100 From: Peter Zijlstra To: Alexei Starovoitov Cc: Jiri Olsa , Song Liu , Song Liu , Paul Walmsley , Palmer Dabbelt , Albert Ou , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , X86 ML , "H. Peter Anvin" , "David S. Miller" , David Ahern , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Arnd Bergmann , Sami Tolvanen , Kees Cook , Nathan Chancellor , Nick Desaulniers , linux-riscv , LKML , Network Development , bpf , linux-arch , clang-built-linux , Josh Poimboeuf , Joao Moreira , Mark Rutland Subject: Re: [PATCH v2 2/2] x86/cfi,bpf: Fix BPF JIT call Message-ID: <20231208203535.GG36716@noisy.programming.kicks-ass.net> References: <20231206163814.GB36423@noisy.programming.kicks-ass.net> <20231206183713.GA35897@noisy.programming.kicks-ass.net> <20231207093105.GA28727@noisy.programming.kicks-ass.net> <20231208102940.GB28727@noisy.programming.kicks-ass.net> <20231208134041.GD28727@noisy.programming.kicks-ass.net> <20231208172152.GD36716@noisy.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 08 Dec 2023 12:36:15 -0800 (PST) On Fri, Dec 08, 2023 at 11:40:27AM -0800, Alexei Starovoitov wrote: > typedef void (*btf_dtor_kfunc_t)(void *); > btf_dtor_kfunc_t dtor; > but the bpf_cgroup_release takes 'struct cgroup*'. > From kcfi pov void * == struct cgroup * ? > Do we need to change it to 'void *cgrp' ? Yes, doing that naively like the below, gets me lovely things like: validate_case:FAIL:expect_msg unexpected error: -22 VERIFIER LOG: ============= ============= EXPECTED MSG: 'Possibly NULL pointer passed to trusted arg0' #48/7 cgrp_kfunc/cgrp_kfunc_acquire_untrusted:FAIL run_subtest:PASS:obj_open_mem 0 nsec libbpf: extern (func ksym) 'bpf_cgroup_release': func_proto [148] incompatible with vmlinux [125610] libbpf: failed to load object 'cgrp_kfunc_failure' But let me try rebuilding everything.. --- diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c index b3be5742d6f1..078b207af7f0 100644 --- a/kernel/bpf/helpers.c +++ b/kernel/bpf/helpers.c @@ -2145,10 +2145,11 @@ __bpf_kfunc struct task_struct *bpf_task_acquire(struct task_struct *p) * bpf_task_release - Release the reference acquired on a task. * @p: The task on which a reference is being released. */ -__bpf_kfunc void bpf_task_release(struct task_struct *p) +__bpf_kfunc void bpf_task_release(void *p) { put_task_struct_rcu_user(p); } +EXPORT_SYMBOL_GPL(bpf_task_release); #ifdef CONFIG_CGROUPS /** @@ -2169,10 +2170,11 @@ __bpf_kfunc struct cgroup *bpf_cgroup_acquire(struct cgroup *cgrp) * drops to 0. * @cgrp: The cgroup on which a reference is being released. */ -__bpf_kfunc void bpf_cgroup_release(struct cgroup *cgrp) +__bpf_kfunc void bpf_cgroup_release(void *cgrp) { cgroup_put(cgrp); } +EXPORT_SYMBOL_GPL(bpf_cgroup_release); /** * bpf_cgroup_ancestor - Perform a lookup on an entry in a cgroup's ancestor