* [PATCH] selftests/memfd: Rename local union semun to avoid bionic clash
@ 2026-11-05 3:08 Wake Liu
2026-11-19 3:35 ` Wake Liu
2026-11-19 5:26 ` + selftests-memfd-rename-local-union-semun-to-avoid-bionic-clash.patch added to mm-new branch Andrew Morton
0 siblings, 2 replies; 3+ messages in thread
From: Wake Liu @ 2026-11-05 3:08 UTC (permalink / raw)
To: Andrew Morton
Cc: Aristeu Rozanski, Shuah Khan, Aleksa Sarai, Lorenzo Stoakes,
Carlos Llamas, linux-mm, linux-kselftest, linux-kernel, Wake Liu
Commit b24335521de9 ("selftests/memfd: use IPC semaphore instead of
SIGSTOP/SIGCONT") added a local definition of union semun, since glibc
and musl expect the caller to define it before calling semctl().
Bionic, however, already defines union semun in <sys/sem.h>, so
memfd_test no longer builds against it:
memfd_test.c:45:7: error: redefinition of 'semun'
Rename the local union to memfd_semun. Its layout is unchanged, so it
can still be passed as the variadic semctl() argument with any C
library.
Fixes: b24335521de9 ("selftests/memfd: use IPC semaphore instead of SIGSTOP/SIGCONT")
Signed-off-by: Wake Liu <wakel@google.com>
---
tools/testing/selftests/memfd/memfd_test.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/memfd/memfd_test.c b/tools/testing/selftests/memfd/memfd_test.c
index cdab3a837624..188cb7c32db1 100644
--- a/tools/testing/selftests/memfd/memfd_test.c
+++ b/tools/testing/selftests/memfd/memfd_test.c
@@ -42,7 +42,13 @@
F_SEAL_EXEC)
#define MFD_NOEXEC_SEAL 0x0008U
-union semun {
+
+/*
+ * glibc and musl leave union semun for the caller to define, but bionic
+ * already provides it in <sys/sem.h>. Use a private name so the test
+ * builds against all of them.
+ */
+union memfd_semun {
int val;
struct semid_ds *buf;
unsigned short int *array;
@@ -1387,7 +1393,7 @@ static void test_sysctl_sysctl2_failset(void)
static int sysctl_nested_child(void *arg)
{
int pid, sem;
- union semun semun;
+ union memfd_semun semun;
struct sembuf sembuf;
printf("%s nested sysctl 0\n", memfd_str);
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
--
2.56.0.398.g882cbad275-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] selftests/memfd: Rename local union semun to avoid bionic clash
2026-11-05 3:08 [PATCH] selftests/memfd: Rename local union semun to avoid bionic clash Wake Liu
@ 2026-11-19 3:35 ` Wake Liu
2026-11-19 5:26 ` + selftests-memfd-rename-local-union-semun-to-avoid-bionic-clash.patch added to mm-new branch Andrew Morton
1 sibling, 0 replies; 3+ messages in thread
From: Wake Liu @ 2026-11-19 3:35 UTC (permalink / raw)
To: Andrew Morton, Shuah Khan, Shuah Khan
Cc: Aristeu Rozanski, Aleksa Sarai, Lorenzo Stoakes, Carlos Llamas,
linux-mm, linux-kselftest, linux-kernel
Hi Andrew, Shuah,
Gentle ping on this build fix for memfd_test against bionic:
https://lore.kernel.org/all/20261105030843.3319056-1-wakel@google.com/
Since b24335521de9 went through the mm tree, Andrew, would you mind
picking this up, or should it go via Shuah's kselftest tree?
Thanks,
Wake
^ permalink raw reply [flat|nested] 3+ messages in thread
* + selftests-memfd-rename-local-union-semun-to-avoid-bionic-clash.patch added to mm-new branch
2026-11-05 3:08 [PATCH] selftests/memfd: Rename local union semun to avoid bionic clash Wake Liu
2026-11-19 3:35 ` Wake Liu
@ 2026-11-19 5:26 ` Andrew Morton
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2026-11-19 5:26 UTC (permalink / raw)
To: mm-commits, shuah, ljs, cyphar, cmllamas, aris, wakel, akpm
The patch titled
Subject: selftests/memfd: rename local union semun to avoid bionic clash
has been added to the -mm mm-new branch. Its filename is
selftests-memfd-rename-local-union-semun-to-avoid-bionic-clash.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/selftests-memfd-rename-local-union-semun-to-avoid-bionic-clash.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Wake Liu <wakel@google.com>
Subject: selftests/memfd: rename local union semun to avoid bionic clash
Date: Thu, 5 Nov 2026 03:08:43 +0000
Commit b24335521de9 ("selftests/memfd: use IPC semaphore instead of
SIGSTOP/SIGCONT") added a local definition of union semun, since glibc and
musl expect the caller to define it before calling semctl(). Bionic,
however, already defines union semun in <sys/sem.h>, so memfd_test no
longer builds against it:
memfd_test.c:45:7: error: redefinition of 'semun'
Rename the local union to memfd_semun. Its layout is unchanged, so it can
still be passed as the variadic semctl() argument with any C library.
Link: https://patch.msgid.link/20261105030843.3319056-1-wakel@google.com
Fixes: b24335521de9 ("selftests/memfd: use IPC semaphore instead of SIGSTOP/SIGCONT")
Signed-off-by: Wake Liu <wakel@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Aristeu Rozanski <aris@redhat.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Aleksa Sarai <cyphar@cyphar.com>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Carlos Llamas <cmllamas@google.com>
tools/testing/selftests/memfd/memfd_test.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
--- a/tools/testing/selftests/memfd/memfd_test.c~selftests-memfd-rename-local-union-semun-to-avoid-bionic-clash
+++ a/tools/testing/selftests/memfd/memfd_test.c
@@ -42,7 +42,13 @@
F_SEAL_EXEC)
#define MFD_NOEXEC_SEAL 0x0008U
-union semun {
+
+/*
+ * glibc and musl leave union semun for the caller to define, but bionic
+ * already provides it in <sys/sem.h>. Use a private name so the test
+ * builds against all of them.
+ */
+union memfd_semun {
int val;
struct semid_ds *buf;
unsigned short int *array;
@@ -1387,7 +1393,7 @@ static void test_sysctl_sysctl2_failset(
static int sysctl_nested_child(void *arg)
{
int pid, sem;
- union semun semun;
+ union memfd_semun semun;
struct sembuf sembuf;
printf("%s nested sysctl 0\n", memfd_str);
_
Patches currently in -mm which might be from wakel@google.com are
selftests-memfd-rename-local-union-semun-to-avoid-bionic-clash.patch
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-19 5:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-05 3:08 [PATCH] selftests/memfd: Rename local union semun to avoid bionic clash Wake Liu
2026-11-19 3:35 ` Wake Liu
2026-11-19 5:26 ` + selftests-memfd-rename-local-union-semun-to-avoid-bionic-clash.patch added to mm-new branch Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.