All of lore.kernel.org
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Fredrik Strupe <fredrik@strupe.net>
Cc: will.deacon@arm.com, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Suzuki K Poulose <suzuki.poulose@arm.com>
Subject: Re: [PATCH v2] arm64: armv8_deprecated: Fix undef_hook mask for thumb setend
Date: Wed, 8 Apr 2020 18:17:41 +0100	[thread overview]
Message-ID: <20200408171741.GB2481@gaia> (raw)
In-Reply-To: <ab77076b-774d-9158-bc0c-3cfdd36b6e37@strupe.net>

On Wed, Apr 08, 2020 at 01:29:41PM +0200, Fredrik Strupe wrote:
> For thumb instructions, call_undef_hook() in traps.c first reads a u16,
> and if the u16 indicates a T32 instruction (u16 >= 0xe800), a second
> u16 is read, which then makes up the the lower half-word of a T32
> instruction. For T16 instructions, the second u16 is not read,
> which makes the resulting u32 opcode always have the upper half set to
> 0.
> 
> However, having the upper half of instr_mask in the undef_hook set to 0
> masks out the upper half of all thumb instructions - both T16 and T32.
> This results in trapped T32 instructions with the lower half-word equal
> to the T16 encoding of setend (b650) being matched, even though the upper
> half-word is not 0000 and thus indicates a T32 opcode.
> 
> An example of such a T32 instruction is eaa0b650, which should raise a
> SIGILL since T32 instructions with an eaa prefix are unallocated as per
> Arm ARM, but instead works as a SETEND because the second half-word is set
> to b650.
> 
> This patch fixes the issue by extending instr_mask to include the
> upper u32 half, which will still match T16 instructions where the upper
> half is 0, but not T32 instructions.
> 
> Signed-off-by: Fredrik Strupe <fredrik@strupe.net>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Fixes: 2d888f48e056 ("arm64: Emulate SETEND for AArch32 tasks")

Queued for 5.7. 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: Suzuki K Poulose <suzuki.poulose@arm.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, will.deacon@arm.com
Subject: Re: [PATCH v2] arm64: armv8_deprecated: Fix undef_hook mask for thumb setend
Date: Wed, 8 Apr 2020 18:17:41 +0100	[thread overview]
Message-ID: <20200408171741.GB2481@gaia> (raw)
In-Reply-To: <ab77076b-774d-9158-bc0c-3cfdd36b6e37@strupe.net>

On Wed, Apr 08, 2020 at 01:29:41PM +0200, Fredrik Strupe wrote:
> For thumb instructions, call_undef_hook() in traps.c first reads a u16,
> and if the u16 indicates a T32 instruction (u16 >= 0xe800), a second
> u16 is read, which then makes up the the lower half-word of a T32
> instruction. For T16 instructions, the second u16 is not read,
> which makes the resulting u32 opcode always have the upper half set to
> 0.
> 
> However, having the upper half of instr_mask in the undef_hook set to 0
> masks out the upper half of all thumb instructions - both T16 and T32.
> This results in trapped T32 instructions with the lower half-word equal
> to the T16 encoding of setend (b650) being matched, even though the upper
> half-word is not 0000 and thus indicates a T32 opcode.
> 
> An example of such a T32 instruction is eaa0b650, which should raise a
> SIGILL since T32 instructions with an eaa prefix are unallocated as per
> Arm ARM, but instead works as a SETEND because the second half-word is set
> to b650.
> 
> This patch fixes the issue by extending instr_mask to include the
> upper u32 half, which will still match T16 instructions where the upper
> half is 0, but not T32 instructions.
> 
> Signed-off-by: Fredrik Strupe <fredrik@strupe.net>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Fixes: 2d888f48e056 ("arm64: Emulate SETEND for AArch32 tasks")

Queued for 5.7. Thanks.

-- 
Catalin

  parent reply	other threads:[~2020-04-08 17:17 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
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 [this message]
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=20200408171741.GB2481@gaia \
    --to=catalin.marinas@arm.com \
    --cc=fredrik@strupe.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=suzuki.poulose@arm.com \
    --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.