qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Patrick Venture <venture@google.com>
Cc: Richard Henderson <richard.henderson@linaro.org>,
	pbonzini@redhat.com, peterx@redhat.com,  david@redhat.com,
	philmd@linaro.org, qemu-devel@nongnu.org,
	 Chris Rauer <crauer@google.com>,
	Peter Foley <pefoley@google.com>
Subject: Re: [PATCH] softmmu/memory: use memcpy for multi-byte accesses
Date: Thu, 16 Nov 2023 11:30:37 +0000	[thread overview]
Message-ID: <CAFEAcA-kdA6knf5fqNDaUiHNG=5ek_-jk-i3vNA3oinXHCUH4Q@mail.gmail.com> (raw)
In-Reply-To: <CAO=notyVTQTAsk9u7LkZJF_C+mqPvQPkYB52-cHAoNAWYW9=Lw@mail.gmail.com>

On Wed, 15 Nov 2023 at 17:26, Patrick Venture <venture@google.com> wrote:
>
>
>
> On Wed, Nov 15, 2023 at 9:02 AM Richard Henderson <richard.henderson@linaro.org> wrote:
>>
>> On 11/15/23 08:58, Patrick Venture wrote:
>> >
>> >
>> > On Wed, Nov 15, 2023 at 2:35 AM Peter Maydell <peter.maydell@linaro.org
>> > <mailto:peter.maydell@linaro.org>> wrote:
>> >
>> >     On Tue, 14 Nov 2023 at 20:55, Patrick Venture <venture@google.com
>> >     <mailto:venture@google.com>> wrote:
>> >      > Avoids unaligned pointer issues.
>> >      >
>> >
>> >     It would be nice to be more specific in the commit message here, by
>> >     describing what kind of guest behaviour or machine config runs into this
>> >     problem, and whether this happens in a situation users are likely to
>> >     run into. If the latter, we should consider tagging the commit
>> >     with "Cc: qemu-stable@nongnu.org <mailto:qemu-stable@nongnu.org>" to have it
>> >     backported to the
>> >     stable release branches.
>> >
>> >
>> > Thanks! I'll update the commit message with v2.  We were seeing this in our
>> > infrastructure with unaligned accesses using the pointer dereference as there are no
>> > guarantees on alignment of the incoming values.
>>
>> Which host cpu, for reference?  There aren't many that generate unaligned traps these days...
>>
>
> Here's the sanitizer log/qemu log, the host-cpu was an amd64.
> third_party/qemu/softmmu/memory.c:1341:16: runtime error: load of misaligned address 0x52500020b10d for type 'uint32_t' (aka 'unsigned int'), which requires 4 byte alignment
> 0x52500020b10d: note: pointer points here
>  ab ab ab ab ab ab ab  ab ab ab ab ab ab ab ab  ab ab ab ab ab ab ab ab  ab ab ab ab ab ab ab ab  ab
>              ^

> SUMMARY: UndefinedBehaviorSanitizer: misaligned-pointer-use third_party/qemu/softmmu/memory.c:1341:16 in

Ah, right, so the clang/gcc undefined-behaviour sanitizers rather than
the actual host hardware barfing. (We definitely want to fix these
regardless.)

thanks
-- PMM


      parent reply	other threads:[~2023-11-16 11:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-14 20:55 [PATCH] softmmu/memory: use memcpy for multi-byte accesses Patrick Venture
2023-11-14 21:18 ` Richard Henderson
2023-11-14 21:39   ` Patrick Venture
2023-11-15 10:30   ` Peter Maydell
2023-11-15 16:57     ` Patrick Venture
2023-11-15 10:34 ` Peter Maydell
2023-11-15 16:58   ` Patrick Venture
2023-11-15 17:02     ` Richard Henderson
2023-11-15 17:26       ` Patrick Venture
2023-11-15 17:26         ` Patrick Venture
2023-11-16 11:30         ` Peter Maydell [this message]

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-kdA6knf5fqNDaUiHNG=5ek_-jk-i3vNA3oinXHCUH4Q@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=crauer@google.com \
    --cc=david@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=pefoley@google.com \
    --cc=peterx@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=venture@google.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 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).