Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2598085rdb; Fri, 8 Dec 2023 12:57:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IEpWlonpZnKWZI/fgIgRkJSxNc2DEnVBZt9qGOtS5W5Cey8yikT00KbFbSwG7TDR791pRo3 X-Received: by 2002:a05:6a20:a111:b0:190:17a6:24b7 with SMTP id q17-20020a056a20a11100b0019017a624b7mr744442pzk.19.1702069050999; Fri, 08 Dec 2023 12:57:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702069050; cv=none; d=google.com; s=arc-20160816; b=WVuW82MUF1g5Xl5hEjWf4qDpz9j1ya8+drRI1vAxmXnhwRCdY1lqdnDonio0wHSo7B GiPlvVNmRc24odpJFU24XVusIs03oPk6CSn6AtpIAO1qGtWqcN8We4odMrjXHRubYsWO Frp3dGx+zgEav1mmCuaq73Qx9ttWR9TtUJBls6QYJeSE1bJEUwFAjBLPgoXqK/Y0ZQPW DXD66gMaT/aV3uFPrMxGtBCPwpxMTp4FTSUMWhpAVST1HbEuQS0R1q+bNZs2mLrdGD9K 0bXUIhNf5RWklh3D2MDlgXooaukNk34+tTO4AvD++AT5iEBtmC0yToOfv2wUIfvKFlpx BTvw== 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=tsh6SZmjsiAnQNburkJFUqIGTSKo136cXIGADj2mGbk=; fh=31pHNESfIDSRXSirSss2cSA7Q2Y3tA2WaWyHSS2Dgno=; b=d8StcdwVRPzafXPIqNwOFpZF49OMZsTIFbzfkzINS/QOSCk8BFtvgaefwvnatOTfOh DnUb3PnHVyoIWd1XNKgG6HKi7zReMao1V4Xl+t/Dbb7QVa4C86r+yN3tcm7EAl2M10Sy Qr8MGwj3lkVs0DeKv3N4jYTiEvKj/uUnH89dZQdx8G7DbzIrdJzNMpyVK4XNvoRD2TRu NBSB5et3njRyGl+lx0yYzQGM+GIZmFj0lk0QN5SXNupGkEkefglQCgP5u8AfWkMBGotp zxQQi8lC7pvinIHL0I5cpahMSF1iakOHZ3lrg5CtMNt58o9dkhWwk5x9fUQv9kT+BhGg 5dHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=nka5h3yC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id p22-20020a056a000b5600b006ce6da9d524si2008725pfo.326.2023.12.08.12.57.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 12:57:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=nka5h3yC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 A4D7281F9671; Fri, 8 Dec 2023 12:57:28 -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 S229817AbjLHU5O (ORCPT + 99 others); Fri, 8 Dec 2023 15:57:14 -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: 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:57:28 -0800 (PST) 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.