lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Sun,  5 Feb 2017 21:21:15 +0100
From:   Alban <albeu@...e.fr>
To:     linux-mips@...ux-mips.org
Cc:     Alban Bedel <albeu@...e.fr>, Ralf Baechle <ralf@...ux-mips.org>,
        Jonas Gorski <jogo@...nwrt.org>, linux-kernel@...r.kernel.org
Subject: [PATCH] MIPS: Allow compressed images to be loaded at the usual address

From: Alban Bedel <albeu@...e.fr>

Normally compressed images have to be loaded at a different address to
allow the decompressor to run. This add an option to let vmlinuz copy
itself to the correct address from the normal vmlinux address.

Signed-off-by: Alban Bedel <albeu@...e.fr>
---
 arch/mips/Kconfig                |  8 ++++++++
 arch/mips/boot/compressed/head.S | 13 +++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index b3c5bde..8074fc5 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2961,6 +2961,14 @@ choice
 		bool "Extend builtin kernel arguments with bootloader arguments"
 endchoice
 
+config ZBOOT_VMLINUZ_AT_VMLINUX_LOAD_ADDRESS
+	bool "Load compressed images at the same address as uncompressed"
+	depends on SYS_SUPPORTS_ZBOOT
+	help
+	  vmlinux and vmlinuz normally have different load addresses, with
+	  this option vmlinuz expect to be loaded at the same address as
+	  vmlinux.
+
 endmenu
 
 config LOCKDEP_SUPPORT
diff --git a/arch/mips/boot/compressed/head.S b/arch/mips/boot/compressed/head.S
index 409cb48..a215171 100644
--- a/arch/mips/boot/compressed/head.S
+++ b/arch/mips/boot/compressed/head.S
@@ -25,6 +25,19 @@ start:
 	move	s2, a2
 	move	s3, a3
 
+#ifdef CONFIG_ZBOOT_VMLINUZ_AT_VMLINUX_LOAD_ADDRESS
+	/* Move the text, data section and DTB to the correct address */
+	PTR_LA	a0, .text
+	PTR_LI	a1, VMLINUX_LOAD_ADDRESS
+	PTR_LA	a2, _edata
+0:
+	lw	a3, 0(a1)
+	sw	a3, 0(a0)
+	addiu	a1, a1, 4
+	bne	a2, a0, 0b
+	 addiu	a0, a0, 4
+#endif
+
 	/* Clear BSS */
 	PTR_LA	a0, _edata
 	PTR_LA	a2, _end
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ