| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes the make_syscall_h.sh script to recognize both
__NR_Linux, used by mips, and __NR_SYSCALL_BASE and
__ARM_NR_BASE used by arm.
Run-tested on arm (ipq806x) and mips (ath79), both with glibc.
Compile-tested and checked resulting syscall_names.h file wuth
glibc: aarch64, powerpc, x86_64, i486
musl: arm, mips
Fixes: FS#4194, FS#4195
Signed-off-by: Peter Lundkvist <peter.lundkvist@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
ARM architecture does not have its system call numbers contiguous. So
far, utrace ignored the non-contiguous system calls, but it makes it
difficult to setup seccomp whitelists. This patch adds support for
these extra out-of-range syscalls.
It extends the generated file syscall_names.h to include a few
functions. Now, for ARM this file looks like:
#include <asm/unistd.h>
static const char *__syscall_names[] = {
[280] = "waitid",
[148] = "fdatasync",
...
[252] = "epoll_wait",
[74] = "sethostname",
};
static inline const char *syscall_name(unsigned i) {
if (i < ARRAY_SIZE(__syscall_names))
return __syscall_names[i];
switch (i) {
case 0x0f0001: return "breakpoint";
case 0x0f0003: return "usr26";
case 0x0f0004: return "usr32";
case 0x0f0005: return "set_tls";
case 0x0f0002: return "cacheflush";
default: return (void*)0;
}
}
static inline int syscall_index(unsigned i) {
if (i < ARRAY_SIZE(__syscall_names))
return i;
switch (i) {
case 0x0f0001: return ARRAY_SIZE(__syscall_names) + 0;
case 0x0f0003: return ARRAY_SIZE(__syscall_names) + 1;
case 0x0f0004: return ARRAY_SIZE(__syscall_names) + 2;
case 0x0f0005: return ARRAY_SIZE(__syscall_names) + 3;
case 0x0f0002: return ARRAY_SIZE(__syscall_names) + 4;
default: return -1;
}
}
static inline int syscall_index_to_number(unsigned i) {
if (i < ARRAY_SIZE(__syscall_names))
return i;
switch (i) {
case ARRAY_SIZE(__syscall_names) + 0: return 0x0f0001;
case ARRAY_SIZE(__syscall_names) + 1: return 0x0f0003;
case ARRAY_SIZE(__syscall_names) + 2: return 0x0f0004;
case ARRAY_SIZE(__syscall_names) + 3: return 0x0f0005;
case ARRAY_SIZE(__syscall_names) + 4: return 0x0f0002;
default: return -1;
}
}
#define SYSCALL_COUNT (ARRAY_SIZE(__syscall_names) + 5)
For x86, which does not have extra syscalls, the file looks this way:
#include <asm/unistd.h>
static const char *__syscall_names[] = {
[247] = "waitid",
[75] = "fdatasync",
...
[232] = "epoll_wait",
[170] = "sethostname",
};
static inline const char *syscall_name(unsigned i) {
if (i < ARRAY_SIZE(__syscall_names))
return __syscall_names[i];
switch (i) {
default: return (void*)0;
}
}
static inline int syscall_index(unsigned i) {
if (i < ARRAY_SIZE(__syscall_names))
return i;
switch (i) {
default: return -1;
}
}
static inline int syscall_index_to_number(unsigned i) {
if (i < ARRAY_SIZE(__syscall_names))
return i;
switch (i) {
default: return -1;
}
}
#define SYSCALL_COUNT (ARRAY_SIZE(__syscall_names) + 0)
Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sometimes the syscall number is not defined with a number but with an
offset to an other syscall and then make_syscall_h.sh created some
broken header file.
For example the bit/syscall.h from musl for i386 has this:
#define __NR_timer_create 259
#define __NR_timer_settime (__NR_timer_create+1)
With this patch the resulting array looks like this:
[259] = "timer_create",
[(__NR_timer_create+1)] = "timer_settime",
This fixes this bug from OpenWrt:
https://dev.openwrt.org/ticket/20195
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
|
Signed-off-by: John Crispin <blogic@openwrt.org>
|