From: Catalin Marinas <catalin.marinas@arm.com>
To: Fredrik Strupe <fredrik@strupe.net>
Cc: Will Deacon <will.deacon@arm.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] arm64: armv8_deprecated: Fix undef_hook mask for thumb setend
Date: Tue, 7 Apr 2020 10:27:45 +0100 [thread overview]
Message-ID: <20200407092744.GA2665@gaia> (raw)
In-Reply-To: <911db2f1-e078-a460-32ee-154a0b4de5d4@strupe.net>
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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Catalin Marinas <catalin.marinas@arm.com>
To: Fredrik Strupe <fredrik@strupe.net>
Cc: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Will Deacon <will.deacon@arm.com>
Subject: Re: [PATCH] arm64: armv8_deprecated: Fix undef_hook mask for thumb setend
Date: Tue, 7 Apr 2020 10:27:45 +0100 [thread overview]
Message-ID: <20200407092744.GA2665@gaia> (raw)
In-Reply-To: <911db2f1-e078-a460-32ee-154a0b4de5d4@strupe.net>
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
next prev parent reply other threads:[~2020-04-07 9:27 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-06 14:16 [PATCH] arm64: armv8_deprecated: Fix undef_hook mask for thumb setend Fredrik Strupe
2020-04-06 14:16 ` Fredrik Strupe
2020-04-07 9:27 ` Catalin Marinas [this message]
2020-04-07 9:27 ` Catalin Marinas
2020-04-07 10:47 ` Suzuki K Poulose
2020-04-07 10:47 ` Suzuki K Poulose
2020-04-07 11:12 ` Fredrik Strupe
2020-04-07 11:12 ` Fredrik Strupe
2020-04-07 11:18 ` Fredrik Strupe
2020-04-07 11:18 ` Fredrik Strupe
2020-04-08 9:01 ` Catalin Marinas
2020-04-08 9:01 ` Catalin Marinas
2020-04-08 9:58 ` Fredrik Strupe
2020-04-08 9:58 ` Fredrik Strupe
2020-04-08 11:29 ` [PATCH v2] " Fredrik Strupe
2020-04-08 11:29 ` Fredrik Strupe
2020-04-08 11:39 ` Suzuki K Poulose
2020-04-08 11:39 ` Suzuki K Poulose
2020-04-08 17:17 ` Catalin Marinas
2020-04-08 17:17 ` Catalin Marinas
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=20200407092744.GA2665@gaia \
--to=catalin.marinas@arm.com \
--cc=fredrik@strupe.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=will.deacon@arm.com \
/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.