[PATCH 2/4] scripts/lsan_suppressions.txt: Add more leaks

Peter Maydell posted 4 patches 2 days, 18 hours ago
Maintainers: "Alex Bennée" <alex.bennee@linaro.org>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Thomas Huth <thuth@redhat.com>, "Cédric Le Goater" <clg@kaod.org>, Peter Maydell <peter.maydell@linaro.org>, Steven Lee <steven_lee@aspeedtech.com>, Troy Lee <leetroy@gmail.com>, Jamin Lin <jamin_lin@aspeedtech.com>, Andrew Jeffery <andrew@codeconstruct.com.au>, Joel Stanley <joel@jms.id.au>, Eric Auger <eric.auger@redhat.com>, Fabiano Rosas <farosas@suse.de>, Laurent Vivier <lvivier@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
[PATCH 2/4] scripts/lsan_suppressions.txt: Add more leaks
Posted by Peter Maydell 2 days, 18 hours ago
Running "make check" with the clang leak sanitizer reveals some
leak reports which are either not our problem or else not
a leak which is worth our time to fix. Add some suppressions
for these.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 scripts/lsan_suppressions.txt | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/scripts/lsan_suppressions.txt b/scripts/lsan_suppressions.txt
index ffade3ba5a..bd6ef07079 100644
--- a/scripts/lsan_suppressions.txt
+++ b/scripts/lsan_suppressions.txt
@@ -9,3 +9,23 @@ leak:/lib64/libtcmalloc_minimal.so.4
 
 # libxkbcommon also leaks in qemu-keymap
 leak:/lib64/libxkbcommon.so.0
+
+# g_set_user_dirs() deliberately leaks the previous cached g_get_user_*
+# values. This is documented in upstream glib's valgrind-format
+# suppression file:
+# https://github.com/GNOME/glib/blob/main/tools/glib.supp
+# This avoids false positive leak reports for the qga-ssh-test.
+leak:g_set_user_dirs
+
+# The walk_path() function in qos-test does free its memory,
+# but something about the setup with tests run in a subprocess
+# seems to confuse the sanitizer. Suppress the errors.
+leak:walk_path
+
+# qemu_irq_intercept_in is only used by the qtest harness, and
+# its API inherently involves a leak.
+# While we could keep track of the old IRQ data structure
+# in order to free it, it doesn't seem very important to fix
+# since it is only used by the qtest test harness.
+# Just ignore the leak, at least for the moment.
+leak:qemu_irq_intercept_in
-- 
2.43.0
Re: [PATCH 2/4] scripts/lsan_suppressions.txt: Add more leaks
Posted by Fabiano Rosas 2 days, 13 hours ago
Peter Maydell <peter.maydell@linaro.org> writes:

> Running "make check" with the clang leak sanitizer reveals some
> leak reports which are either not our problem or else not
> a leak which is worth our time to fix. Add some suppressions
> for these.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Reviewed-by: Fabiano Rosas <farosas@suse.de>

FYI, mine has these. The first one is on my list to fix once I find some
time. The last two seem to be part of the stack for the ones you added
here.

leak:qcrypto_tls_session_push
leak:gnutls_handshake
leak:memory_region_do_init
leak:qos_traverse_graph
leak:qdev_get_named_gpio_list

> ---
>  scripts/lsan_suppressions.txt | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
>
> diff --git a/scripts/lsan_suppressions.txt b/scripts/lsan_suppressions.txt
> index ffade3ba5a..bd6ef07079 100644
> --- a/scripts/lsan_suppressions.txt
> +++ b/scripts/lsan_suppressions.txt
> @@ -9,3 +9,23 @@ leak:/lib64/libtcmalloc_minimal.so.4
>  
>  # libxkbcommon also leaks in qemu-keymap
>  leak:/lib64/libxkbcommon.so.0
> +
> +# g_set_user_dirs() deliberately leaks the previous cached g_get_user_*
> +# values. This is documented in upstream glib's valgrind-format
> +# suppression file:
> +# https://github.com/GNOME/glib/blob/main/tools/glib.supp
> +# This avoids false positive leak reports for the qga-ssh-test.
> +leak:g_set_user_dirs
> +
> +# The walk_path() function in qos-test does free its memory,
> +# but something about the setup with tests run in a subprocess
> +# seems to confuse the sanitizer. Suppress the errors.
> +leak:walk_path
> +
> +# qemu_irq_intercept_in is only used by the qtest harness, and
> +# its API inherently involves a leak.
> +# While we could keep track of the old IRQ data structure
> +# in order to free it, it doesn't seem very important to fix
> +# since it is only used by the qtest test harness.
> +# Just ignore the leak, at least for the moment.
> +leak:qemu_irq_intercept_in
Re: [PATCH 2/4] scripts/lsan_suppressions.txt: Add more leaks
Posted by Peter Maydell 2 days, 13 hours ago
On Fri, 27 Feb 2026 at 18:57, Fabiano Rosas <farosas@suse.de> wrote:
>
> Peter Maydell <peter.maydell@linaro.org> writes:
>
> > Running "make check" with the clang leak sanitizer reveals some
> > leak reports which are either not our problem or else not
> > a leak which is worth our time to fix. Add some suppressions
> > for these.
> >
> > Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>
> Reviewed-by: Fabiano Rosas <farosas@suse.de>
>
> FYI, mine has these. The first one is on my list to fix once I find some
> time. The last two seem to be part of the stack for the ones you added
> here.
>
> leak:qcrypto_tls_session_push
> leak:gnutls_handshake
> leak:memory_region_do_init
> leak:qos_traverse_graph
> leak:qdev_get_named_gpio_list

qdev_get_named_gpio_list is definitely used in paths other than
the qemu_irq_intercept_in one we want to hit.

I think that recent memory region fixes ought to have fixed the
ones you're suppressing with memory_region_do_init.

I couldn't make any sense of the qos_traverse_graph/walk_path one:
it seems to be related to the qtest "subprocess" functionality
somehow and doesn't repro without that.

thanks
-- PMM
Re: [PATCH 2/4] scripts/lsan_suppressions.txt: Add more leaks
Posted by Fabiano Rosas 2 days, 13 hours ago
Peter Maydell <peter.maydell@linaro.org> writes:

> On Fri, 27 Feb 2026 at 18:57, Fabiano Rosas <farosas@suse.de> wrote:
>>
>> Peter Maydell <peter.maydell@linaro.org> writes:
>>
>> > Running "make check" with the clang leak sanitizer reveals some
>> > leak reports which are either not our problem or else not
>> > a leak which is worth our time to fix. Add some suppressions
>> > for these.
>> >
>> > Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>>
>> Reviewed-by: Fabiano Rosas <farosas@suse.de>
>>
>> FYI, mine has these. The first one is on my list to fix once I find some
>> time. The last two seem to be part of the stack for the ones you added
>> here.
>>
>> leak:qcrypto_tls_session_push
>> leak:gnutls_handshake
>> leak:memory_region_do_init
>> leak:qos_traverse_graph
>> leak:qdev_get_named_gpio_list
>
> qdev_get_named_gpio_list is definitely used in paths other than
> the qemu_irq_intercept_in one we want to hit.
>
> I think that recent memory region fixes ought to have fixed the
> ones you're suppressing with memory_region_do_init.
>
> I couldn't make any sense of the qos_traverse_graph/walk_path one:
> it seems to be related to the qtest "subprocess" functionality
> somehow and doesn't repro without that.
>

Ahh I remember this... Here, patch 5/6:

https://lore.kernel.org/r/20241209204427.17763-1-farosas@suse.de

> thanks
> -- PMM