Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp4164398ybl; Tue, 20 Aug 2019 07:54:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqxaYgqMtWg+UE2uRT9TQSHeLOZhw3LrlfmPi/EYpuTOFjQAWxWodChK2OqjVuKCF7K/RJvz X-Received: by 2002:a17:902:100c:: with SMTP id b12mr10188071pla.40.1566312889624; Tue, 20 Aug 2019 07:54:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566312889; cv=none; d=google.com; s=arc-20160816; b=Xm7N3dtyM07mdz+9UvPh0F8EEYbNKi38Z3o4q7/Qx1rD+BSiaA3PGkxuAPt8OXfME2 CZNwtP8RMcuzVq/P8SYk03inEuw1bmt8y5uso8ceHM7AcDnKXdz1Pro7L6Y561MQXfnd ic5GXIi7SXIv7gO7ToI/cYHosN0PyLg6X/CtnQ4c78jUUEMYktGDQdf0+XTteXeBm18U 2ajIk2NGGTItM0RfXQRdf35o2LxP8z7kC+EHnYfQw82VEDVjQjHTok1iAK5At4jl5tMX VJG9HKMOb4Zk3X7p63eL98rfVy4xLVbeNLrRd3ZylE5VCF63Dq0KPRA2+HqN11TG1zk5 EsHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:to :from; bh=GO1k6dx4wQWhVkXVOYf5Pi+onfTUMNRrQ2YsG1J2na0=; b=bhmkijnyzzbiqG4HbLMpVSZmy3CiORetNXDI9mEOPgo9kZAoyPtEcGwMSrWV6s/JOa P9b3zf4pwX9CIWycs9ehp57Qg5Rz/R0yOvHzdQwMN6ELnqJPWzxFFKiYWi2qLfGTTGLN 01UDV/phlMWshRcDQC6xDkuNOpac2sNykUw8uvBM1Dlj7vn0O4ErtJpgQsOWgyMBYb+l m0jbcUV2bSx+CVTaBXh00jVrfRrvlPJndnEYAB5Zu2rjUGU2V/wiPOyByUBfFAdJTat9 D2wBWJ3eSm/cokeaiHNDsMoO9IYXc41LqU1BPGqYDcRevSf2hZDP4mahS3fGg6ilIX87 JmcQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m11si122424pjl.104.2019.08.20.07.54.33; Tue, 20 Aug 2019 07:54:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730205AbfHTOxN (ORCPT + 99 others); Tue, 20 Aug 2019 10:53:13 -0400 Received: from mail.windriver.com ([147.11.1.11]:44478 "EHLO mail.windriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729918AbfHTOxN (ORCPT ); Tue, 20 Aug 2019 10:53:13 -0400 Received: from ALA-HCA.corp.ad.wrs.com ([147.11.189.40]) by mail.windriver.com (8.15.2/8.15.1) with ESMTPS id x7KErC6p000952 (version=TLSv1 cipher=AES128-SHA bits=128 verify=FAIL); Tue, 20 Aug 2019 07:53:12 -0700 (PDT) Received: from pek-lpg-core2.corp.ad.wrs.com (128.224.153.41) by ALA-HCA.corp.ad.wrs.com (147.11.189.40) with Microsoft SMTP Server id 14.3.468.0; Tue, 20 Aug 2019 07:53:12 -0700 From: To: , , Subject: [PATCH] modules: page-align module section allocations only for arches supporting strict module rwx Date: Tue, 20 Aug 2019 22:53:10 +0800 Message-ID: <1566312790-253213-1-git-send-email-zhe.he@windriver.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: He Zhe We should keep the case of "#define debug_align(X) (X)" for all arches without CONFIG_HAS_STRICT_MODULE_RWX ability, which would save people, who are sensitive to system size, a lot of memory when using modules, especially for embedded systems. This is also the intention of the original #ifdef... statement and still valid for now. Note that this still keeps the effect of the fix of the following commit, 38f054d549a8 ("modules: always page-align module section allocations"), since when CONFIG_ARCH_HAS_STRICT_MODULE_RWX is enabled, module pages are aligned. Signed-off-by: He Zhe --- This patch is based on the top of modules-next tree, 38f054d549a8. kernel/module.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kernel/module.c b/kernel/module.c index cd8df51..9ee9342 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -64,9 +64,14 @@ /* * Modules' sections will be aligned on page boundaries - * to ensure complete separation of code and data + * to ensure complete separation of code and data, but + * only when CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y */ +#ifdef CONFIG_ARCH_HAS_STRICT_MODULE_RWX # define debug_align(X) ALIGN(X, PAGE_SIZE) +#else +# define debug_align(X) (X) +#endif /* If this is set, the section belongs in the init part of the module */ #define INIT_OFFSET_MASK (1UL << (BITS_PER_LONG-1)) -- 2.7.4