Tested-by: Arusekk <fl...@arusekk.pl>

Thanks for the patch. I am just a drive-by contributor, not someone
experienced in qemu development, so take my feedback with a grain of salt.

> There are a number of resource leaks in gen-vdso. In theory they are
> harmless because this is a short lived process, but when building QEMU
> with --extra-cflags="-fsanitize=address" problems ensure. The gen-vdso
> program is run as part of the build, and that aborts due to the
> sanitizer identifying memory leaks, leaving QEMU unbuildable.

I have not encountered it personally before.
However, I can confirm that qemu fails to build using

./configure --target-list=x86_64-linux-user --extra-cflags=-fsanitize=address 
&& make

on current master, and that the patch fixes it.

I use gcc (Gentoo Hardened 15.1.0 p1) 15.1.0 libasan.so.8.
Curiously, the leak does not happen e.g. for arm-linux-user target.

> This complaint is about the 'buf' variable, however, the FILE objects
> are also leaked in some error scenarios, so this fix refactors the
> cleanup paths to fix all leaks. For completeness it also reports an
> error if fclose() fails on 'inf'.

How about other error cases?

> diff --git a/linux-user/gen-vdso.c b/linux-user/gen-vdso.c
> index 721f38d5a3..fce9d5cbc3 100644
> --- a/linux-user/gen-vdso.c
> +++ b/linux-user/gen-vdso.c
> @@ -129,7 +130,6 @@ int main(int argc, char **argv)
>          fprintf(stderr, "%s: incomplete read\n", inf_name);
>          return EXIT_FAILURE;

Like this one. Are other places like here possible candidates to also goto 
cleanup?

- Arusekk <https://arusekk.pl>



Reply via email to