From: Peter Xu <peterx@redhat.com>
To: Joe Komlodi <komlodi@google.com>
Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, david@redhat.com,
philmd@linaro.org, venture@google.com, pefoley@google.com
Subject: Re: [PATCH] system/physmem: Fix UBSan finding in address_space_write_rom_internal
Date: Tue, 6 May 2025 09:16:23 -0400 [thread overview]
Message-ID: <aBoLp9kw7-SHAGRa@x1.local> (raw)
In-Reply-To: <20250505222236.1616628-1-komlodi@google.com>
On Mon, May 05, 2025 at 10:22:36PM +0000, Joe Komlodi wrote:
> address_space_write_rom_internal can take in a NULL pointer for ptr if
> it's only doing cache flushes instead of populating the ROM.
>
> However, if building with --enable-ubsan, incrementing buf causes ubsan
> to go off when doing cache flushes, since it will trigger on pointer
> arithmetic on a NULL pointer, even if that NULL pointer doesn't get
> dereferenced.
>
> To fix this, we can move the buf incrementing to only be done when
> writing data to ROM, since that's the only point where it gets
> dereferenced and should be non-NULL.
>
> Found by running:
> qemu-system-aarch64 \
> -machine virt \
> -accel kvm
>
> When built with --enable-ubsan.
>
> Signed-off-by: Joe Komlodi <komlodi@google.com>
queued, thanks.
--
Peter Xu
next prev parent reply other threads:[~2025-05-06 13:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-05 22:22 [PATCH] system/physmem: Fix UBSan finding in address_space_write_rom_internal Joe Komlodi
2025-05-06 13:16 ` Peter Xu [this message]
2025-05-06 13:21 ` Peter Maydell
2025-05-09 15:22 ` Peter Xu
2025-05-14 20:57 ` Peter Xu
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=aBoLp9kw7-SHAGRa@x1.local \
--to=peterx@redhat.com \
--cc=david@redhat.com \
--cc=komlodi@google.com \
--cc=pbonzini@redhat.com \
--cc=pefoley@google.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.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 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.