All of lore.kernel.org
 help / color / mirror / Atom feed
From: Albert ARIBAUD <albert.u.boot@aribaud.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2] BUGFIX: arm: data abort in get_bad_stack_swi
Date: Fri, 5 Apr 2013 09:04:50 +0200	[thread overview]
Message-ID: <20130405090450.7f7a4624@lilith> (raw)
In-Reply-To: <1365126314-26328-1-git-send-email-koba@kmckk.co.jp>

Hi Tetsuyuki,

On Fri,  5 Apr 2013 10:45:14 +0900, Tetsuyuki Kobayashi
<koba@kmckk.co.jp> wrote:

> When swi instruction is executed, it is expected to get message
> "software interrupt" in console and dump registers and reboot, as
> do_software_interrupt() in arch/arm/lib/interrupts.c.
> But, actually it causes data abort accessing wrong address in get_bad_stack_swi
> macro in arch/arm/cpu/v7/start.S.
> This patch fixes this problem.
> 
> The same mistake in arch/arm/cpu/{arm1136,arm1176,pxa}/start.S.
> 
> Signed-off-by: Tetsuyuki Kobayashi <koba@kmckk.co.jp>
> ---
> Changes for v2:
> - added arch/arm/cpu/{arm1136,arm1176,pxa}/start.S
>   (But not tested, because I don't have test boards of them)
>   arm/arm/cpu/armv7/start.S is tested on KZM-A9-GT board.
> 
>  arch/arm/cpu/arm1136/start.S |    2 +-
>  arch/arm/cpu/arm1176/start.S |    2 +-
>  arch/arm/cpu/armv7/start.S   |    2 +-
>  arch/arm/cpu/pxa/start.S     |    2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/cpu/arm1136/start.S b/arch/arm/cpu/arm1136/start.S
> index eba2324..7b9db2b 100644
> --- a/arch/arm/cpu/arm1136/start.S
> +++ b/arch/arm/cpu/arm1136/start.S
> @@ -392,7 +392,7 @@ cpu_init_crit:
>  	str	r0, [r13]			@ save R0's value.
>  	ldr	r0, IRQ_STACK_START_IN		@ get data regions start
>  	str	lr, [r0]			@ save caller lr in position 0 of saved stack
> -	mrs	r0, spsr			@ get the spsr
> +	mrs	lr, spsr			@ get the spsr
>  	str	lr, [r0, #4]			@ save spsr in position 1 of saved stack
>  	ldr	r0, [r13]			@ restore r0
>  	add	r13, r13, #4			@ pop stack entry

Sorry for not checking this in V1, but I see that get_bad_stack_swi does
not preserve lr, so when bad_save_user_regs is expanded, it will save
the wrong value for lr. You need to restore lr from [r0] before you
restore r0 from [r13].

> diff --git a/arch/arm/cpu/arm1176/start.S b/arch/arm/cpu/arm1176/start.S

> diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S

> diff --git a/arch/arm/cpu/pxa/start.S b/arch/arm/cpu/pxa/start.S

Ditto for all four files, of course.

Amicalement,
-- 
Albert.

  reply	other threads:[~2013-04-05  7:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-04  4:52 [U-Boot] [PATCH] BUGFIX: arm: armv7: data abort in get_bad_stack_swi Tetsuyuki Kobayashi
2013-04-04  6:21 ` Albert ARIBAUD
2013-04-04  6:24   ` Albert ARIBAUD
2013-04-04 10:29     ` Tetsuyuki Kobayashi
2013-04-05  1:45 ` [U-Boot] [PATCH v2] BUGFIX: arm: " Tetsuyuki Kobayashi
2013-04-05  7:04   ` Albert ARIBAUD [this message]
2013-04-05 10:04     ` Tetsuyuki Kobayashi
2013-04-05 10:12   ` [U-Boot] [PATCH v3] " Tetsuyuki Kobayashi
2013-04-11  9:47     ` Tetsuyuki Kobayashi
2013-04-13 11:37     ` Albert ARIBAUD

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=20130405090450.7f7a4624@lilith \
    --to=albert.u.boot@aribaud.net \
    --cc=u-boot@lists.denx.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.