From patchwork Tue Feb 22 10:23:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12754768 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 BBEE9C433F5 for ; Tue, 22 Feb 2022 10:23:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230502AbiBVKYN (ORCPT ); Tue, 22 Feb 2022 05:24:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230507AbiBVKYN (ORCPT ); Tue, 22 Feb 2022 05:24:13 -0500 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FECA83013; Tue, 22 Feb 2022 02:23:43 -0800 (PST) Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4K2wHd5ZpXz9sSV; Tue, 22 Feb 2022 11:23:41 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wzHtau34bAPV; Tue, 22 Feb 2022 11:23:41 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4K2wHd4pBLz9sSN; Tue, 22 Feb 2022 11:23:41 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 933C18B77A; Tue, 22 Feb 2022 11:23:41 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 31ddN_IQDOwK; Tue, 22 Feb 2022 11:23:41 +0100 (CET) Received: from PO20335.IDSI0.si.c-s.fr (unknown [172.25.230.108]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 740838B775; Tue, 22 Feb 2022 11:23:41 +0100 (CET) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.16.1) with ESMTPS id 21MANWH51075620 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 22 Feb 2022 11:23:32 +0100 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 21MANW8f1075619; Tue, 22 Feb 2022 11:23:32 +0100 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Aaron Tomlin , Luis Chamberlain , linux-modules@vger.kernel.org Cc: Christophe Leroy , linux-kernel@vger.kernel.org Subject: [PATCH 1/4] Fixup for 87b31159f78a ("module: Move all into module/") Date: Tue, 22 Feb 2022 11:23:24 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1645525381; l=1233; s=20211009; h=from:subject:message-id; bh=uSuQR2ZSU2t0Tv6BQdmIRToKcnjRDFHb05bjC+21ZUk=; b=S04yDIIXntxpV57+gsfk6Nx6NjKz3xlXNnVKb+XBmcAWgYG3toqyi73cBY/OkEJRWme1vD8sEP8W t0i6mF5WCRLTFBKOBN8qRVE6D27ZVPE82EKBpJJOV6tDpVis3Hct X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Precedence: bulk List-ID: Fixes: 87b31159f78a ("module: Move all into module/") Signed-off-by: Christophe Leroy --- kernel/Makefile | 1 - kernel/module/Makefile | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/Makefile b/kernel/Makefile index 3a6380975c57..04cb6932c0d3 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -29,7 +29,6 @@ KCOV_INSTRUMENT_softirq.o := n KCSAN_SANITIZE_softirq.o = n # These are called from save_stack_trace() on slub debug path, # and produce insane amounts of uninteresting coverage. -KCOV_INSTRUMENT_module.o := n KCOV_INSTRUMENT_extable.o := n KCOV_INSTRUMENT_stacktrace.o := n # Don't self-instrument. diff --git a/kernel/module/Makefile b/kernel/module/Makefile index 686ca921fc8f..b57953bd47eb 100644 --- a/kernel/module/Makefile +++ b/kernel/module/Makefile @@ -3,6 +3,10 @@ # Makefile for linux kernel module support # +# These are called from save_stack_trace() on slub debug path, +# and produce insane amounts of uninteresting coverage. +KCOV_INSTRUMENT_main.o := n + obj-$(CONFIG_MODULES) += main.o obj-$(CONFIG_MODULE_DECOMPRESS) += decompress.o obj-$(CONFIG_MODULE_SIG) += signing.o From patchwork Tue Feb 22 10:23:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12754769 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 97553C433F5 for ; Tue, 22 Feb 2022 10:23:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230507AbiBVKYS (ORCPT ); Tue, 22 Feb 2022 05:24:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231135AbiBVKYR (ORCPT ); Tue, 22 Feb 2022 05:24:17 -0500 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D846158DB0; Tue, 22 Feb 2022 02:23:52 -0800 (PST) Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4K2wHf6MWRz9sSN; Tue, 22 Feb 2022 11:23:42 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TQ-gzpr5xSeH; Tue, 22 Feb 2022 11:23:42 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4K2wHd4nnzz9sSK; Tue, 22 Feb 2022 11:23:41 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 932F58B779; Tue, 22 Feb 2022 11:23:41 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 8vrDJrTd5eun; Tue, 22 Feb 2022 11:23:41 +0100 (CET) Received: from PO20335.IDSI0.si.c-s.fr (unknown [172.25.230.108]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 772808B776; Tue, 22 Feb 2022 11:23:41 +0100 (CET) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.16.1) with ESMTPS id 21MANWRt1075626 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 22 Feb 2022 11:23:32 +0100 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 21MANWiC1075624; Tue, 22 Feb 2022 11:23:32 +0100 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Aaron Tomlin , Luis Chamberlain , linux-modules@vger.kernel.org Cc: Christophe Leroy , linux-kernel@vger.kernel.org Subject: [PATCH 2/4] Fixup for 1df95c1b9fb2 ("module: Move latched RB-tree support to a separate file") Date: Tue, 22 Feb 2022 11:23:25 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1645525381; l=1020; s=20211009; h=from:subject:message-id; bh=NOXJ5Q8e1krS6qZJ9mBihpkQrnS7a/WBEIo+/dze10c=; b=BDMY4vgJF0gcp2MqvOEGtH2HXvbetkUITO0cF6DCzxt/BvOq07dX4Cd6pxAMoDTk3i53BFRZyTh6 arThliuYB4ShUhhPe8FqrE3PqHNSEVdTCJC7qHiPLsdzNlXx2D5Q X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Precedence: bulk List-ID: Fixes: 1df95c1b9fb2 ("module: Move latched RB-tree support to a separate file") Signed-off-by: Christophe Leroy --- kernel/module/internal.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/module/internal.h b/kernel/module/internal.h index 47353c2e595b..97d9faec3a9a 100644 --- a/kernel/module/internal.h +++ b/kernel/module/internal.h @@ -158,9 +158,9 @@ void mod_tree_remove(struct module *mod); struct module *mod_find(unsigned long addr); #else /* !CONFIG_MODULES_TREE_LOOKUP */ -static void mod_tree_insert(struct module *mod) { } -static void mod_tree_remove_init(struct module *mod) { } -static void mod_tree_remove(struct module *mod) { } +static inline void mod_tree_insert(struct module *mod) { } +static inline void mod_tree_remove_init(struct module *mod) { } +static inline void mod_tree_remove(struct module *mod) { } static inline struct module *mod_find(unsigned long addr) { struct module *mod; From patchwork Tue Feb 22 10:23:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12754771 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 70867C433EF for ; Tue, 22 Feb 2022 10:24:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231149AbiBVKY2 (ORCPT ); Tue, 22 Feb 2022 05:24:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231147AbiBVKYX (ORCPT ); Tue, 22 Feb 2022 05:24:23 -0500 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 851AC1598D2; Tue, 22 Feb 2022 02:23:58 -0800 (PST) Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4K2wHh2GJxz9sS4; Tue, 22 Feb 2022 11:23:44 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jxVYnHUx8S-W; Tue, 22 Feb 2022 11:23:44 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4K2wHd57kTz9sSP; Tue, 22 Feb 2022 11:23:41 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 9E47E8B764; Tue, 22 Feb 2022 11:23:41 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id X5UJTYpoUT3A; Tue, 22 Feb 2022 11:23:41 +0100 (CET) Received: from PO20335.IDSI0.si.c-s.fr (unknown [172.25.230.108]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 7962C8B778; Tue, 22 Feb 2022 11:23:41 +0100 (CET) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.16.1) with ESMTPS id 21MANWiT1075630 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 22 Feb 2022 11:23:32 +0100 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 21MANW7r1075629; Tue, 22 Feb 2022 11:23:32 +0100 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Aaron Tomlin , Luis Chamberlain , linux-modules@vger.kernel.org Cc: Christophe Leroy , linux-kernel@vger.kernel.org Subject: [PATCH 3/4] Fixup for e5973a14d187 ("module: Move strict rwx support to a separate file") Date: Tue, 22 Feb 2022 11:23:26 +0100 Message-Id: <2c21af8d7dec7f76c0888f5487d0070b21060747.1645525354.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1645525381; l=3547; s=20211009; h=from:subject:message-id; bh=mLhyWEWSW/LPZmLaaZtAyoj0qoyMiE2w/STsvCOO5SQ=; b=TPhW276FZApI2vNw+S/EoGUx5IaX+EIkQtxffrvizLBGgr/zqQGeo+NpYOYV32NVwNqtcqY2xprZ 7DC638YbCDqoBmrCsb/iA3rSkogZ5DCggsl1dyJYGKryT2I8lwBK X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Precedence: bulk List-ID: Fixes: e5973a14d187 ("module: Move strict rwx support to a separate file") Signed-off-by: Christophe Leroy --- kernel/module/internal.h | 14 ++++---------- kernel/module/strict_rwx.c | 13 +++++++------ 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/kernel/module/internal.h b/kernel/module/internal.h index 97d9faec3a9a..6a54a1e06f4f 100644 --- a/kernel/module/internal.h +++ b/kernel/module/internal.h @@ -181,22 +181,16 @@ void frob_text(const struct module_layout *layout, int (*set_memory)(unsigned lo #endif /* CONFIG_ARCH_HAS_STRICT_MODULE_RWX */ #ifdef CONFIG_STRICT_MODULE_RWX -void frob_rodata(const struct module_layout *layout, - int (*set_memory)(unsigned long start, int num_pages)); -void frob_ro_after_init(const struct module_layout *layout, - int (*set_memory)(unsigned long start, int num_pages)); -void frob_writable_data(const struct module_layout *layout, - int (*set_memory)(unsigned long start, int num_pages)); void module_enable_ro(const struct module *mod, bool after_init); void module_enable_nx(const struct module *mod); int module_enforce_rwx_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs, char *secstrings, struct module *mod); #else /* !CONFIG_STRICT_MODULE_RWX */ -static void module_enable_nx(const struct module *mod) { } -static void module_enable_ro(const struct module *mod, bool after_init) {} -static int module_enforce_rwx_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs, - char *secstrings, struct module *mod) +static inline void module_enable_nx(const struct module *mod) { } +static inline void module_enable_ro(const struct module *mod, bool after_init) {} +static inline int module_enforce_rwx_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs, + char *secstrings, struct module *mod) { return 0; } diff --git a/kernel/module/strict_rwx.c b/kernel/module/strict_rwx.c index c642889f8e77..bfee740f4bc1 100644 --- a/kernel/module/strict_rwx.c +++ b/kernel/module/strict_rwx.c @@ -6,12 +6,13 @@ */ #include +#include #include #include #include "internal.h" -void frob_rodata(const struct module_layout *layout, - int (*set_memory)(unsigned long start, int num_pages)) +static void frob_rodata(const struct module_layout *layout, + int (*set_memory)(unsigned long start, int num_pages)) { BUG_ON(!PAGE_ALIGNED(layout->base)); BUG_ON(!PAGE_ALIGNED(layout->text_size)); @@ -20,8 +21,8 @@ void frob_rodata(const struct module_layout *layout, (layout->ro_size - layout->text_size) >> PAGE_SHIFT); } -void frob_ro_after_init(const struct module_layout *layout, - int (*set_memory)(unsigned long start, int num_pages)) +static void frob_ro_after_init(const struct module_layout *layout, + int (*set_memory)(unsigned long start, int num_pages)) { BUG_ON(!PAGE_ALIGNED(layout->base)); BUG_ON(!PAGE_ALIGNED(layout->ro_size)); @@ -30,8 +31,8 @@ void frob_ro_after_init(const struct module_layout *layout, (layout->ro_after_init_size - layout->ro_size) >> PAGE_SHIFT); } -void frob_writable_data(const struct module_layout *layout, - int (*set_memory)(unsigned long start, int num_pages)) +static void frob_writable_data(const struct module_layout *layout, + int (*set_memory)(unsigned long start, int num_pages)) { BUG_ON(!PAGE_ALIGNED(layout->base)); BUG_ON(!PAGE_ALIGNED(layout->ro_after_init_size)); From patchwork Tue Feb 22 10:23:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12754770 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 999D2C4332F for ; Tue, 22 Feb 2022 10:23:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231138AbiBVKYW (ORCPT ); Tue, 22 Feb 2022 05:24:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231136AbiBVKYU (ORCPT ); Tue, 22 Feb 2022 05:24:20 -0500 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA9041598C9; Tue, 22 Feb 2022 02:23:55 -0800 (PST) Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4K2wHg4fYyz9sSK; Tue, 22 Feb 2022 11:23:43 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FvcC2oE_30W0; Tue, 22 Feb 2022 11:23:43 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4K2wHd4nGdz9sS4; Tue, 22 Feb 2022 11:23:41 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 944358B77B; Tue, 22 Feb 2022 11:23:41 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id XmT3q87Ny7oE; Tue, 22 Feb 2022 11:23:41 +0100 (CET) Received: from PO20335.IDSI0.si.c-s.fr (unknown [172.25.230.108]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 7406B8B764; Tue, 22 Feb 2022 11:23:41 +0100 (CET) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.16.1) with ESMTPS id 21MANWHf1075634 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 22 Feb 2022 11:23:32 +0100 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 21MANWI91075633; Tue, 22 Feb 2022 11:23:32 +0100 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Aaron Tomlin , Luis Chamberlain , linux-modules@vger.kernel.org Cc: Christophe Leroy , linux-kernel@vger.kernel.org Subject: [PATCH 4/4] Fixup for 54f2273e5fef ("module: Move kallsyms support into a separate file") Date: Tue, 22 Feb 2022 11:23:27 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1645525381; l=1918; s=20211009; h=from:subject:message-id; bh=FwgKdS8iKTLyex0Nq0FuY+Z+GBgNinuvCSGTdhHJdHE=; b=DsVT5DK2ayAeHEte4buz0UVJdqIJgYq6FRU0e1bCzfZ+8vzNZ9KnSBy9zMz78wCi6FMFiZPHlMGj qkXnAe06AmfHNMdFfIWvk836nHcPaiRKyjrqz3muXgrL1M9V0eZF X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Precedence: bulk List-ID: Fixes: 54f2273e5fef ("module: Move kallsyms support into a separate file") Signed-off-by: Christophe Leroy --- kernel/module/internal.h | 7 ++++--- kernel/module/kallsyms.c | 3 +-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel/module/internal.h b/kernel/module/internal.h index 6a54a1e06f4f..fecfa590c149 100644 --- a/kernel/module/internal.h +++ b/kernel/module/internal.h @@ -212,12 +212,13 @@ static inline void kmemleak_load_module(const struct module *mod, const struct load_info *info) { } #endif /* CONFIG_DEBUG_KMEMLEAK */ -#ifdef CONFIG_KALLSYMS -#ifdef CONFIG_STACKTRACE_BUILD_ID +#if defined(CONFIG_KALLSYMS) && defined(CONFIG_STACKTRACE_BUILD_ID) void init_build_id(struct module *mod, const struct load_info *info); -#else /* !CONFIG_STACKTRACE_BUILD_ID */ +#else static inline void init_build_id(struct module *mod, const struct load_info *info) { } #endif + +#ifdef CONFIG_KALLSYMS void layout_symtab(struct module *mod, struct load_info *info); void add_kallsyms(struct module *mod, const struct load_info *info); unsigned long find_kallsyms_symbol_value(struct module *mod, const char *name); diff --git a/kernel/module/kallsyms.c b/kernel/module/kallsyms.c index 6c8f1f390cf5..2ee8d2e67068 100644 --- a/kernel/module/kallsyms.c +++ b/kernel/module/kallsyms.c @@ -171,8 +171,7 @@ void add_kallsyms(struct module *mod, const struct load_info *info) Elf_Shdr *symsec = &info->sechdrs[info->index.sym]; /* Set up to point into init section. */ - mod->kallsyms = (struct mod_kallsyms __rcu *)mod->init_layout.base + - info->mod_kallsyms_init_off; + mod->kallsyms = (void __rcu *)mod->init_layout.base + info->mod_kallsyms_init_off; /* The following is safe since this pointer cannot change */ rcu_dereference_sched(mod->kallsyms)->symtab = (void *)symsec->sh_addr;