From patchwork Sat Jan 29 17:02:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12729561 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 771DFC433EF for ; Sat, 29 Jan 2022 17:02:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 91FC36B0085; Sat, 29 Jan 2022 12:02:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8CF946B0087; Sat, 29 Jan 2022 12:02:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 72FEA6B0088; Sat, 29 Jan 2022 12:02:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0221.hostedemail.com [216.40.44.221]) by kanga.kvack.org (Postfix) with ESMTP id 6424C6B0085 for ; Sat, 29 Jan 2022 12:02:07 -0500 (EST) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 1BE3A18233655 for ; Sat, 29 Jan 2022 17:02:07 +0000 (UTC) X-FDA: 79083942294.05.80C4324 Received: from FRA01-MR2-obe.outbound.protection.outlook.com (mail-eopbgr90059.outbound.protection.outlook.com [40.107.9.59]) by imf30.hostedemail.com (Postfix) with ESMTP id 5E09480003 for ; Sat, 29 Jan 2022 17:02:06 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LkmIiCXT4ziPRqsLlezbz2h5AhfE8z9FKOljrTvAaJqSV7C+O/jNh8mqFHOg2MV3O6GzIdOg0kSvG/NxA4mC9l9Gr0qA9+V5F6fkmgQRXN9aHH4Ec6krYi6uPwfEwaHoXVEuEaxCGudkNaK0zCryNxyVlRLfmVERTsKFOaKpbg3fVGooQPMVVDL7F5W4QZ7lO04yYXIvJKuG3udVG3+QtXWfQVINiS7/XfhVHZRf2hqhNcICr3iFy/ZqmpeWggvT1YP+YnU4A55pjh5Y+lS2IRRTZTHIabVxlj5kezCLfqYGWJu1hesIkRAyBAPbB56ZT3BetRZx3Hs1sPEZvzRfrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DFe2jru4e765k+AtEaywltcFddJL0rBEMrtvg51fbp8=; b=nwBiU1qFnoXLEw+8x7ZxGxgk62DZauDrHVgA2U8tOyZsU+mGEyX71bWPV1S1uEiqgGzIukk5oq5TnztBHU2MMGtdQWeBemdtqsZDRd2yk9MtSrb0o0qfF0+NKSP4+lpjfmZRNMwAkKQN8F88LiJZUWmprqDSSIefbSenNvK1sgaJzHx/y8rp9wGqFGFOFTiHD81wVfPoyPmkn6D+4cTGIVQVDwbZ9dPmLbDxkkpFsTDIn5czzhaPOSY2Z2+lhmbi65Qbnsn51dQmPKjvQFMTvaRLcmNmXi2OP2Qee1RfEtRSr3Edg4DdAQHvaEGDRkf2NNSuBiBxonI7+ovv5cg0Uw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:31::15) by PR0P264MB2584.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1e3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.15; Sat, 29 Jan 2022 17:02:03 +0000 Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::c9a2:1db0:5469:54e1]) by MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::c9a2:1db0:5469:54e1%6]) with mapi id 15.20.4930.020; Sat, 29 Jan 2022 17:02:03 +0000 From: Christophe Leroy To: 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" Subject: [PATCH v3 0/6] Allocate module text and data separately Thread-Topic: [PATCH v3 0/6] Allocate module text and data separately Thread-Index: AQHYFTHvUwh0xR1dj0+CyueZIq28OA== Date: Sat, 29 Jan 2022 17:02:03 +0000 Message-ID: Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 892d4223-8cff-472b-6752-08d9e3491279 x-ms-traffictypediagnostic: PR0P264MB2584:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: RKfoTkUtOawyjK5uczxHEECkyxYbemWn3txATQY9icTrbqBP8t8MGPN/9mIi/qPMlalfA3NzT5o7aSK6+bqO0Fd+phGV5a2+egkbzNq8eNQ6q+2Tuw5s5uHq0nFoRzj8tWZD+R5JdD+LwKjXh023r1ZnU6ZwvSG0x9x2OHb9qEfFyhPsEVGF0291F75yJ2iyx4Je5bigwgNf13gwIWM8d0yLQZXJT2oTzcDZSDLB3P7wyY7cWr+N2EtCiqXRn3imWUpzzTZniItsD0so2BDeXBTQbJJLY6fJ3Mcd4/oQz7wQ+1QMI1j04PF8vMrIDWVxQIrSqKf4iK7onxgoDrSPZp8bWgCPpzorFDWNmh/092DBOdEd2vCesyMhKubrLwxSma44E5WX9qho2XBtWornC3hMHZdkuqT2V5tQiazcXi8a/HEbxClufevt8hOVHEi8hr185WFyD2qZmvSfwUUy+vb4haPbEn19SQn9AcG5ktLCneNH1Vo6Nqx4yzIScIGIFta3QMCwlxxXG3Cugg6nQIMUpqpiKUu3ccTijdaPVNoVhJyXhicB8FS1IYEg1+Pdkb2Ce6MivnNqGXNLmI3g13xfRUsGZ7Lc62/cd+caobzqDIvzQEiGZMedm7dfwepkUTWvs053hrXPpyR6H1v0VY8W3U/f/NmveGclr0D/tw4fVsWYAF32ZG4vf2KCCe2fZls76ynsBX8oPwhLWs2A6Q== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(54906003)(110136005)(6512007)(2906002)(86362001)(6486002)(508600001)(4326008)(122000001)(38100700002)(91956017)(316002)(76116006)(26005)(64756008)(6506007)(8936002)(186003)(5660300002)(44832011)(66476007)(66556008)(71200400001)(66946007)(8676002)(66446008)(83380400001)(2616005)(36756003)(38070700005)(20210929001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?20FFZVBRKvjedqRUl/SSTnb?= =?iso-8859-1?q?dtLAYkCaoCuzqhwUGtys4VKy4HrtuzssWDR7X9M/JRHJh3FP+np6aBauLAPI?= =?iso-8859-1?q?RY7LlF2pP5GyqcdWJNXMy2orfkG6sxmZCVBZug+EAig9nedRdjzMj9SGTxBV?= =?iso-8859-1?q?kUDHPvAVRBSU09DJO+IIKyrVSX7BX7ObAKMEb3enosmeIelB297yzVU2YerW?= =?iso-8859-1?q?MJxa2EIsbRDnI9UgCGwkPrzWdOuX7SmJfX6vuucCOiuJDyG5AQtTAFXGW28T?= =?iso-8859-1?q?reBgqwncUK2TCil+2bRq23sY7LP9v9Ara+u9Nwd3RuI1utiR4XBxW4Gh3pVc?= =?iso-8859-1?q?UccyF3CWnXBWStJDtPefMI0Qj2NPWa2ZRdRGcwJLTuEYfeNAoJYoARJmVgQj?= =?iso-8859-1?q?c4C9rsUrBWidTZh2Ugy2m5kjVrSPTqmZSI4zvR/oJ4zFpLxAQqa+zcPWL+xV?= =?iso-8859-1?q?SyYVjqLXf+0mQbLODW964xHGqqfyFQ9mD5tsOxZRvtg0SbLQ8FGVPZg4oBrv?= =?iso-8859-1?q?tyI4m0kSuhqA/ic8AmRLiMA16eHozarleSUZAPD5zp7ycB2PTNTUq7zoLW8p?= =?iso-8859-1?q?va1l6m73ecG9ui0oy7PE6BZExxhsI+mqyyx3aezQS+iBcGueLe640LcwFwl/?= =?iso-8859-1?q?oKdnCJtkfKSrBCFcUPHDaD4Demp+zhbPdSovxaXGTE6oF6HMeE7vcjtjWYAw?= =?iso-8859-1?q?+6Vox//mnbUDuvUZfBQx6OdutWF8WFfj6vS9qh7UlTT/n5SZEASi1nMN+soX?= =?iso-8859-1?q?j6W4M1RGVYcIAevN8l5xTy9EY+hmmo4FqsCSmHu2Ha+MSi00eXoPZCChcNs7?= =?iso-8859-1?q?72TimSqftmvDbMzb2I8itaODDqbohNpzp7Nzd86/Oy6MKKfg4Cd2qRs3DYr7?= =?iso-8859-1?q?ZHCPOcIb63lA6+tncllH0F586rSwhK+mfo0lwnD/m8W1G12OAfzpIXxkezdw?= =?iso-8859-1?q?j65ZBo4TVj2QJcg78UkAMC2e4b00cC+koXfQqcU2IwbYhD536FkWw4HdcFCz?= =?iso-8859-1?q?orQNpwKXazzRfnIT1sxeKyLPk9KLgVF2VX4BNcO6HnmS314FECqmVSVZ7jMv?= =?iso-8859-1?q?dx8jgiKEhDtTZCGVKP/95mMz4OMsOkaaybj9Och8XvS4833OiPXsMLJ9b5vB?= =?iso-8859-1?q?HqpowX1FTnkG7yN12oseJlw2olcTsjUVd3bNs+UktcaNmKaGtK2q4bHqUJc2?= =?iso-8859-1?q?+9UXdOPqEP9hHJMzfZomBiXbiBo+ajMFg/pdkDi+UgfMYao1eg/mc234lBCF?= =?iso-8859-1?q?QR3EjOVU4sgFlC0b8JH7tG3o7euD4+TRvhunWkqosL8q7g6JIv5iC0ot2xzJ?= =?iso-8859-1?q?B9hfL2uQjBadlMCH0CklzQbR5uJqFoeRzDOYQgOw1QMAVjjGwu4BbUZ0twOP?= =?iso-8859-1?q?Eb12z6ri3xiweVKSHxW1qLjK7RfxwlrnTUvsC2n6dr3sCbZCnZkzhmpFS8oh?= =?iso-8859-1?q?XLZjKpRiwAq12xEjIjExC6Yy4N5PzbL67jRenZ1C1AKoMUVboVshmuJxoUYU?= =?iso-8859-1?q?vTWi017IuXxLUCc2Hnsh9htcvyiM2aj7nbF8cDIZRYA2D/KTDBC8z0C12VLK?= =?iso-8859-1?q?QmzKuSoJid97Akj3TxhQPWunLOQrJPzWppcTIjMJRXjNNsdlCrF/BSNw9okw?= =?iso-8859-1?q?pAlpdAj56Icd66xahMBpkO5BGFxrQdZ4sHUHxztaqyoOs3qKmII1uZmXCCTo?= =?iso-8859-1?q?JMqxEXftJeKPs3OdZNvzh6sV/ECcYuHui7X98RkYObev7s6DDDu+oaqkJuZk?= =?iso-8859-1?q?NUmA=3D?= MIME-Version: 1.0 X-OriginatorOrg: csgroup.eu X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 892d4223-8cff-472b-6752-08d9e3491279 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Jan 2022 17:02:03.0606 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9914def7-b676-4fda-8815-5d49fb3b45c8 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: yMU6eVPzk9t5QNlyd7FgGd6fDDBSBK6/4w4wjs9bqsy31YHUXQoC5yuSbSyKke1IPtSEMfUydPDLLs4it14pucPnlsIoiXXzcTS8y6VPzh4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR0P264MB2584 X-Rspamd-Queue-Id: 5E09480003 X-Rspam-User: nil Authentication-Results: imf30.hostedemail.com; dkim=none; spf=pass (imf30.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.9.59 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=none X-Stat-Signature: s96kkq436xjy5unz4na9q7ukm8ox4oky X-Rspamd-Server: rspam08 X-HE-Tag: 1643475726-297540 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000117, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 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): modules: Always have struct mod_tree_root modules: Prepare for handling several RB trees modules: Introduce data_layout modules: Add CONFIG_ARCH_WANTS_MODULES_DATA_IN_VMALLOC modules: 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.c | 193 +++++++++++++++++++++++++----------- 5 files changed, 156 insertions(+), 62 deletions(-)