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: <aEi8DV+ReF3v3Rlf@nvidia.com>
Date: Tue, 10 Jun 2025 16:13:17 -0700
From: Nicolin Chen <nicolinc@...dia.com>
To: Thomas Weißschuh <thomas.weissschuh@...utronix.de>
CC: Shuah Khan <shuah@...nel.org>, Shuah Khan <skhan@...uxfoundation.org>,
	Willy Tarreau <w@....eu>, Thomas Weißschuh
	<linux@...ssschuh.net>, Kees Cook <kees@...nel.org>, Andy Lutomirski
	<luto@...capital.net>, Will Drewry <wad@...omium.org>, Mark Brown
	<broonie@...nel.org>, Muhammad Usama Anjum <usama.anjum@...labora.com>,
	<linux-kernel@...r.kernel.org>, <linux-kselftest@...r.kernel.org>, "Jason
 Gunthorpe" <jgg@...dia.com>
Subject: Re: [PATCH v4 12/14] selftests: harness: Stop using
 setjmp()/longjmp()

On Tue, Jun 10, 2025 at 02:21:25PM +0200, Thomas Weißschuh wrote:
> The following diff *alone* also prevents the warning, but that doesn't
> make any sense either:
> 
> --- a/tools/testing/selftests/iommu/iommufd_utils.h
> +++ b/tools/testing/selftests/iommu/iommufd_utils.h
> @@ -65,7 +65,7 @@ static inline void *memfd_mmap(size_t length, int prot, int flags, int *mfd_p)
>                 return MAP_FAILED;
>         if (ftruncate(mfd, length))
>                 return MAP_FAILED;
> -       *mfd_p = mfd;
> +       *mfd_p = 0;
>         return mmap(0, length, prot, flags, mfd, 0);
>  }
> 
> 
> Maybe the logic became too complex for GCC?

Maybe. Those warnings are gone using a dummy setjmp() without a
longjmp() :-/

diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h
index 2925e47db995..2dc288413fc7 100644
--- a/tools/testing/selftests/kselftest_harness.h
+++ b/tools/testing/selftests/kselftest_harness.h
@@ -67,6 +67,7 @@
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <unistd.h>
+#include <setjmp.h>

 #include "kselftest.h"

@@ -407,6 +408,7 @@
                FIXTURE_DATA(fixture_name) self_private, *self = NULL; \
                pid_t child = 1; \
                int status = 0; \
+               jmp_buf test = {}; \
                /* Makes sure there is only one teardown, even when child forks again. */ \
                _metadata->no_teardown = mmap(NULL, sizeof(*_metadata->no_teardown), \
                        PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0); \
@@ -422,6 +424,7 @@
                } \
                _metadata->variant = variant->data; \
                _metadata->self = self; \
+               setjmp(test); \
                /* _metadata and potentially self are shared with all forks. */ \
                child = fork(); \
                if (child == 0) { \

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ