From patchwork Thu Feb 3 20: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: 12734624 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 E8793C433EF for ; Thu, 3 Feb 2022 20:23:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353999AbiBCUX3 convert rfc822-to-8bit (ORCPT ); Thu, 3 Feb 2022 15:23:29 -0500 Received: from mail-eopbgr90050.outbound.protection.outlook.com ([40.107.9.50]:13888 "EHLO FRA01-MR2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230100AbiBCUX2 (ORCPT ); Thu, 3 Feb 2022 15:23:28 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bMGKnPIctA/c1Qbtpg5XetzYv8MglB2nQXdAW378mfj9ZmuWzc7w+Ahb7MbquOSq0a+j3FGa0NzhkXdZRTZZkmOBh9c5an4W/uA/U6AmbeiF31x3G6w6n41T33LyIoLfQVVFsVXQrTx1fSa/SEFi0kcPwlD1GG/oU/B4O+uomGeJk2Kpvma7XQjsowzfPjmjlL4fTztH9eLQ8OhQGyw0kW34bPIlNA5uS7ceiAE+oB+zjA8nNASPEiLOkHBgQWsQilGjh+24wzErIkF6+34OMETdklFW/E9asyZhNOATEcRn30etFIvCmiHM6C163CnlrI7fS0fR7LsIi6WDKrKYUg== 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=U/EV6uEC1M5zqIUD+hp6YncWMRxPKXLAKPwg76aqnIU=; b=RxDNcdB+W5JrFbP10DQfi5xQpHb51Z+1NyVo6X4brJDM7BiwBPmDTG2iEc784IaBVhgqLmC86wQnbM85kvX4lzsQENBqNEuRhY3JFec6iJeN8G3AQVAUqGsT/yV9v/0fXhycC5EbuvEyKdZFq5XHG3Bycw5fo2Ef5WPMutUxfM6sJrwIlVDGWHpR2XcM4VQ1q6vPaBx65X9uXDMwypHiGtx5MWHiac67CegfzYzmyFv9jJ+E1Upzixddx2ptxV2vWlPvH+Qwo7a7k2HF6kkavunyWeANRO/ICZXvQ0Si+HhcsAT+xJMU3U3OwHuxheIs6Wh/OijdnmNu3sxkzU2sOg== 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 PAZP264MB2814.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1e6::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.21; Thu, 3 Feb 2022 20:23:25 +0000 Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::c9a2:1db0:5469:54e1]) by MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::c9a2:1db0:5469:54e1%9]) with mapi id 15.20.4951.014; Thu, 3 Feb 2022 20:23:25 +0000 From: Christophe Leroy To: "atomlin@redhat.com" , Luis Chamberlain , "linux-modules@vger.kernel.org" CC: Christophe Leroy , "linux-kernel@vger.kernel.org" Subject: [RFC PATCH 1/2] modules: Make module_enable_x() independant of CONFIG_ARCH_HAS_STRICT_MODULE_RWX Thread-Topic: [RFC PATCH 1/2] modules: Make module_enable_x() independant of CONFIG_ARCH_HAS_STRICT_MODULE_RWX Thread-Index: AQHYGTvleFd3jp/x5EiW0RJAl2kmwQ== Date: Thu, 3 Feb 2022 20:23:25 +0000 Message-ID: <203348805c9ac9851d8939d15cb9802ef047b5e2.1643919758.git.christophe.leroy@csgroup.eu> Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=csgroup.eu; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 736b9568-e706-4348-a219-08d9e7530829 x-ms-traffictypediagnostic: PAZP264MB2814:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: k+71Z8cp8Pbp0l8q6tk1fZRSMH3jPBFEKl0Y7BktlnxJKZNA4uFX6Oh7OmzLBHrvaevILzmX9jYN23+PudODH73XHzQZWY/Dx89zDQorWL6BuXDAwcRm/RU1wIvUp1HYhsvphtSWgEZKFFwspNNcsNwneSp7Qb2IeQN2Q3D8BV/MJk3thLcX+AzdjLrxfo5utpT51ULtwZ/j5pFWV1DHzkw5E79SmV0O8khHyas9Cq+Fg08nJjfiANUBu2ZBRn3W2cWwrMBvZJZdSMdOOzzlDbNKR6d0i2pcJVfixQC+aVEuyDw7KtgP3y+y54WBrDay3qgO1PTCU+XJRYlFGl7CjVpqWE5IbAMzHSBSilwT7AseVgj8cP2riu4NhIiQModOOPWqzXQ0n3wTgML9WdH+Vpg12GK2U62gO6IVJabbJ6MpvViA012oFzU2NPKGM+Mtlm0tcpzlZX9vl9xFkgMyAgj4alFXPR1w17JORwunch7EcIVh6s2bP3fbxqC/PduAsA+xidXVSY6QH4uB99bV6jcYmdUTUA1s5Bc7LcwkDsJw4tkitQAasljmmrwHmnJEDWzMCIWhbG1a6EfYMCFNEUyz+EyvFNxu3iXu7OdYaf7u7Plwy/96+3VJLL0S7ihGrt8YB97qjSA8bzRZkz7Pf6vX27wL6JcLvWeLZ3fS+SReG/tMmRYeO5VF0q0iRuQ/Y9YagOKkoadnkk278UJM9A== 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)(6512007)(71200400001)(2906002)(186003)(83380400001)(26005)(44832011)(6486002)(2616005)(36756003)(508600001)(64756008)(122000001)(8936002)(66946007)(66446008)(6506007)(76116006)(5660300002)(66556008)(66476007)(54906003)(110136005)(86362001)(38070700005)(38100700002)(8676002)(316002)(4326008)(91956017);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?VM+c9Oogj0uMJeRKUBWt38c?= =?iso-8859-1?q?K4POZMEZdCESpOIsNTP2JI5C9Lpv0l6QzataOzFAju0H+zp2gZJJP5a6MRBl?= =?iso-8859-1?q?zPLizSwipQ3qmBjjOJe1D8mqM0LH3Vof+177QqzPg6fr8b8bOOqfNY5ZToc/?= =?iso-8859-1?q?Auq+9TxLrguwyOFk7uHlz39psYXaVrBBuW5+mHMogmEgPivlSaSx6xtMyG5W?= =?iso-8859-1?q?qUDrcq3FaqCDWuPckEcYZlyPgZ+bqLn/LUoTjL+4V6qE3ans3e2m4Xez+3F2?= =?iso-8859-1?q?eZTqBwmWPPCQ6BaJW5BDCyNjt3OIbHvUSk0ovPONu0rx2oq1geNiMTZGVY1c?= =?iso-8859-1?q?BZ2My3ZZdG8K98AB/wD84AMmF4Dt2BPav4UOQzL44Fm7zPBIDefMPoikyse2?= =?iso-8859-1?q?vKFueU6iJSxkmn/hbx3SAoc7XYwYWjdP5/GfiasVzRxOe/JV9HBvDYoZUR1e?= =?iso-8859-1?q?TTkqqHxRW6GoU7wfLl/b0RITcBVAgs9ZPH+oqWnUehJWWFPlQVeHjkxLVxoZ?= =?iso-8859-1?q?m6X4sj/DasDsbzGF3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G21yHhdekR?= =?iso-8859-1?q?oD8OPjSIGUe/4FxfWQyemJDO0tBweyS+cle7wmejxx1nQCWe3GNHldW57xmO?= =?iso-8859-1?q?oMWl3hxn5sp4nar4EVtV5Wy8lx19c6T6es7BAaC8RIZU49qtfVKzlckQkJTq?= =?iso-8859-1?q?MVl1Jlg+yL0osbunPYltGj1VjtNzPuj1nM2G3xgN4QLQpB8Zfi+kl4hUIZeJ?= =?iso-8859-1?q?yoGd+8hSMKYWuBc3zqNZADV7KaxnbSXlFv0MqauzRzekoExQE/Ezcq+y45mM?= =?iso-8859-1?q?egHcz4lifvPUSD1xzcTCkgYA+onplECUAGUAsBeP6bMQoHT1JVtQrYITl7+w?= =?iso-8859-1?q?XWho=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: 736b9568-e706-4348-a219-08d9e7530829 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Feb 2022 20:23:25.4102 (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: K+l6xbH+BxZWUWDCIlxx4mTYsWO4Kx2MWwG6UvFWftOyhOQJu1/4EyzmqA6PyAIu8fPNI744fPHZ7MuwSWvTxx0/sXYzn9TquZrGeM0IAN4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAZP264MB2814 Precedence: bulk List-ID: module_enable_x() has nothing to do with CONFIG_ARCH_HAS_STRICT_MODULE_RWX allthough by coincidence architectures who need module_enable_x() are selection CONFIG_ARCH_HAS_STRICT_MODULE_RWX. Enable module_enable_x() for everyone everytime. If an architecture already has module text set executable, it's a no-op. Only check end boundary if CONFIG_STRICT_MODULE_RWX is set, and make sure we entirely get the last page when the boundary is not aligned. When CONFIG_STRICT_MODULE_RWX is not selected, it is not a big deal to have the start of data as executable. Signed-off-by: Christophe Leroy Reported-by: kernel test robot --- kernel/module.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/kernel/module.c b/kernel/module.c index 24dab046e16c..44ed39cbbd17 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -70,9 +70,9 @@ /* * Modules' sections will be aligned on page boundaries * to ensure complete separation of code and data, but - * only when CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y + * only when CONFIG_STRICT_MODULE_RWX=y */ -#ifdef CONFIG_ARCH_HAS_STRICT_MODULE_RWX +#ifdef CONFIG_STRICT_MODULE_RWX # define debug_align(X) ALIGN(X, PAGE_SIZE) #else # define debug_align(X) (X) @@ -1955,14 +1955,15 @@ static void mod_sysfs_teardown(struct module *mod) * CONFIG_STRICT_MODULE_RWX block below because they are needed regardless of * whether we are strict. */ -#ifdef CONFIG_ARCH_HAS_STRICT_MODULE_RWX static void frob_text(const struct module_layout *layout, int (*set_memory)(unsigned long start, int num_pages)) { BUG_ON((unsigned long)layout->base & (PAGE_SIZE-1)); +#ifdef CONFIG_STRICT_MODULE_RWX BUG_ON((unsigned long)layout->text_size & (PAGE_SIZE-1)); +#endif set_memory((unsigned long)layout->base, - layout->text_size >> PAGE_SHIFT); + ((layout->text_size - 1) >> PAGE_SHIFT) + 1); } static void module_enable_x(const struct module *mod) @@ -1970,9 +1971,6 @@ static void module_enable_x(const struct module *mod) frob_text(&mod->core_layout, set_memory_x); frob_text(&mod->init_layout, set_memory_x); } -#else /* !CONFIG_ARCH_HAS_STRICT_MODULE_RWX */ -static void module_enable_x(const struct module *mod) { } -#endif /* CONFIG_ARCH_HAS_STRICT_MODULE_RWX */ #ifdef CONFIG_STRICT_MODULE_RWX static void frob_rodata(const struct module_layout *layout, From patchwork Thu Feb 3 20: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: 12734625 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 3EEB9C433F5 for ; Thu, 3 Feb 2022 20:23:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354004AbiBCUXa convert rfc822-to-8bit (ORCPT ); Thu, 3 Feb 2022 15:23:30 -0500 Received: from mail-eopbgr90050.outbound.protection.outlook.com ([40.107.9.50]:13888 "EHLO FRA01-MR2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1352352AbiBCUX3 (ORCPT ); Thu, 3 Feb 2022 15:23:29 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aKV3UYHrfjzUM8h35qxEBOzzErrr8Gs+53rZMF/lrFknTfYI1FtyrH6LeSsC8qK9oqisg2TAhsilODKq5utfULDIEGO9LX39F0epXxURczWIQnNOENyMwwoJpYT4cWYImfYMikqv2p1v4/VF7xQkjbfyHPBkhazsl394JVW4ETzIf3HnBKxbQLRrU7E73/lIshbjJThGeN3pMpR2acnPoIZ4Pw49wcU5urQTEBDj3JwAX8g81WkKPEbM4ImmYxnVuDRZZv4OwhtEmylOCBv9wR1ywWgLvDay5pToSV83Vt7+E5IG1e2c1CYiCQ83WSgxZOizkO0tkO0HBFa96XMAvA== 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=vx4PzRS2cU5fserQ1TnSoVqnVAePApvp7QO0Q94TKaE=; b=dw+hOVZyNygUTWfGiPz2H784hNKy4aXdo+Odo6uLqsXku2eNP5SPaM8Hhpu5PcnCCV8NfT7Xrk9DhAapCE0HMP4HaP0Actp9y77ZZzgvE4qIkacUHqPR/xf2cKXqYlmVP0VGcJuuexPaL6Q5c8O/DLsH+jQOkhcfDCVkioXDNWTgJ7RwexLGkrdyLTWKQTljRfVzn2DgMeyZPWexbcYSrdNAywhj16niwIumIo1orxMCXFj7es920WZaEn4ifkJv3yDx5A0NOahLg4Dy68VIekPiqu+KiWMXJtXCagOQtxT4OLcuN9CVdYlhk7IE3Qd/cPX5hHeFgqxis+HTSlLEKg== 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 PAZP264MB2814.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1e6::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.21; Thu, 3 Feb 2022 20:23:28 +0000 Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::c9a2:1db0:5469:54e1]) by MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::c9a2:1db0:5469:54e1%9]) with mapi id 15.20.4951.014; Thu, 3 Feb 2022 20:23:27 +0000 From: Christophe Leroy To: "atomlin@redhat.com" , Luis Chamberlain , "linux-modules@vger.kernel.org" CC: Christophe Leroy , "linux-kernel@vger.kernel.org" Subject: [RFC PATCH 2/2] modules: Rename debug_align() as section_align() Thread-Topic: [RFC PATCH 2/2] modules: Rename debug_align() as section_align() Thread-Index: AQHYGTvn9hZotPPO10W1OgSPmhGbBQ== Date: Thu, 3 Feb 2022 20:23:27 +0000 Message-ID: <57afeae7c0df4a9e76d44d69681e815e37d03d6e.1643919758.git.christophe.leroy@csgroup.eu> References: <203348805c9ac9851d8939d15cb9802ef047b5e2.1643919758.git.christophe.leroy@csgroup.eu> In-Reply-To: <203348805c9ac9851d8939d15cb9802ef047b5e2.1643919758.git.christophe.leroy@csgroup.eu> Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=csgroup.eu; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 770fc739-31c8-4b1c-df79-08d9e753099d x-ms-traffictypediagnostic: PAZP264MB2814:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:800; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: dxg31Hyu97GCLJuORI2qbJ5iL6XUV2R3Rvxk62DunZDcn/Ajf0+F3783ImDUArz+RY+Lo9OOQxySf2v+5geUROAWyJgOcA40PBMO4MwA4e7L5dLCVPuL+zC9jCtQrlvixV5k9OwVfu+Ph9DoHIOEvPJzBEcBV6kp7Wqb+CCIzVFfny5Sc8rRQcLEBErLV7k0kHm3bZrvnlooFOpI3xwQBwQGckVsRqK0oQrHBpwykGokNxufShSCTcOPGly9I0huX2zVVGP+tLSa8YAZMVld1fu1PVho4IjJ04iuOEFSHfh72OmqsJ4j2ClZpSfxkrH738OyV6Yq36UFQV8/VMjV+lRN81fI0c2Jr/pYTOKPxQyTJ4emiCBAI23TYW7FHYe8OYyKQqXyY4xONmIvoerdU0ZJdyQ45OrXVK92MY9c+lr7J1UBQ79Bc2Gtj8pfTD7ceJT11j82ODc5zmTtOz0WWPFyUan5s45cy2XOii4DBNckR2Taz0TEE+hlT9GZXD5//UM5oKcLP6x0Tg4f/wfcLYhQme45+iW+BLZFomvhH8jgGdM+YFct8IBF+WwWYj8d17Rx0LaLrTFk9Zh+6QZGztGgeIdMy9+x0OEx5Ev/WT5ksPsZMW3er0qk8U6CXcxhAdLoCJHkcv5Mm4TLjm1EO4PCixAuLmjsWDAROaynDvrs6quLY4EtNHdQwO61Gc7FaOgurZGLBgeuG3JqgaM1gA== 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)(6512007)(71200400001)(2906002)(186003)(83380400001)(26005)(44832011)(6486002)(2616005)(36756003)(508600001)(64756008)(122000001)(8936002)(66946007)(66446008)(6506007)(76116006)(5660300002)(66556008)(66476007)(54906003)(110136005)(86362001)(38070700005)(38100700002)(8676002)(316002)(4326008)(91956017);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?/4LWGB0GXalvfCoRat7WZNO?= =?iso-8859-1?q?YdVLySD5L3KkN14nYTScgIVFibeMxBPOt1hixeB7loZA8haKDvgbvugAec0O?= =?iso-8859-1?q?TbtJLZiH1jt26oQeD/oy7jXnK7qmKuw4JhZINWQRcBwXglhyuvdCBOLJK680?= =?iso-8859-1?q?IU0WBcfhQiWqIPQZymeTHXEpl7FIX++bkAF8PZrKqnQSLkpYxiIMb30GkdgQ?= =?iso-8859-1?q?GuxEQ4KwW8sN7pJr5S5bJyvcFtdH4ZLte6S2X5irTAEfMWPD/JFB5HRSX1su?= =?iso-8859-1?q?wkDcRnd0jXDvlJumuvpiUN8MuboHbJWF0fpYMeXo/p0fX37EDSoGfgcXzaTF?= =?iso-8859-1?q?KVn7H9t9cbRQ+gGB5TYZHPoPZuU/DXsmYZ0cCCFIjcA+MaU7mmLSSw48xZuV?= =?iso-8859-1?q?qmgTzzYSwzrDe+eweImjd1Rm8NsBXw/aznknaFJj5sPutJf0MmYvbQV1Wb5G?= =?iso-8859-1?q?DTNbz93v/Lp351fIIP6zgLicoZMo2twTeQxgf2/2gpJrIRFDP4biBmxsuhpO?= =?iso-8859-1?q?o6WhnusS0z91vU0uU2JreS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Tr/wma0KxRlk5?= =?iso-8859-1?q?AAxLqEvy3fs09uvTZp+izLzm1p+2zlwZsDY23M9RoMG0Wt1E7J1DzQekaYnA?= =?iso-8859-1?q?xocFSpx26cjk3GlpCszpDEwAccqRIvbXJD15mYRj88sM9sJ8i84/UN6K2lAC?= =?iso-8859-1?q?HU5KLP6A6U8titi58wnXD4DtgmiYqPwuZEtfRfRUwGXErpofexv598NRj1UL?= =?iso-8859-1?q?aGGs2qMJreT3tUljRCbM1yIbzU2zCdZVRSyIJLeV0QjiVw+hUlUxze21fBtH?= =?iso-8859-1?q?zSxthnLe5Gwe1AaeLOtPc9CXhObqXSh4k+GUIvYY/FPd8Ybks4NnthDJ7/T2?= =?iso-8859-1?q?QCDI=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: 770fc739-31c8-4b1c-df79-08d9e753099d X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Feb 2022 20:23:27.8654 (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: gCRSVXIqkzXDIbv5qRK4verkfEG0cnEsXSS1/wG3moF1Fb+pL0on5HkE+V6p1IOlCZsBtoV28DH/CPte9DBfU6yK3ZVWEE6Ybiji4HHxQQg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAZP264MB2814 Precedence: bulk List-ID: debug_align() was added by commit 84e1c6bb38eb ("x86: Add RO/NX protection for loadable kernel modules") At that time the config item was CONFIG_DEBUG_SET_MODULE_RONX. But nowadays it has changed to CONFIG_STRICT_MODULE_RWX and debug_align() is confusing because it has nothing to do with DEBUG. Rename it section_align() While at it, use PAGE_ALIGN(x) instead of ALIGN(x, PAGE_SIZE). Signed-off-by: Christophe Leroy --- kernel/module.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/kernel/module.c b/kernel/module.c index 44ed39cbbd17..fb30249a05bb 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -73,9 +73,9 @@ * only when CONFIG_STRICT_MODULE_RWX=y */ #ifdef CONFIG_STRICT_MODULE_RWX -# define debug_align(X) ALIGN(X, PAGE_SIZE) +# define section_align(X) PAGE_ALIGN(X) #else -# define debug_align(X) (X) +# define section_align(X) (X) #endif /* If this is set, the section belongs in the init part of the module */ @@ -2454,19 +2454,19 @@ static void layout_sections(struct module *mod, struct load_info *info) } switch (m) { case 0: /* executable */ - mod->core_layout.size = debug_align(mod->core_layout.size); + mod->core_layout.size = section_align(mod->core_layout.size); mod->core_layout.text_size = mod->core_layout.size; break; case 1: /* RO: text and ro-data */ - mod->core_layout.size = debug_align(mod->core_layout.size); + mod->core_layout.size = section_align(mod->core_layout.size); mod->core_layout.ro_size = mod->core_layout.size; break; case 2: /* RO after init */ - mod->core_layout.size = debug_align(mod->core_layout.size); + mod->core_layout.size = section_align(mod->core_layout.size); mod->core_layout.ro_after_init_size = mod->core_layout.size; break; case 4: /* whole core */ - mod->core_layout.size = debug_align(mod->core_layout.size); + mod->core_layout.size = section_align(mod->core_layout.size); break; } } @@ -2488,11 +2488,11 @@ static void layout_sections(struct module *mod, struct load_info *info) } switch (m) { case 0: /* executable */ - mod->init_layout.size = debug_align(mod->init_layout.size); + mod->init_layout.size = section_align(mod->init_layout.size); mod->init_layout.text_size = mod->init_layout.size; break; case 1: /* RO: text and ro-data */ - mod->init_layout.size = debug_align(mod->init_layout.size); + mod->init_layout.size = section_align(mod->init_layout.size); mod->init_layout.ro_size = mod->init_layout.size; break; case 2: @@ -2503,7 +2503,7 @@ static void layout_sections(struct module *mod, struct load_info *info) mod->init_layout.ro_after_init_size = mod->init_layout.ro_size; break; case 4: /* whole init */ - mod->init_layout.size = debug_align(mod->init_layout.size); + mod->init_layout.size = section_align(mod->init_layout.size); break; } } @@ -2724,7 +2724,7 @@ static void layout_symtab(struct module *mod, struct load_info *info) mod->core_layout.size += strtab_size; info->core_typeoffs = mod->core_layout.size; mod->core_layout.size += ndst * sizeof(char); - mod->core_layout.size = debug_align(mod->core_layout.size); + mod->core_layout.size = section_align(mod->core_layout.size); /* Put string table section at end of init part of module. */ strsect->sh_flags |= SHF_ALLOC; @@ -2739,7 +2739,7 @@ static void layout_symtab(struct module *mod, struct load_info *info) mod->init_layout.size += sizeof(struct mod_kallsyms); info->init_typeoffs = mod->init_layout.size; mod->init_layout.size += nsrc * sizeof(char); - mod->init_layout.size = debug_align(mod->init_layout.size); + mod->init_layout.size = section_align(mod->init_layout.size); } /*