All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] samples/check-exec: Fix building on musl libc
@ 2025-06-30 20:23 Brahmajit Das
  2025-07-01  9:07 ` Mickaël Salaün
  0 siblings, 1 reply; 2+ messages in thread
From: Brahmajit Das @ 2025-06-30 20:23 UTC (permalink / raw)
  To: linux-kernel; +Cc: kees, gnoack3000, mic

Building with make allyesconfig on musl results in the following

In file included from samples/check-exec/inc.c:23:
/usr/include/sys/prctl.h:88:8: error: redefinition of 'struct prctl_mm_map'
   88 | struct prctl_mm_map {
      |        ^~~~~~~~~~~~
In file included from samples/check-exec/inc.c:17:
usr/include/linux/prctl.h:134:8: note: originally defined here
  134 | struct prctl_mm_map {
      |        ^~~~~~~~~~~~

This is mainly due to differnece in the sys/prctl.h between glibC and
musl. The struct prctl_mm_map is defined in sys/prctl.h in musl.

Signed-off-by: Brahmajit Das <listout@listout.xyz>
---
 samples/check-exec/inc.c      | 2 ++
 samples/check-exec/set-exec.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/samples/check-exec/inc.c b/samples/check-exec/inc.c
index 7f6ef06a2f06..775ae8613782 100644
--- a/samples/check-exec/inc.c
+++ b/samples/check-exec/inc.c
@@ -14,7 +14,9 @@
 #define _GNU_SOURCE
 #include <errno.h>
 #include <linux/fcntl.h>
+#if defined(__GLIBC__)
 #include <linux/prctl.h>
+#endif
 #include <linux/securebits.h>
 #include <stdbool.h>
 #include <stdio.h>
diff --git a/samples/check-exec/set-exec.c b/samples/check-exec/set-exec.c
index ba86a60a20dd..a75b8c6e6b11 100644
--- a/samples/check-exec/set-exec.c
+++ b/samples/check-exec/set-exec.c
@@ -9,7 +9,9 @@
 #define _GNU_SOURCE
 #define __SANE_USERSPACE_TYPES__
 #include <errno.h>
+#if defined(__GLIBC__)
 #include <linux/prctl.h>
+#endif
 #include <linux/securebits.h>
 #include <stdbool.h>
 #include <stdio.h>
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-01  9:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-30 20:23 [RFC PATCH] samples/check-exec: Fix building on musl libc Brahmajit Das
2025-07-01  9:07 ` Mickaël Salaün

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.