Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <19f1b1afca9.678b147b1225424.719798787407565814@soss.website>
Date: Tue, 30 Jun 2026 19:36:21 -0500
From: Skye Soss <skye@...s.website>
To: "musl" <musl@...ts.openwall.com>
Subject: [PATCH v2] add execveat syscall wrapper


the execveat syscall was added to Linux in 3.19 (released in 2015),
and the libc wrapper function was added to glibc in 2021.

the AT_EXECVE_CHECK option was added to Linux 6.14 and is used alongside
execveat to perform executability checking.
---
 include/fcntl.h        | 1 +
 include/unistd.h       | 1 +
 src/process/execveat.c | 7 +++++++
 3 files changed, 9 insertions(+)
 create mode 100644 src/process/execveat.c

diff --git a/include/fcntl.h b/include/fcntl.h
index 53f98a8b..ce1310ac 100644
--- a/include/fcntl.h
+++ b/include/fcntl.h
@@ -192,6 +192,7 @@ ssize_t vmsplice(int, const struct iovec *, size_t, unsigned);
 ssize_t splice(int, off_t *, int, off_t *, size_t, unsigned);
 ssize_t tee(int, int, size_t, unsigned);
 #define loff_t off_t
+#define AT_EXECVE_CHECK 0x10000
 #endif
 
 #if defined(_LARGEFILE64_SOURCE)
diff --git a/include/unistd.h b/include/unistd.h
index 42b0e82b..76fd165f 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -196,6 +196,7 @@ int euidaccess(const char *, int);
 int eaccess(const char *, int);
 ssize_t copy_file_range(int, off_t *, int, off_t *, size_t, unsigned);
 pid_t gettid(void);
+int execveat(int, const char *, char *const [], char *const [], int);
 #endif
 
 #if defined(_LARGEFILE64_SOURCE)
diff --git a/src/process/execveat.c b/src/process/execveat.c
new file mode 100644
index 00000000..a9d12877
--- /dev/null
+++ b/src/process/execveat.c
@@ -0,0 +1,7 @@
+#include <unistd.h>
+#include "syscall.h"
+
+int execveat(int dirfd, const char *path, char *const argv[], char *const envp[], int flags)
+{
+    return syscall(SYS_execveat, dirfd, path, argv, envp, flags);
+}
-- 
2.54.0



Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.