lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250616162702.GQ1174925@nvidia.com>
Date: Mon, 16 Jun 2025 13:27:02 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Nicolin Chen <nicolinc@...dia.com>
Cc: kevin.tian@...el.com, shuah@...nel.org, joao.m.martins@...cle.com,
	steven.sistare@...cle.com, iommu@...ts.linux.dev,
	linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org,
	thomas.weissschuh@...utronix.de
Subject: Re: [PATCH rc 4/4] iommufd/selftest: Fix build warnings due to
 uninitialized mfd

On Sun, Jun 15, 2025 at 10:02:06PM -0700, Nicolin Chen wrote:
> Commit 869c788909b9 ("selftests: harness: Stop using setjmp()/longjmp()")
> changed the harness structure. For some unknown reason, two build warnings
> occur to the iommufd selftest:
> 
> iommufd.c: In function ‘wrapper_iommufd_mock_domain_all_aligns’:
> iommufd.c:1807:17: warning: ‘mfd’ may be used uninitialized in this function
>  1807 |                 close(mfd);
>       |                 ^~~~~~~~~~
> iommufd.c:1767:13: note: ‘mfd’ was declared here
>  1767 |         int mfd;
>       |             ^~~
> iommufd.c: In function ‘wrapper_iommufd_mock_domain_all_aligns_copy’:
> iommufd.c:1870:17: warning: ‘mfd’ may be used uninitialized in this function
>  1870 |                 close(mfd);
>       |                 ^~~~~~~~~~
> iommufd.c:1819:13: note: ‘mfd’ was declared here
>  1819 |         int mfd;
>       |             ^~~
> 
> All the mfd have been used in the variant->file path only, so it's likely
> a false alarm.
> 
> FWIW, the commit mentioned above does not cause this, yet it might affect
> gcc in a certain way that resulted in the warnings. It is also found that
> ading a dummy setjmp (which doesn't make sense) could mute the warnings:
> https://lore.kernel.org/all/aEi8DV+ReF3v3Rlf@nvidia.com/
> 
> The job of this selftest is to catch kernel bug, while such warnings will
> unlikely disrupt its role. Mute the warning by force initializing the mfd
> and add an ASSERT_GT().
> 
> Signed-off-by: Nicolin Chen <nicolinc@...dia.com>
> ---
>  tools/testing/selftests/iommu/iommufd.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)

Reviewed-by: Jason Gunthorpe <jgg@...dia.com>

Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ