public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Olaf Hering <olaf@aepfle•de>
To: Paul Mackeras <paulus@samba•org>, linuxppc-dev@ozlabs•org
Subject: [PATCH] stop infinite loop in start_ldr due to unaligned sections
Date: Fri, 20 Oct 2006 15:57:15 +0200	[thread overview]
Message-ID: <20061020135715.GA7197@aepfle.de> (raw)


Quick fix for lack of memset(__bss_start,0,_end-__bss_start) in load_kernel()
If edata is unaligned, the loop will overwrite all memory because
r3 and r4 will never be equal.

Signed-off-by: Olaf Hering <olaf@aepfle•de>

---
 arch/ppc/boot/simple/relocate.S |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Index: linux-2.6.19-rc2/arch/ppc/boot/simple/relocate.S
===================================================================
--- linux-2.6.19-rc2.orig/arch/ppc/boot/simple/relocate.S
+++ linux-2.6.19-rc2/arch/ppc/boot/simple/relocate.S
@@ -154,8 +154,8 @@ do_relocate_out:
 
 start_ldr:
 /* Clear all of BSS and set up stack for C calls */
-	lis	r3,edata@h
-	ori	r3,r3,edata@l
+	lis	r3,__bss_start@h
+	ori	r3,r3,__bss_start@l
 	lis	r4,end@h
 	ori	r4,r4,end@l
 	subi	r3,r3,4
@@ -163,7 +163,7 @@ start_ldr:
 	li	r0,0
 50:	stwu	r0,4(r3)
 	cmpw	cr0,r3,r4
-	bne	50b
+	blt	50b
 90:	mr	r9,r1		/* Save old stack pointer (in case it matters) */
 	lis	r1,.stack@h
 	ori	r1,r1,.stack@l

                 reply	other threads:[~2006-10-20 14:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20061020135715.GA7197@aepfle.de \
    --to=olaf@aepfle$(echo .)de \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    --cc=paulus@samba$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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