[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250630202353.28439-1-listout@listout.xyz>
Date: Tue, 1 Jul 2025 01:53:53 +0530
From: Brahmajit Das <listout@...tout.xyz>
To: linux-kernel@...r.kernel.org
Cc: kees@...nel.org,
gnoack3000@...il.com,
mic@...ikod.net
Subject: [RFC PATCH] samples/check-exec: Fix building on musl libc
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@...tout.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
Powered by blists - more mailing lists