qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: qemu-devel@nongnu.org, gustavo.romero@linaro.org,
	 Anton Johansson <anjo@rev.ng>
Subject: Re: [PATCH] target/arm: Fix accidental write to TCG constant
Date: Fri, 14 Nov 2025 13:03:43 +0000	[thread overview]
Message-ID: <CAFEAcA-1-pjaGwMhOdbUauWSrPu-CGVMFv3PWcEYKTi5E+QrWw@mail.gmail.com> (raw)
In-Reply-To: <20251106144909.533997-1-richard.henderson@linaro.org>

On Thu, 6 Nov 2025 at 14:49, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Currently an unpredictable movw such as
>
>   movw pc, 0x123
>
> results in the tinycode
>
>    and_i32 $0x123,$0x123,$0xfffffffc
>    mov_i32 pc,$0x123
>    exit_tb $0x0
>
> which is clearly a bug, writing to a constant is incorrect and discards
> the result of the mask.  Fix this by adding a temporary in store_reg().
>
> Signed-off-by: Anton Johansson <anjo@rev.ng>
> [rth: Avoid an extra temp and extra move.]
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---


Applied to target-arm.next, thanks; tweaked the commit
message to match the code:

    which is clearly a bug: writing to a constant is incorrect and
    discards the result of the mask.  Fix this by always doing an and_i32
    and trusting the optimizer to turn this into a simple move when the
    mask is zero.


-- PMM


  parent reply	other threads:[~2025-11-14 13:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-06 14:49 [PATCH] target/arm: Fix accidental write to TCG constant Richard Henderson
2025-11-06 15:48 ` Gustavo Romero
2025-11-06 15:57   ` Peter Maydell
2025-11-06 16:01     ` Richard Henderson
2025-11-06 17:14       ` Anton Johansson via
2025-11-14 13:03 ` Peter Maydell [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-11-05 17:30 Anton Johansson via

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=CAFEAcA-1-pjaGwMhOdbUauWSrPu-CGVMFv3PWcEYKTi5E+QrWw@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=anjo@rev.ng \
    --cc=gustavo.romero@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /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 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).