mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jungseung Lee <js07.lee@samsung.com>
To: rmk+kernel@armlinux.org.uk, linus.walleij@linaro.org,
	amit.kachhap@arm.com, ardb@kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, keescook@chromium.org,
	js07.lee@samsung.com, js07.lee@gmail.com
Subject: [PATCH 1/2] arm/mm : omit [_text, _stext) from kernel code region
Date: Mon,  6 Mar 2023 14:51:54 +0900	[thread overview]
Message-ID: <1678081915-12599-1-git-send-email-js07.lee@samsung.com> (raw)
In-Reply-To: <CGME20230306061055epcas1p1f7718c46c10f84845e086f9ce9f9a41f@epcas1p1.samsung.com>

The resource reservations in /proc/iomem made for the kernel code did
not reflect the gaps between pagetable and text.

In particular, if the CONFIG_STRICT_KERNEL_RWX option is turned on,
the wrong area is shown as the kernel code area.

Fix it by removing [_text, _stext) from kernel code region.

Before:
04000000-2f7fffff : System RAM
  04008000-04cfffff : Kernel code
  04e00000-05369a27 : Kernel data

After :
04000000-2f7fffff : System RAM
  04100000-04cfffff : Kernel code
  04e00000-05369a27 : Kernel data

Signed-off-by: Jungseung Lee <js07.lee@samsung.com>
---
 arch/arm/kernel/setup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 75cd469..3059860 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -865,7 +865,7 @@ static void __init request_standard_resources(const struct machine_desc *mdesc)
 	struct resource *res;
 	u64 i;
 
-	kernel_code.start   = virt_to_phys(_text);
+	kernel_code.start   = virt_to_phys(_stext);
 	kernel_code.end     = virt_to_phys(__init_begin - 1);
 	kernel_data.start   = virt_to_phys(_sdata);
 	kernel_data.end     = virt_to_phys(_end - 1);
@@ -1139,7 +1139,7 @@ void __init setup_arch(char **cmdline_p)
 	if (mdesc->reboot_mode != REBOOT_HARD)
 		reboot_mode = mdesc->reboot_mode;
 
-	setup_initial_init_mm(_text, _etext, _edata, _end);
+	setup_initial_init_mm(_stext, _etext, _edata, _end);
 
 	/* populate cmd_line too for later use, preserving boot_command_line */
 	strlcpy(cmd_line, boot_command_line, COMMAND_LINE_SIZE);
-- 
2.7.4


       reply	other threads:[~2023-03-06  6:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20230306061055epcas1p1f7718c46c10f84845e086f9ce9f9a41f@epcas1p1.samsung.com>
2023-03-06  5:51 ` Jungseung Lee [this message]
     [not found]   ` <CGME20230306061057epcas1p17def087649be56b75c7830385ff2fb2f@epcas1p1.samsung.com>
2023-03-06  5:51     ` [PATCH 2/2] arm/mm : Report actual image regions in /proc/iomem Jungseung Lee
2023-03-06 11:10       ` Russell King (Oracle)
2023-03-06 12:14         ` Jungseung Lee
2023-03-06 12:28           ` Russell King (Oracle)
2023-03-06 13:00             ` Ard Biesheuvel
2023-03-06 11:06   ` [PATCH 1/2] arm/mm : omit [_text, _stext) from kernel code region Russell King (Oracle)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1678081915-12599-1-git-send-email-js07.lee@samsung.com \
    --to=js07.lee@samsung.com \
    --cc=amit.kachhap@arm.com \
    --cc=ardb@kernel.org \
    --cc=js07.lee@gmail.com \
    --cc=keescook@chromium.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk+kernel@armlinux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®