From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8831C4167B for ; Fri, 8 Dec 2023 20:57:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234294AbjLHU5Q (ORCPT ); Fri, 8 Dec 2023 15:57:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229913AbjLHU5N (ORCPT ); Fri, 8 Dec 2023 15:57:13 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8CA61AD; Fri, 8 Dec 2023 12:57:19 -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=tsh6SZmjsiAnQNburkJFUqIGTSKo136cXIGADj2mGbk=; b=nka5h3yCL1hCZw1C09D5tWSVAL 4oQHmkY/q1dbCaw6qBSKd5XLLGIKuHgbyn9RktMJngKJ2sNKt79QXC0EcciTcnntYjAWwUABeK5Jc DXBmAfjnz63AvHfOOdBAkoCfu6fYm4SLROgyQzZJIPKCJ/YGV8KMZtE/W3z86PxOEWqPjYFsjhXup Kspp6P26tuanNWKE+ldEJoXw8TQwn787U5ABY5A4BGUxEueMUccx2IZDmrEMBfPmXxeM7u22FagVf jk4SlD2jX4uZ6J5wYWrTcUhKwtVQtreODt+nuVfdAs2I6RbfoJuSeyqbH1OGoM94umgRc/l/HKq95 UUw+dgnA==; 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 1rBhtv-006ZnV-M1; Fri, 08 Dec 2023 20:56:48 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 534BF3003F0; Fri, 8 Dec 2023 21:56:47 +0100 (CET) Date: Fri, 8 Dec 2023 21:56:47 +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: <20231208205647.GL28727@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> <20231208201819.GE36716@noisy.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 08, 2023 at 12:45:51PM -0800, Alexei Starovoitov wrote: > I mean we don't need to store a pointer to a func in stubs. > Can it be, roughly: > > extern void bpf_tcp_ca_cong_avoid(struct sock *sk, u32 ack, u32 acked); > KCFI_MACRO(hash_of_cong_avoid, bpf_tcp_ca_cong_avoid); > u32 __array_of_kcfi_hash[] = {hash_of_cong_avoid, hash_of_set_state,...}; > .bpf_ops_stubs = __array_of_kcfi_hash, But then how do I index this array? The bpf_ops_stubs thing having the same layout at the target struct made it easy and we could use 'moff' for both. That also remains working if someone adds a member to the struct or moves some members around.