From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C4F31EB24 for ; Fri, 8 Dec 2023 20:53:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="WKHjeQTz" 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> Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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.