Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2596566rdb; Fri, 8 Dec 2023 12:53:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IGNnaerlgT4H8B2kXmmT608Kjb3jqRvDW2fYVFXap1PHGzhKJmCDUBlVa+C3gTFWyS4A+oh X-Received: by 2002:a05:6a00:194f:b0:6ce:7656:5cc0 with SMTP id s15-20020a056a00194f00b006ce76565cc0mr735089pfk.7.1702068803382; Fri, 08 Dec 2023 12:53:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702068803; cv=none; d=google.com; s=arc-20160816; b=Val+PpdqeboZRSdbZ6lgfLPXBoXBQPdFkBbidbHZ0ES7kiO0DtaHUMKoclIDz5zAcV 2qdXBpB1ViI86TEic3Ox+4mLV+y2X4JMOtTaz2CA/UuN5WpvJ6BpivHMyVt2nDsW+7at ZEuWLVVZZq458gX+NBr1i6FLKkcNfJweAQyANEx6As3GW4RW7VnOQiLBW4m9eNelNG2y tU1TWMDdutdDjsPHlN4uDcpUXFxnMyb6pkfD+9qoZppPDiUbUhNp1KJEUU34bR5hwTCy sli5N3uxyjPklp8Ah56/57d8KHEaFwzomXtx+Qk25NicprF7Rbz5yTC6Yae49c9HAyJv oYLA== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=pY+mb/Qrc+JbGWeBCz5TAVT1HMlwaTqQprEMIVZfjU8=; fh=31pHNESfIDSRXSirSss2cSA7Q2Y3tA2WaWyHSS2Dgno=; b=wPSHm4rJpMJsVng+MUxD4QwO3YZWxa/VCQ84P8K+vkIb0q4kwmIQYYyUea+7Tl27sr jazjR7x/gaURBNF+BlzFggEuWWmszIMvw1fSEJC72sedKFDs2g8cWlzo5MOOHgadi0b6 Kd4PxlwBguKDfLekF/NvFyX/l12KpXOROQTmn2aywHRGs1bYkxKE1ZMgWM1VFWHqWw7P jw1jr/9woliJhleCI/ViR//rOeAY7KjwtS3G5cqwX/Wk/AE0JXS7Yq9Le4L+cz/q6Lj1 BUa5RSRe/PD6VqGBMZaKAWTGVEUc+6moG/T92IK0bErPZcjG60KfxejJEa6fjk0OTXkr hPJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=WKHjeQTz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id bo7-20020a056a02038700b005c637e836cfsi2176114pgb.885.2023.12.08.12.53.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 12:53:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=WKHjeQTz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 1BC1D81049A9; Fri, 8 Dec 2023 12:53:21 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230309AbjLHUxH (ORCPT + 99 others); Fri, 8 Dec 2023 15:53:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229572AbjLHUxG (ORCPT ); Fri, 8 Dec 2023 15:53:06 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1220F1723; Fri, 8 Dec 2023 12:53:13 -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-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=pY+mb/Qrc+JbGWeBCz5TAVT1HMlwaTqQprEMIVZfjU8=; b=WKHjeQTzRtUa3ehjWvBb5ptG7x X1dzOuu693YBY+CQHFy/qT0nKn2Rtrtilph4cDyUU95v7EfqZRN2J48VaQYxXO0T2gVnhWOXhE0VX e2RDNVyYfmERESlMze5ErEsZUmhi6JjG7R/f/Vilowo8kJYPyH89aai/nLxwgQEOZlMZyyOpI1eXu DOzbxNOqNhOZOlEiS95uxa0YfL8TLyAQ7SdFLWthPC+S3ZJZgmHNShsBWly0Hkz8oEDrmkn8W7jWu YwyK0LGYygYKKTgAEZ6IwlF4vKmbPECNkW13Q8NQI00pRT9EhYDKxuM6/3XNX7QDU331UhZ7nZZAG F0Y1aysQ==; 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 1rBhpx-006ZJN-SO; Fri, 08 Dec 2023 20:52:42 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 28FDA3003F0; Fri, 8 Dec 2023 21:52:41 +0100 (CET) Date: Fri, 8 Dec 2023 21:52:41 +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: <20231208205241.GK28727@noisy.programming.kicks-ass.net> References: <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> <20231208203535.GG36716@noisy.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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 agentk.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 (agentk.vger.email [0.0.0.0]); Fri, 08 Dec 2023 12:53:21 -0800 (PST) On Fri, Dec 08, 2023 at 12:41:03PM -0800, Alexei Starovoitov wrote: > On Fri, Dec 8, 2023 at 12:35 PM Peter Zijlstra wrote: > > -__bpf_kfunc void bpf_task_release(struct task_struct *p) > > +__bpf_kfunc void bpf_task_release(void *p) > > Yeah. That won't work. We need a wrapper. > Since bpf prog is also calling it directly. > In progs/task_kfunc_common.h > void bpf_task_release(struct task_struct *p) __ksym; > > than later both libbpf and the verifier check that > what bpf prog is calling actually matches the proto > of what is in the kernel. > Effectively we're doing strong prototype check at load time. I'm still somewhat confused on how this works, where does BPF get the address of the function from? and what should I call the wrapper? > btw instead of EXPORT_SYMBOL_GPL(bpf_task_release) > can __ADDRESSABLE be used ? > Since it's not an export symbol. No __ADDRESSABLE() is expressly ignored, but we have IBT_NOSEAL() that should do it. I'll rename the thing and lift it out of x86 to avoid breaking all other arch builds.