lkml.org 
[lkml]   [2020]   [Apr]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] arm64: armv8_deprecated: Fix undef_hook mask for thumb setend
On Mon, Apr 06, 2020 at 04:16:05PM +0200, Fredrik Strupe wrote:
> Use a full 32-bit mask to prevent accidental matchings of thumb32
> instructions where the second half-word is equal to the thumb16 setend
> encoding.
>
> This fixes the same problem as the following patch:
>
> https://lkml.org/lkml/2020/3/16/341

This link is not guaranteed to be stable and the commit should have the
full description rather than referring to another email.

> but for setend emulation instead.
>
> Signed-off-by: Fredrik Strupe <fredrik@strupe.net>

It also needs Fixes: and Cc: stable tags.

> ---
> arch/arm64/kernel/armv8_deprecated.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm64/kernel/armv8_deprecated.c b/arch/arm64/kernel/armv8_deprecated.c
> index 9d3442d62..8c06dfee0 100644
> --- a/arch/arm64/kernel/armv8_deprecated.c
> +++ b/arch/arm64/kernel/armv8_deprecated.c
> @@ -609,7 +609,7 @@ static struct undef_hook setend_hooks[] = {
> },
> {
> /* Thumb mode */
> - .instr_mask = 0x0000fff7,
> + .instr_mask = 0xfffffff7,
> .instr_val = 0x0000b650,

I can see how this could happen but it would be useful to provide a
concrete example in the commit log.

The instruction opcode built by call_undef_hook() first reads a u16 as a
T16 instruction and the above should be fine. However, if this looks
like a T32 opcode, it reads a subsequent u16 which becomes the lowest
half-word and the above mask/val may inadvertently match it.

The patch looks fine to me as long as you update the commit log.

Thanks.

--
Catalin

\
 
 \ /
  Last update: 2020-04-07 11:28    [W:0.090 / U:1.436 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site