Last active
June 20, 2017 18:20
-
-
Save drewr/f37c2f7ffb4e01add17bc20566085206 to your computer and use it in GitHub Desktop.
Utility to find syscall ordinals on ARMv8 64-bit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* gcc -D__ARCH_WANT_SYSCALL_DEPRECATED syscalls.c | |
* | |
* Thank you rmuir! | |
*/ | |
#include <linux/audit.h> | |
#include <asm/unistd.h> | |
#include <stdio.h> | |
/* amd64-specific, set limit to block X32 abi syscalls: see syscall(2) */ | |
#ifdef __X32_SYSCALL_BIT | |
#define LIMIT (__X32_SYSCALL_BIT - 1) | |
#else | |
#define LIMIT 0xFFFFFFFF | |
#endif | |
int | |
main(int argc, char *argv[]) { | |
/* replace this w/ AUDIT_XXX from linux/audit.h. syscall_get_arch() | |
needs newish linux */ | |
printf("audit: %x\n", AUDIT_ARCH_AARCH64); | |
printf("limit: %x\n", LIMIT); | |
printf("fork: %d\n", __NR_fork); | |
printf("vfork: %d\n", __NR_vfork); | |
printf("execve: %d\n", __NR_execve); | |
printf("execveat: %d\n", __NR_execveat); | |
printf("seccomp: %d\n", __NR_seccomp); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment