From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: "Thomas Huth" <thuth@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, Akihiko Odaki <akihiko.odaki@daynix.com>
Subject: Re: [PATCH] io/channel-socket: Fix -fsanitize=undefined problem with latest Clang
Date: Wed, 29 May 2024 15:52:44 +0200 [thread overview]
Message-ID: <93e2d304-7a57-4faa-825b-97c5db09f492@linaro.org> (raw)
In-Reply-To: <20240529133106.1224866-1-thuth@redhat.com>
On 29/5/24 15:31, Thomas Huth wrote:
> Casting function pointers from one type to another causes undefined
> behavior errors when compiling with -fsanitize=undefined with Clang v18:
>
> $ QTEST_QEMU_BINARY=./qemu-system-mips64 tests/qtest/netdev-socket
> TAP version 13
> # random seed: R02S4424f4f460de783fdd3d72c5571d3adc
> 1..10
> # Start of mips64 tests
> # Start of netdev tests
> # Start of stream tests
> # starting QEMU: exec ./qemu-system-mips64 -qtest unix:/tmp/qtest-1213196.sock -qtest-log /dev/null -chardev socket,path=/tmp/qtest-1213196.qmp,id=char0 -mon chardev=char0,mode=control -display none -audio none -nodefaults -M none -netdev stream,id=st0,addr.type=fd,addr.str=3 -accel qtest
> ../io/task.c:78:13: runtime error: call to function qapi_free_SocketAddress through pointer to incorrect function type 'void (*)(void *)'
> /tmp/qemu-sanitize/qapi/qapi-types-sockets.c:170: note: qapi_free_SocketAddress defined here
> SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../io/task.c:78:13
>
> Add a wrapper function to avoid the problem.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> io/channel-socket.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
next prev parent reply other threads:[~2024-05-29 13:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-29 13:31 [PATCH] io/channel-socket: Fix -fsanitize=undefined problem with latest Clang Thomas Huth
2024-05-29 13:52 ` Philippe Mathieu-Daudé [this message]
2024-05-29 13:53 ` Peter Maydell
2024-06-03 12:48 ` Daniel P. Berrangé
2024-06-03 14:38 ` Thomas Huth
2024-06-03 14:49 ` Daniel P. Berrangé
2024-06-03 14:58 ` Peter Maydell
2024-06-03 15:12 ` Peter Maydell
2024-06-03 15:52 ` Daniel P. Berrangé
2024-06-03 15:55 ` Thomas Huth
2024-06-03 14:47 ` Alex Bennée
2024-06-03 14:50 ` Daniel P. Berrangé
2024-06-03 17:46 ` Alex Bennée
2024-06-03 17:55 ` Daniel P. Berrangé
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=93e2d304-7a57-4faa-825b-97c5db09f492@linaro.org \
--to=philmd@linaro.org \
--cc=akihiko.odaki@daynix.com \
--cc=berrange@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=thuth@redhat.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).