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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 248D6C433F5 for ; Tue, 9 Nov 2021 16:50:51 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E82AE610CF for ; Tue, 9 Nov 2021 16:50:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E82AE610CF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=06LMYxz8mqG4p0A86BTvHU12rhD0o51PGXyjdX1n/Lg=; b=FXlEi78UI4+OFF iMoGcn291p17NqlEKCZDGkCGML/pIr8h7zBSv96Xvxl5kfKJ4o1G9r1iLDP84+KNPWf+OfvybMmvA valtkCJkP9FugHCugmj/g2zu5sbgZAgTb7FgV6A447xvq3hzu+ze3wFojchT87gpQAJDi7k8b+XJp i7zXqR2WUCbMI1pF3VlIegfkPvMsixFB7bS3bdUbd3/mz3MPYbu9Bb0g3URy6rL7444j+R4hoU8wx AGLPMyLRnRtRp00onOBc4SpbTwUNiViMlgQrq3cXQ9AsbQ5G9i4uuwZnPJOd2tLcQD+Y2WhXaPfMM B2LJSZPpSJlQP7uvB84A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mkUJK-002keg-9A; Tue, 09 Nov 2021 16:49:26 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mkUGP-002jGA-K8 for linux-arm-kernel@lists.infradead.org; Tue, 09 Nov 2021 16:46:27 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 59BAD613B3; Tue, 9 Nov 2021 16:46:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636476385; bh=mY8bQKVatIszIv/ojyP72DOn1RLYXG4EALo/OHrynUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lHyJTqTQkDngAJxRYvXD0JlehrGzG7P4ullWuV9cAqOooyTPo/zOWU+3vIG986wIp YSIisS8p3TOhYHdgRk4+Vm+F0Y+2Ffq4uG/pqbPOoOwhpvqZ9NBKcaLgMTgEagAbrW 0HRpBeJjbKZR/phmVNfEqTpIct8wMp0oQ7RKO4k5i1pdK9WKbVUpt0tSCyWpgve7tA nmel1ezTYxKVX3XP+Rz6iFNxpiwt2zuVFmwwZKOoAfpZNMXyvjb9JiyPbaZws2AfFf xIROEoIfEk3pdoJhVNVXI8wi3zgvrMIZmjlpE3c+ZmGsGb+dT3yGk7wub6OtfCvkwW a4N2XyHnxNG8A== From: Ard Biesheuvel To: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Peter Zijlstra , Josh Poimboeuf , Jason Baron , Steven Rostedt , Mark Rutland , Kees Cook Subject: [RFC PATCH 7/7] static_call: add generic support for non-exported keys Date: Tue, 9 Nov 2021 17:45:49 +0100 Message-Id: <20211109164549.1724710-8-ardb@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211109164549.1724710-1-ardb@kernel.org> References: <20211109164549.1724710-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2665; h=from:subject; bh=mY8bQKVatIszIv/ojyP72DOn1RLYXG4EALo/OHrynUw=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBhiqW8pjJ/R8foOMwerUWPrX3XzSKG+oHwtotvxgmD jlbTXE6JAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCYYqlvAAKCRDDTyI5ktmPJCMDC/ 9FwatngAQAnYKGvkkmD2MYoewjSD6/wA1JeRJcQMIaFhEk+0OOTV+45/5AmTWB3HtJ7GSirV3jE5Cz lzX5wx2O3Ng74NQ6oJUiwjCwfPOQfxpUxq+p+q/btb4/xTOFm6SgPnrosF9Su4onhUUNUuGNp5oMbp pM9qJp0OgYlpaG339kRtmeUo2eD/LCBClHdEpfiep5Sh9Zny+nXMaaVnPRc7X4BqLpIDjNuRmuMhs/ ttqDVai/4NOgNVdPKZGOZR/ghLycKbHGnfLHS0wK4ot8Eyq9l7cR4HjezL/4sMzZV+vgq5sbb7zYR5 TD5762B+LZX0LAcKJ3tG1oIwxf1nnPcg3PJlL/NODmvPc579nb/RBQ/od2i0D4gKw54p7rkk4Ub172 VUprcR8Tjj62klNJctpJbfZU0xTUBTlaLN2nwTHMpuCQwr6P94wzEUa1ScmX9OSy7jNehNvWIOjhbP kU8rLW5w0LWRXTFdsXq6zdcxpUQROXv1soj3rsp2AAimI= X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211109_084625_719424_346E7123 X-CRM114-Status: GOOD ( 16.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The static_call feature where only the static call target is exposed to modules while access to the key is withheld is only implemented for the inline and out-of-line varieties, but not for the generic indirect call based variety. Let's use static_call_query() to obtain the call target address if the key is not exported. Note that this means we can do the converse as well, i.e., implement static_call_query() in terms of the key struct if the key is exported, so we only need to export one of the two. Note that this adds an additional load and potentially a direct call to the instantiations of static_call residing in module code. Signed-off-by: Ard Biesheuvel --- include/linux/static_call.h | 4 ++-- include/linux/static_call_types.h | 3 +-- tools/include/linux/static_call_types.h | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/include/linux/static_call.h b/include/linux/static_call.h index 21929147879a..d88fd613f06d 100644 --- a/include/linux/static_call.h +++ b/include/linux/static_call.h @@ -302,8 +302,8 @@ static inline int static_call_text_reserved(void *start, void *end) return 0; } -#define EXPORT_STATIC_CALL(name) EXPORT_SYMBOL(STATIC_CALL_KEY(name)) -#define EXPORT_STATIC_CALL_GPL(name) EXPORT_SYMBOL_GPL(STATIC_CALL_KEY(name)) +#define EXPORT_STATIC_CALL(name) EXPORT_STATIC_CALL_QUERY(name,) +#define EXPORT_STATIC_CALL_GPL(name) EXPORT_STATIC_CALL_QUERY(name, _GPL) #define EXPORT_STATIC_CALL_FOR_UPDATE(name) EXPORT_SYMBOL(STATIC_CALL_KEY(name)) #define EXPORT_STATIC_CALL_FOR_UPDATE_GPL(name) EXPORT_SYMBOL_GPL(STATIC_CALL_KEY(name)) diff --git a/include/linux/static_call_types.h b/include/linux/static_call_types.h index eae11c5b015d..920828ad1d69 100644 --- a/include/linux/static_call_types.h +++ b/include/linux/static_call_types.h @@ -106,8 +106,7 @@ struct static_call_key { void *func; }; -#define static_call(name) \ - ((typeof(STATIC_CALL_QUERY(name)()))(STATIC_CALL_KEY(name).func)) +#define static_call(name) static_call_query(name) #endif /* CONFIG_HAVE_STATIC_CALL */ diff --git a/tools/include/linux/static_call_types.h b/tools/include/linux/static_call_types.h index eae11c5b015d..920828ad1d69 100644 --- a/tools/include/linux/static_call_types.h +++ b/tools/include/linux/static_call_types.h @@ -106,8 +106,7 @@ struct static_call_key { void *func; }; -#define static_call(name) \ - ((typeof(STATIC_CALL_QUERY(name)()))(STATIC_CALL_KEY(name).func)) +#define static_call(name) static_call_query(name) #endif /* CONFIG_HAVE_STATIC_CALL */ -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel