samples/check-exec/inc.c | 2 ++ samples/check-exec/set-exec.c | 2 ++ 2 files changed, 4 insertions(+)
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
On Tue, Jul 01, 2025 at 01:53:53AM +0530, Brahmajit Das wrote:
> 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>
Thanks!
Reviewed-by: Mickaël Salaün <mic@digikod.net>
Kees, feel free to take it in your tree. FYI, for the equivalent
changes in Landlock, I moved down the if/include/endif block to ease
sorting of include lines.
> ---
> 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
>
© 2016 - 2026 Red Hat, Inc.