Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp619766pxh; Tue, 9 Nov 2021 16:17:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJyNOo/k+YXuxuUDCSZNl+hmIY94kFfCcXemb62xHmvH9JIF6/8c19VDAc3Y0XY5SYlGxu5g X-Received: by 2002:a17:907:3daa:: with SMTP id he42mr15305833ejc.160.1636503469492; Tue, 09 Nov 2021 16:17:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636503469; cv=none; d=google.com; s=arc-20160816; b=W35FJdv6jrfAFIFBZ9FnpK3lmBKSL2fZ+WXqkPS94Ucf077Hq9MLZ1foDBn4uXn9VR 6jwKnMRp4hnM7HnqSSJpCT2+P7HQFvf9ErcBUPgmYJSskak5yKdQAjC8riuaCgU4AfcG RTa30Nh3pNtItCy9rQNuvrubeftLg+bvkac6SLv6jM/j/W+gGJRylm6AV6QqqS6Pzlr0 mQeVdWNMsDBPmlWf2mqcHHOtAVGy/AhajK+gDmGn6+aGb4E1z1cEwy3bpEyXiqRsuob2 kZpsQqmRxPO4wz0m9yugXz7ZrRhHBcNSwhbBppno8a3Z5x3zoPAzO6E0iSsTJ2SOyoBh skpQ== 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=5XIGjkcGERAZzzieuikWA1xHtahXazjRcK+wygMzymM=; b=oz4q+QTacfj4AIPfdw/gWzKFzyAYYC+nKUUNChScZjnM+bmcMrAMwrv7syT17allVR M0cDxLsVYKp7qQ+i4D/aWCbfs6n4jT6BTy8GUP133xb0xZVEOJt1Ce4NnTPf7thbAdFM F9xloSFcQ92Km/lincXfbEe7rR8Nc5g/3onTDbWnj4KyX0o22IKNoDjulZhcag3UmRV+ hatlm+r6oCFGSSi9np8E9ABQTWMbbv3chBCewWgyeU8hVKdX6EppquiDYoqFxxn9yp2j 7kZIartMTpZ1eBlQs0sWjgwUl7XI4XLhbiqSi/HbPG9miF7MT0qFeBi4zlzt+yRtsJ0D 8xkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=WKWDuZNu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ck13si32456711edb.463.2021.11.09.16.17.26; Tue, 09 Nov 2021 16:17:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=WKWDuZNu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243825AbhKITpb (ORCPT + 97 others); Tue, 9 Nov 2021 14:45:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237907AbhKITpb (ORCPT ); Tue, 9 Nov 2021 14:45:31 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C82CFC061764 for ; Tue, 9 Nov 2021 11:42:44 -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=5XIGjkcGERAZzzieuikWA1xHtahXazjRcK+wygMzymM=; b=WKWDuZNuWlOOcpDVQuK6Xl1kSY Ed13XediStqyXCnxwD9QZzahRcQMBaWkAsAHnY2SGUIKfgx63Y2nHmc0++fR9fqIu+fdUpb/grb/J ClsuHE03J3dqw76LVtLWs77d0VTO+wYQ8u4VIclk2S39zvs90ZkBCkZjrKE36+Kej+8e6hfuA1B9s tWYvCmsP9yx2TNmthj7PMno1BEYAJ2ITWNTQixWtrHeIodrSkBzcjGVK6BrWpiqpStusU+/xSYBaa sAuyY6ESdY+50u3pjB1kJefmDMpk2pwEH1QO8CWmslMwxeOwOyosy86BzS+McIG788gv5Jxt4UN9s H9ETOffQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mkX0n-001I9n-EV; Tue, 09 Nov 2021 19:42:30 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id CC6D03000A3; Tue, 9 Nov 2021 20:42:29 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id BC2292C525D3C; Tue, 9 Nov 2021 20:42:29 +0100 (CET) Date: Tue, 9 Nov 2021 20:42:29 +0100 From: Peter Zijlstra To: Ard Biesheuvel Cc: Linux Kernel Mailing List , Linux ARM , Josh Poimboeuf , Jason Baron , Steven Rostedt , Mark Rutland , Kees Cook Subject: Re: [RFC PATCH 3/7] static_call: use helper to access non-exported key Message-ID: References: <20211109164549.1724710-1-ardb@kernel.org> <20211109164549.1724710-4-ardb@kernel.org> 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 Tue, Nov 09, 2021 at 07:54:23PM +0100, Ard Biesheuvel wrote: > On Tue, 9 Nov 2021 at 19:53, Peter Zijlstra wrote: > > > > On Tue, Nov 09, 2021 at 05:45:45PM +0100, Ard Biesheuvel wrote: > > > @@ -196,13 +190,21 @@ extern long __static_call_return0(void); > > > EXPORT_SYMBOL_GPL(STATIC_CALL_KEY(name)); \ > > > EXPORT_SYMBOL_GPL(STATIC_CALL_TRAMP(name)) > > > > > > +#define EXPORT_STATIC_CALL_GETKEY_HELPER(name) \ > > > + struct static_call_key *STATIC_CALL_GETKEY(name)(void) { \ > > > + BUG_ON(!core_kernel_text( \ > > > + (unsigned long)__builtin_return_address(0))); \ > > > + return &STATIC_CALL_KEY(name); \ > > > + } \ > > > + EXPORT_SYMBOL_GPL(STATIC_CALL_GETKEY(name)) > > > > So if I were a nevarious module, I would look up the above symbol from > > kallsyms (it is exported and easily obtainable) and then simply > > read the text to discover the key address and we're in business. > > > > Yeah I realised that. So would you prefer to have a > .static_call_tramp_key section in each module and look up the keys in > the module loader? Think so... do you actually have a need for this?