From patchwork Tue Feb 22 15:00:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12755286 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91F98C433EF for ; Tue, 22 Feb 2022 15:02:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2BB418D0003; Tue, 22 Feb 2022 10:02:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 26B088D0001; Tue, 22 Feb 2022 10:02:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 132A18D0003; Tue, 22 Feb 2022 10:02:03 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 062278D0001 for ; Tue, 22 Feb 2022 10:02:03 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id A53C322D68 for ; Tue, 22 Feb 2022 15:02:02 +0000 (UTC) X-FDA: 79170730884.04.44734A0 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf31.hostedemail.com (Postfix) with ESMTP id 21B642000B for ; Tue, 22 Feb 2022 15:01:56 +0000 (UTC) Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4K32RN4Yt5z9sSX; Tue, 22 Feb 2022 16:00:48 +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 jUS-I58NIWE3; Tue, 22 Feb 2022 16:00:48 +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 4K32RF4Tbmz9sSq; Tue, 22 Feb 2022 16:00:41 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 89CBD8B778; Tue, 22 Feb 2022 16:00: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 twoxT6Wk121T; Tue, 22 Feb 2022 16:00:41 +0100 (CET) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.7.78]) by messagerie.si.c-s.fr (Postfix) with ESMTP id CA66A8B77C; Tue, 22 Feb 2022 16:00:40 +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 21MF0V3h1087059 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 22 Feb 2022 16:00:31 +0100 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 21MF0UWY1087057; Tue, 22 Feb 2022 16:00:30 +0100 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Luis Chamberlain , Aaron Tomlin Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kgdb-bugreport@lists.sourceforge.net, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org Subject: [PATCH v5 0/6] Allocate module text and data separately Date: Tue, 22 Feb 2022 16:00:17 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1645542019; l=2069; s=20211009; h=from:subject:message-id; bh=vT+HtZuIc4tR/dCOg1oXL5RYCzAmw2cfyGL9n79gTuw=; b=N9aK/3o0a2abh6NrLLGjWLf0bPQndtrvH5N4Z/A3ykaTzXTaLBTGHurSFdAaIaXhVlQokNvjCQ5D dV2wrKrkDxj7IZ9KQ/SsIfBVEKB/1EmR6Sn9k07enWxpz+QWXS40 X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 21B642000B X-Stat-Signature: g5i5eqpecrj4eu1p9dd56nthewa199he Authentication-Results: imf31.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf31.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu X-HE-Tag: 1645542116-676330 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This series applies on top of Aaron's series "module: core code clean up" v8. This series allow architectures to request having modules data in vmalloc area instead of module area. This is required on powerpc book3s/32 in order to set data non executable, because it is not possible to set executability on page basis, this is done per 256 Mbytes segments. The module area has exec right, vmalloc area has noexec. Without this change module data remains executable regardless of CONFIG_STRICT_MODULES_RWX. This can also be useful on other powerpc/32 in order to maximize the chance of code being close enough to kernel core to avoid branch trampolines. Changes in v5: - Rebased on top of Aaron's series "module: core code clean up" v8 Changes in v4: - Rebased on top of Aaron's series "module: core code clean up" v6 Changes in v3: - Fixed the tree for data_layout at one place (Thanks Miroslav) - Moved removal of module_addr_min/module_addr_max macro out of patch 1 in a new patch at the end of the series to reduce churn. Changes in v2: - Dropped first two patches which are not necessary. They may be added back later as a follow-up series. - Fixed the printks in GDB Christophe Leroy (6): module: Always have struct mod_tree_root module: Prepare for handling several RB trees module: Introduce data_layout module: Add CONFIG_ARCH_WANTS_MODULES_DATA_IN_VMALLOC module: Remove module_addr_min and module_addr_max powerpc: Select ARCH_WANTS_MODULES_DATA_IN_VMALLOC on book3s/32 and 8xx arch/Kconfig | 6 +++ arch/powerpc/Kconfig | 1 + include/linux/module.h | 8 +++ kernel/debug/kdb/kdb_main.c | 10 +++- kernel/module/internal.h | 13 +++-- kernel/module/kallsyms.c | 18 +++---- kernel/module/main.c | 103 +++++++++++++++++++++++++++--------- kernel/module/procfs.c | 8 ++- kernel/module/strict_rwx.c | 10 ++-- kernel/module/tree_lookup.c | 28 ++++++---- 10 files changed, 149 insertions(+), 56 deletions(-)