All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiaxun Yang <jiaxun.yang@flygoat.com>
To: linux-mips@vger.kernel.org
Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	Kees Cook <keescook@chromium.org>, Borislav Petkov <bp@suse.de>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Fangrui Song <maskray@google.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2 2/3] MIPS: Move kernel head into a standalone section
Date: Wed, 27 May 2020 14:34:33 +0800	[thread overview]
Message-ID: <20200527063438.391949-3-jiaxun.yang@flygoat.com> (raw)
In-Reply-To: <20200527063438.391949-1-jiaxun.yang@flygoat.com>

That's what already done by Arm64 and other architectures.
That would allow us put more things like PE headers safely into
the header.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 arch/mips/kernel/head.S        | 4 ++--
 arch/mips/kernel/vmlinux.lds.S | 8 ++++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S
index c7c2795837e7..8081a905a71c 100644
--- a/arch/mips/kernel/head.S
+++ b/arch/mips/kernel/head.S
@@ -59,6 +59,8 @@
 #endif
 	.endm
 
+	__HEAD
+_head:
 #ifndef CONFIG_NO_EXCEPT_FILL
 	/*
 	 * Reserved space for exception handlers.
@@ -67,8 +69,6 @@
 	.fill	0x400
 #endif
 
-EXPORT(_stext)
-
 	/*
 	 * Give us a fighting chance of running if execution beings at the
 	 * kernel load address.	 This is needed because this platform does
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index f185a85a27c1..b9ace667b82b 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -57,8 +57,12 @@ SECTIONS
 #endif
 	. = LINKER_LOAD_ADDRESS;
 	/* read-only */
-	_text = .;	/* Text and read-only data */
-	.text : {
+	.head.text : {
+		_text = .;
+		HEAD_TEXT
+	}
+	.text : {			/* Real text segment		*/
+		_stext = .;		/* Text and read-only data	*/
 		TEXT_TEXT
 		SCHED_TEXT
 		CPUIDLE_TEXT
-- 
2.27.0.rc0


  parent reply	other threads:[~2020-05-27  6:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-27  6:34 [PATCH v2 0/3] Buggy bootloader workaround v2 Jiaxun Yang
2020-05-27  6:34 ` [PATCH v2 1/3] MIPS: head.S: Always jump to kernel_entry at head of text Jiaxun Yang
2020-05-27 11:41   ` Thomas Bogendoerfer
2020-05-27  6:34 ` Jiaxun Yang [this message]
2020-05-27 11:53   ` [PATCH v2 2/3] MIPS: Move kernel head into a standalone section Thomas Bogendoerfer
2020-05-27 12:05     ` Jiaxun Yang
2020-05-27 13:33       ` Thomas Bogendoerfer
2020-05-27  6:34 ` [PATCH v2 3/3] MIPS: Loongson64: select NO_EXCEPT_FILL Jiaxun Yang
2020-05-27 11:47   ` Thomas Bogendoerfer

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=20200527063438.391949-3-jiaxun.yang@flygoat.com \
    --to=jiaxun.yang@flygoat.com \
    --cc=bp@suse.de \
    --cc=heiko.carstens@de.ibm.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=maskray@google.com \
    --cc=tsbogend@alpha.franken.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.