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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 20 Aug 2014 17:50:02 +0800
From:	Wang Long <long.wanglong@...wei.com>
To:	<linux@....linux.org.uk>, <nicolas.pitre@...aro.org>,
	<ben.dooks@...ethink.co.uk>, <taras.kondratiuk@...aro.org>,
	<heiko@...ech.de>
CC:	<linux-arm-kernel@...ts.infradead.org>,
	<linux-kernel@...r.kernel.org>
Subject: [PATCH] ARM: avoid corrupts register in mcaro kputc kphex etc.

when use macro 'kputc' kphex' to print the content of
register r0-r3, they will corrupts these registers.

the same as the macro 'debug_reloc_start' and 'debug_reloc_end'.

so using 'push' when enter the macro and 'pop' when leave
the macro to fix it.

Signed-off-by: Wang Long <long.wanglong@...wei.com>
---
 arch/arm/boot/compressed/head.S | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 413fd94..aa57a09 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -19,6 +19,7 @@
  * 100% relocatable.  Any attempt to do so will result in a crash.
  * Please select one of the following when turning on debugging.
  */
+#define DEBUG
 #ifdef DEBUG
 
 #if defined(CONFIG_DEBUG_ICEDCC)
@@ -69,18 +70,23 @@
 #endif
 
 		.macro	kputc,val
+		push	{r0-r3}
 		mov	r0, \val
 		bl	putc
+		pop	{r0-r3}
 		.endm
 
 		.macro	kphex,val,len
+		push	{r0-r3}
 		mov	r0, \val
 		mov	r1, #\len
 		bl	phex
+		pop	{r0-r3}
 		.endm
 
 		.macro	debug_reloc_start
 #ifdef DEBUG
+		push	{r0-r3}
 		kputc	#'\n'
 		kphex	r6, 8		/* processor id */
 		kputc	#':'
@@ -97,15 +103,18 @@
 		kputc	#'>'
 		kphex	r4, 8		/* kernel execution address */
 		kputc	#'\n'
+		pop	{r0-r3}
 #endif
 		.endm
 
 		.macro	debug_reloc_end
 #ifdef DEBUG
+		push    {r0-r3,r10-r12}
 		kphex	r5, 8		/* end of kernel */
 		kputc	#'\n'
 		mov	r0, r4
 		bl	memdump		/* dump 256 bytes at start of kernel */
+		pop	{r0-r3,r10-r12}
 #endif
 		.endm
 
-- 
1.8.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ