linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64/kernel: fix incorrect EL0 check in inv_entry macro
@ 2016-03-18  9:58 Ard Biesheuvel
  2016-03-21 12:07 ` Catalin Marinas
  0 siblings, 1 reply; 2+ messages in thread
From: Ard Biesheuvel @ 2016-03-18  9:58 UTC (permalink / raw)
  To: linux-arm-kernel

The implementation of macro inv_entry refers to its 'el' argument without
the required leading backslash, which results in an undefined symbol
'el' to be passed into the kernel_entry macro rather than the index of
the exception level as intended.

This undefined symbol strangely enough does not result in build failures,
although it is visible in vmlinux:

     $ nm -n vmlinux |head
                      U el
     0000000000000000 A _kernel_flags_le_hi32
     0000000000000000 A _kernel_offset_le_hi32
     0000000000000000 A _kernel_size_le_hi32
     000000000000000a A _kernel_flags_le_lo32
     .....

However, it does result in incorrect code being generated for invalid
exceptions taken from EL0, since the argument check in kernel_entry
assumes EL1 if its argument does not equal '0'.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 arch/arm64/kernel/entry.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
index 1f7f5a2b61bf..12e8d2bcb3f9 100644
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -277,7 +277,7 @@ END(vectors)
  * Invalid mode handlers
  */
 	.macro	inv_entry, el, reason, regsize = 64
-	kernel_entry el, \regsize
+	kernel_entry \el, \regsize
 	mov	x0, sp
 	mov	x1, #\reason
 	mrs	x2, esr_el1
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] arm64/kernel: fix incorrect EL0 check in inv_entry macro
  2016-03-18  9:58 [PATCH] arm64/kernel: fix incorrect EL0 check in inv_entry macro Ard Biesheuvel
@ 2016-03-21 12:07 ` Catalin Marinas
  0 siblings, 0 replies; 2+ messages in thread
From: Catalin Marinas @ 2016-03-21 12:07 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Mar 18, 2016 at 10:58:09AM +0100, Ard Biesheuvel wrote:
> The implementation of macro inv_entry refers to its 'el' argument without
> the required leading backslash, which results in an undefined symbol
> 'el' to be passed into the kernel_entry macro rather than the index of
> the exception level as intended.
> 
> This undefined symbol strangely enough does not result in build failures,
> although it is visible in vmlinux:
> 
>      $ nm -n vmlinux |head
>                       U el
>      0000000000000000 A _kernel_flags_le_hi32
>      0000000000000000 A _kernel_offset_le_hi32
>      0000000000000000 A _kernel_size_le_hi32
>      000000000000000a A _kernel_flags_le_lo32
>      .....
> 
> However, it does result in incorrect code being generated for invalid
> exceptions taken from EL0, since the argument check in kernel_entry
> assumes EL1 if its argument does not equal '0'.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Applied. Thanks.

-- 
Catalin

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-21 12:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-18  9:58 [PATCH] arm64/kernel: fix incorrect EL0 check in inv_entry macro Ard Biesheuvel
2016-03-21 12:07 ` Catalin Marinas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).