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) { \