aboutsummaryrefslogtreecommitdiff
path: root/pk
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2022-04-11 01:22:16 -0700
committerAndrew Waterman <andrew@sifive.com>2022-04-11 01:30:19 -0700
commitca69d69a304d5668a8c95d1de5c6c6fa71ed9936 (patch)
tree340f27ecb52c59fd3558e6787ea5db9e34e23913 /pk
parentd6008c14176bd663e7def6b89679b160af4815c2 (diff)
downloadpk-ca69d69a304d5668a8c95d1de5c6c6fa71ed9936.zip
pk-ca69d69a304d5668a8c95d1de5c6c6fa71ed9936.tar.gz
pk-ca69d69a304d5668a8c95d1de5c6c6fa71ed9936.tar.bz2
Handle unimplemented syscalls gracefully
We previously kernel-panicked because that made it more obvious when a syscall implementation was missing. These days, it's more common that the C library will do something sensible in response to returning -ENOSYS. Favor that approach to avoid frustrating users.
Diffstat (limited to 'pk')
-rw-r--r--pk/syscall.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/pk/syscall.c b/pk/syscall.c
index 9c430fd..ec53b32 100644
--- a/pk/syscall.c
+++ b/pk/syscall.c
@@ -617,7 +617,6 @@ long do_syscall(long a0, long a1, long a2, long a3, long a4, long a5, unsigned l
[SYS_munmap] = sys_munmap,
[SYS_mremap] = sys_mremap,
[SYS_mprotect] = sys_mprotect,
- [SYS_prlimit64] = sys_stub_nosys,
[SYS_rt_sigaction] = sys_rt_sigaction,
[SYS_gettimeofday] = sys_gettimeofday,
[SYS_times] = sys_times,
@@ -628,18 +627,9 @@ long do_syscall(long a0, long a1, long a2, long a3, long a4, long a5, unsigned l
[SYS_getdents] = sys_getdents,
[SYS_dup] = sys_dup,
[SYS_dup3] = sys_dup3,
- [SYS_readlinkat] = sys_stub_nosys,
[SYS_rt_sigprocmask] = sys_stub_success,
- [SYS_ioctl] = sys_stub_nosys,
[SYS_clock_gettime] = sys_clock_gettime,
- [SYS_getrusage] = sys_stub_nosys,
- [SYS_getrlimit] = sys_stub_nosys,
- [SYS_setrlimit] = sys_stub_nosys,
[SYS_chdir] = sys_chdir,
- [SYS_set_tid_address] = sys_stub_nosys,
- [SYS_set_robust_list] = sys_stub_nosys,
- [SYS_madvise] = sys_stub_nosys,
- [SYS_sysinfo] = sys_stub_nosys,
};
const static void* old_syscall_table[] = {
@@ -661,7 +651,7 @@ long do_syscall(long a0, long a1, long a2, long a3, long a4, long a5, unsigned l
f = old_syscall_table[n - OLD_SYSCALL_THRESHOLD];
if (!f)
- panic("bad syscall #%ld!",n);
+ return sys_stub_nosys();
f = (void*)pa2kva(f);