syscalls.md

April 25, 2022 ยท View on GitHub

List of supported Linux syscalls

Tilck supports both the int 0x80 syscall interface and the sysenter one. Here below there is an up-to-date table containing the status of each supported syscall at the moment. Because the list of the not-yet-supported syscalls is much longer than the list of supported ones, the table below mentions only the syscalls having some degree of support. The missing syscalls have to be considered as not implemented yet.

SyscallSupport level
sys_exitfull
sys_forkfull
sys_readfull
sys_writefull
sys_openpartial++ [1]
sys_closefull
sys_waitpidfull
sys_execvefull
sys_chdirfull
sys_getpidfull
sys_setuid16limited [3]
sys_getuid16limited [3]
sys_pauseminimal [2]
sys_accesspartial
sys_brkfull
sys_setgid16limited [3]
sys_getgid16limited [3]
sys_seteuid16limited [3]
sys_setegid16limited [3]
sys_geteuid16limited [3]
sys_getegid16limited [3]
sys_ioctlpartial
sys_getppidfull
sys_gettimeofdayfull
sys_munmapfull
sys_wait4full
sys_newunamefull
sys_llseekfull
sys_readvfull
sys_writevfull
sys_nanosleep_time32full
sys_prctlstub
sys_getcwdfull
sys_mmap_pgofffull
sys_stat64full
sys_fstat64full
sys_lstat64partial
sys_getuidlimited [3]
sys_getgidlimited [3]
sys_geteuidlimited [3]
sys_getegidlimited [3]
sys_setuidlimited [3]
sys_setgidlimited [3]
sys_getdents64full
sys_fcntl64partial
sys_gettidminimal [4]
sys_set_thread_areafull
sys_exit_groupminimal [5]
sys_set_tid_addressstub
sys_tkillpartial++ [6]
sys_tgkillpartial++ [6]
sys_killfull
sys_setsidfull
sys_timesminimal [9]
sys_clock_gettimecompliant [10]
sys_clock_gettime32compliant [10]
sys_clock_getrescompliant [10]
sys_clock_getres_time32compliant [10]
sys_selectfull
sys_pollfull
sys_readlinkfull
sys_creatfull
sys_unlinkfull
sys_symlinkfull
sys_pread64full
sys_pwrite64full
sys_vforkcompliant [11]
sys_umaskfull
sys_ia32_truncate64full
sys_ia32_ftruncate64full
sys_syncfull
sys_syncfsfull
sys_chownlimited [3]
sys_fchownlimited [3]
sys_lchownlimited [3]
sys_chmodfull
sys_fchmodfull
sys_renamefull
sys_linkfull
sys_pipefull
sys_pipe2partial++ [13]
sys_sched_yieldfull
sys_getsidfull
sys_setpgidfull
sys_getpgidfull
sys_getpgrpfull
sys_utime32full
sys_utimesfull
sys_fsynccompliant
sys_fdatasynccompliant
sys_dupfull
sys_dup2full
sys_rebootfull
sys_rt_sigprocmaskfull
sys_rt_sigpendingfull
sys_rt_sigreturnpartial [14]
sys_rt_sigactionpartial [14]
sys_rt_sigsuspendpartial [14]

Definitions:

Support levelMeaning
fullSyscall 100% supported.
partialSyscall partially supported, work-in-progress
partial++All of the really important flags and modes are supported
...Most of the advanced stuff very likely is still not supported.
stubThe syscall does not return -ENOSYS, but it has actually a stub
...implementation, at the moment.
minimalLike partial, just even less features are supported
compliantSyscall supported in a way compliant with a full
...implementation, but actually it has several limitations due to
...the different design of Tilck. Example: see the note [3].
limitedThe syscall supports by design only a subset of the cases
...supported by the Linux implementation.

Notes:

  1. The syscall open() now supports read/write access, file creation, mode setting and flags like O_APPEND, O_CLOEXEC, O_EXCL, O_TRUNC. All the "advanced" flags like O_ASYNC are not supported yet.

  2. Because custom signal handlers are not supported, pause() puts the process to sleep until a signal actually kills it.

  3. Tilck does not support by design multiple users nor any form of authentication. Therefore, the following statement is always true: UID == GID == EUID == EGID == 0. All the calls like setuid(), seteuid(), setgid(), setegid(), chown() etc. succeed only when UID/GID == 0.

  4. Because the lack of thread support, gettid() is the same as getpid()

  5. Because the lack of thread support, exit_group() behaves as exit()

  6. Because the lack of thread support, tgkill() works only when tgid == tid.

  7. [Limitation removed]

  8. [Limitation removed]

  9. At the moment times() just updates tms_utime and tms_stime.

  10. Only the clocks CLOCK_REALTIME and CLOCK_MONOTONIC are supported.

  11. Behaves exactly as fork().

  12. [Limitation removed]

  13. The O_DIRECT mode is not supported.

  14. Tilck has a partial support for POSIX signals. SIG_IGN and SIG_DFL are fully supported. Custom signal handlers are supported as well, but signal handlers (even of different type) cannot interrupt each other. In other words, nested custom signal handlers are not supported, yet. Also, even if the modern sys_rt_sigaction() interface is implemented, none of its flags like SA_NODEFER, SA_ONSTACK, SA_RESETHAND, SA_RESTART, SA_SIGINFO are supported, at the moment. The per-signal sa_mask is also fixed: while a custom handler is running, all the other signals having a custom handler are masked (terminating signals instead, can always we delieved). In addition, the order of delivery of all signals is unspecified and there is no distinction between regular signals and real-time ones. Also, at the moment, no syscall can be restarted if a signal interrupted it. The syscall sys_rt_sigsuspend() works as expected if we're not calling it from a signal handler otherwise, it returns -EPERM (not allowed according to POSIX).

    NOTE: while the just-described limited support for POSIX reliable signals might seem too limited, it's worth noting that it already opened a considerable amount of uses, like graceful process termination with SIGTERM.