From 051ffe5ab6cc5fc5ab81977324e6c04fad0735cd Mon Sep 17 00:00:00 2001 From: Root THC Date: Wed, 4 Dec 2024 04:30:13 -0600 Subject: [PATCH] memexec CICD --- tools/utils.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/tools/utils.c b/tools/utils.c index 6c82da2..a39b028 100644 --- a/tools/utils.c +++ b/tools/utils.c @@ -97,20 +97,25 @@ cpy(int dst, int src) { return 0; } -#if !defined(HAVE_EXECVEAT) && defined(HAVE_SYSCALL_H) -# if !defined(SYS_execveat) && defined(linux) -# define SYS_execveat 322 -# warning "Using NR_execveat=322. Will work on linux/x86_64 only" -# endif -# ifdef SYS_execveat -# warning "No native execveat() support. Using direct syscall(__NR_execveat, ..) instead." + +#if !defined(HAVE_EXECVEAT) +# if !defined(HAVE_SYS_SYSCALL_H) +# warning "no syscall() support. Disabling execveat()." +# else +# if !defined(SYS_execveat) && defined(linux) +# define SYS_execveat 322 +# warning "Using NR_execveat=322. Will work on linux/x86_64 only" +# endif +# ifdef SYS_execveat +# warning "No native execveat() support. Using direct syscall(__NR_execveat, ..) instead." static int execveat(int fd, const char *pathname, char *const argv[], char *const *envp, int flags) { return syscall(SYS_execveat /*__NR_execveat*/, fd, pathname, argv, envp, flags); } -# define HAVE_EXECVEAT 1 -# else -# warning "No SYS_execveat" +# define HAVE_EXECVEAT 1 +# else +# warning "No SYS_execveat" +# endif # endif #endif #if !defined(MFD_CLOEXEC)