* "make check" fails in a clang sanitizer build on "nbd-qemu-allocation" iotest
@ 2021-11-15 17:11 Peter Maydell
2021-11-15 22:28 ` Eric Blake
0 siblings, 1 reply; 2+ messages in thread
From: Peter Maydell @ 2021-11-15 17:11 UTC (permalink / raw)
To: QEMU Developers; +Cc: Eric Blake, Qemu-block
Hi; running a 'make check' on a clang sanitizer build one of
the iotests falls over due to a NULL pointer being passed to
memset():
TEST iotest-qcow2: nbd-qemu-allocation [fail]
QEMU --
"/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang/tests/qemu-iotests/../../qemu-system-aarch64"
-nodefaults -display none -accel qtest -machine virt
QEMU_IMG --
"/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang/tests/qemu-iotests/../../qemu-img"
QEMU_IO --
"/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang/tests/qemu-iotests/../../qemu-io"
--cache writeback --aio threads -f qcow2
QEMU_NBD --
"/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang/tests/qemu-iotests/../../qemu-nbd"
IMGFMT -- qcow2
IMGPROTO -- file
PLATFORM -- Linux/x86_64 e104462 5.4.0-89-generic
TEST_DIR --
/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang/tests/qemu-iotests/scratch
SOCK_DIR -- /tmp/tmp13ihi_hj
GDB_OPTIONS --
VALGRIND_QEMU --
PRINT_QEMU_OUTPUT --
--- /home/petmay01/linaro/qemu-from-laptop/qemu/tests/qemu-iotests/tests/nbd-qemu-allocation.out
+++ nbd-qemu-allocation.out.bad
@@ -14,6 +14,8 @@
[{ "start": 0, "length": 1048576, "depth": 1, "present": true,
"zero": false, "data": true, "offset": 327680},
{ "start": 1048576, "length": 2097152, "depth": 0, "present": true,
"zero": false, "data": true, "offset": 327680},
{ "start": 3145728, "length": 1048576, "depth": 1, "present": false,
"zero": true, "data": false}]
+../../nbd/server.c:1027:16: runtime error: null pointer passed as
argument 1, which is declared to never be null
+/usr/include/string.h:61:62: note: nonnull attribute specified here
exports available: 1
export: ''
size: 4194304
TEST iotest-qcow2: qsd-jobs
Not run: 172 186 192 220 287
Failures: nbd-qemu-allocation
Failed 1 of 118 iotests
Does this look familiar ?
-- PMM
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: "make check" fails in a clang sanitizer build on "nbd-qemu-allocation" iotest
2021-11-15 17:11 "make check" fails in a clang sanitizer build on "nbd-qemu-allocation" iotest Peter Maydell
@ 2021-11-15 22:28 ` Eric Blake
0 siblings, 0 replies; 2+ messages in thread
From: Eric Blake @ 2021-11-15 22:28 UTC (permalink / raw)
To: Peter Maydell; +Cc: QEMU Developers, Qemu-block
On Mon, Nov 15, 2021 at 05:11:54PM +0000, Peter Maydell wrote:
> Hi; running a 'make check' on a clang sanitizer build one of
> the iotests falls over due to a NULL pointer being passed to
> memset():
>
>
> TEST iotest-qcow2: nbd-qemu-allocation [fail]
> +../../nbd/server.c:1027:16: runtime error: null pointer passed as
> argument 1, which is declared to never be null
The code in question:
if (client->opt == NBD_OPT_LIST_META_CONTEXT && !nb_queries) {
/* enable all known contexts */
meta->base_allocation = true;
meta->allocation_depth = meta->exp->allocation_depth;
memset(meta->bitmaps, 1, meta->exp->nr_export_bitmaps);
I suspect what is happening is that meta->bitmaps is NULL when
meta->exp->nr_export_bitmaps is 0. It's annoying that clang's
sanitizer whines even for a 0-length memset, but a strict reading of
POSIX says that we really are in the technically undefined behavior
when passing NULL (even with 0 length), so such whiny behavior is
permitted. So I'll post a patch.
>
> Does this look familiar ?
First I've heard of it; thanks for alerting me.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-11-15 22:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 17:11 "make check" fails in a clang sanitizer build on "nbd-qemu-allocation" iotest Peter Maydell
2021-11-15 22:28 ` Eric Blake
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.