From: Wake Liu <wakel@google.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Aristeu Rozanski <aris@redhat.com>, Shuah Khan <shuah@kernel.org>,
Aleksa Sarai <cyphar@cyphar.com>,
Lorenzo Stoakes <ljs@kernel.org>,
Carlos Llamas <cmllamas@google.com>,
linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org, Wake Liu <wakel@google.com>
Subject: [PATCH] selftests/memfd: Rename local union semun to avoid bionic clash
Date: Thu, 5 Nov 2026 03:08:43 +0000 [thread overview]
Message-ID: <20261105030843.3319056-1-wakel@google.com> (raw)
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
reply other threads:[~2026-11-05 3:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261105030843.3319056-1-wakel@google.com \
--to=wakel@google.com \
--cc=akpm@linux-foundation.org \
--cc=aris@redhat.com \
--cc=cmllamas@google.com \
--cc=cyphar@cyphar.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®