From patchwork Tue Feb 22 10:32:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12754798 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 D7620C433EF for ; Tue, 22 Feb 2022 10:32:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6FA278D0002; Tue, 22 Feb 2022 05:32:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 681158D0001; Tue, 22 Feb 2022 05:32:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 521A68D0002; Tue, 22 Feb 2022 05:32:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id 42C1C8D0001 for ; Tue, 22 Feb 2022 05:32:56 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 0F42D120657 for ; Tue, 22 Feb 2022 10:32:56 +0000 (UTC) X-FDA: 79170052752.08.39EC83B Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf28.hostedemail.com (Postfix) with ESMTP id 52AFFC0009 for ; Tue, 22 Feb 2022 10:32:55 +0000 (UTC) Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4K2wVB5lsJz9sS4; Tue, 22 Feb 2022 11:32:50 +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 0GgEn6udiCup; Tue, 22 Feb 2022 11:32:50 +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 4K2wV93dcWz9sSN; Tue, 22 Feb 2022 11:32:49 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 6B34F8B783; Tue, 22 Feb 2022 11:32:49 +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 Gw8BlweLiiqu; Tue, 22 Feb 2022 11:32:49 +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 18C7A8B764; Tue, 22 Feb 2022 11:32:49 +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 21MAWeWM1075957 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 22 Feb 2022 11:32:40 +0100 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 21MAWdo71075955; Tue, 22 Feb 2022 11:32:39 +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 , Jessica Yu 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 v4 0/6] Allocate module text and data separately Date: Tue, 22 Feb 2022 11:32:14 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1645525927; l=2322; s=20211009; h=from:subject:message-id; bh=ylAL86OcQDmaf/79jjmRMYu8EaHsQl69CI8Wp+NgxRs=; b=N/0ZMxBg+GwkjabUyTrFxxthQkecVcI/2rmKrsOmpW7+8o/K+MJvyH4Y4zRqbsKdvtHrxbkRbuAl +TxAkjhwCMNIBYD+J51inrtMQ3qgdvYHu55ElJ/ti5hl2To48geV X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 52AFFC0009 X-Rspam-User: Authentication-Results: imf28.hostedemail.com; dkim=none; spf=pass (imf28.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=none X-Stat-Signature: yir9npohg8cnt1cg4tifrry1z6x563uu X-HE-Tag: 1645525975-774721 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" v6, plus the 4 fixups I just sent: - Fixup for 54f2273e5fef ("module: Move kallsyms support into a separate file") - Fixup for e5973a14d187 ("module: Move strict rwx support to a separate file") - Fixup for 1df95c1b9fb2 ("module: Move latched RB-tree support to a separate file") - Fixup for 87b31159f78a ("module: Move all into module/") 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 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(-)