summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls
AgeCommit message (Collapse)Author
2022-07-15Kernel: Try to set [cm]time in Inode::did_modify_contentsHendiadyoin1
This indirectly resolves a fixme in sys$msync
2022-07-15Kernel: Handle multiple regions in sys$msyncHendiadyoin1
2022-07-15Kernel+LibC: Add posix_fallocate syscallHendiadyoin1
2022-07-15Kernel: Use find_last_split_view to get the executable name in do_execHendiadyoin1
2022-07-12Everywhere: Use default StringView constructor over nullptrsin-ack
While null StringViews are just as bad, these prevent the removal of StringView(char const*) as that constructor accepts a nullptr. No functional changes.
2022-07-12Everywhere: Add sv suffix to strings relying on StringView(char const*)sin-ack
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
2022-07-10Kernel: Stop leaking first thread on errors in sys$forkIdan Horowitz
Until the thread is first set as Runnable at the end of sys$fork, its state is Invalid, and as a result, the Finalizer which is searching for Dying threads will never find it if the syscall short-circuits due to an error condition like OOM. This also meant the parent Process of the thread would be leaked as well.
2022-07-10Kernel+LibC+LibCore: Pass fcntl extra argument as pointer-sized variablegggggg-gggggg
The extra argument to fcntl is a pointer in the case of F_GETLK/F_SETLK and we were pulling out a u32, leading to pointer truncation on x86_64. Among other things, this fixes Assistant on x86_64 :^)
2022-07-10Kernel: Stop reporting POLLHUP exclusively when available in sys$pollIdan Horowitz
As per Dr. Posix, unlike POLLERR and POLLNVAL, POLLHUP is only mutually exclusive with POLLOUT, all other events may be reported together with it.
2022-07-10Kernel: Report POLLNVAL events in sys$poll instead of returning EBADFIdan Horowitz
As required by Dr. Posix.
2022-07-10Kernel: Stop providing POLLRDHUP events in sys$poll by defaultIdan Horowitz
Dr. Posix specifies that only POLLERR, POLLHUP & POLLNVAL are provided by default.
2022-07-10Kernel: Set POLLHUP on WriteHangUp in sys$poll instead of POLLNVALIdan Horowitz
POLLNVAL signifies an invalid fd, not a write hang up.
2022-07-10Kernel: Accept SHUT_RD and SHUT_WR as shutdown() how valuesIdan Horowitz
The previous check for valid how values assumed this field was a bitmap and that SHUT_RDWR was simply a bitwise or of SHUT_RD and SHUT_WR, which is not the case.
2022-07-08Kernel: Implement `sigsuspend` using a SignalBlockerTim Schumacher
`sigsuspend` was previously implemented using a poll on an empty set of file descriptors. However, this broke quite a few assumptions in `SelectBlocker`, as it verifies at least one file descriptor to be ready after waking up and as it relies on being notified by the file descriptor. A bare-bones `sigsuspend` may also be implemented by relying on any of the `sigwait` functions, but as `sigsuspend` features several (currently unimplemented) restrictions on how returns work, it is a syscall on its own.
2022-07-08Kernel: Unblock SignalBlocker if a signal was just unmarked as pendingTim Schumacher
When updating the signal mask, there is a small frame where we might set up the receiving process for handing the signal and therefore remove that signal from the list of pending signals before SignalBlocker has a chance to block. In turn, this might cause SignalBlocker to never notice that the signal arrives and it will never unblock once blocked. Track the currently handled signal separately and include it when determining if SignalBlocker should be unblocking.
2022-07-08Kernel: Implement an `axallowed` mount optionTim Schumacher
Similar to `W^X` and `wxallowed`, this allows for anonymous executable mappings.
2022-07-05Kernel: Do a POSIX-correct signal handler reset on execTim Schumacher
2022-06-19Kernel: Add sysconf for IOV_MAXAndrew Kaster
2022-06-02Kernel: Implement InterruptDisabler using generic Processor functionsTimon Kruiper
Now that the code does not use architectural specific code, it is moved to the generic Arch directory and the paths are modified accordingly.
2022-05-29Kernel/FileSystem: Simplify even more the mount syscallLiav A
As with the previous commit, we put a distinction between filesystems that require a file description and those which don't, but now in a much more readable mechanism - all initialization properties as well as the create static method are grouped to create the FileSystemInitializer structure. Then when we need to initialize an instance, we iterate over a table of these structures, checking for matching structure and then validating the given arguments from userspace against the requirements to ensure we can create a valid instance of the requested filesystem.
2022-05-29Kernel: Simplify mount syscall flow for regular callsLiav A
We do this by putting a distinction between two types of filesystems - the first type is backed in RAM, and includes TmpFS, ProcFS, SysFS, DevPtsFS and DevTmpFS. Because these filesystems are backed in RAM, trying to mount them doesn't require source open file description. The second type is filesystems that are backed by a file, therefore the userspace program has to open them (hence it has a open file description on them) and provide the appropriate source open file description. By putting this distinction, we can early check if the user tried to mount the second type of filesystems without a valid file description, and fail with EBADF then. Otherwise, we can proceed to either mount either type of filesystem, provided that the fs_type is valid.
2022-05-23Kernel: Fix EINVAL when mmaping with address and no MAP_FIXEDPeter Elliott
The current behavior accidently trys to allocate 0 bytes when a non-null address is provided and MAP_FIXED is specified. This is clearly a bug.
2022-05-21Kernel+LibC: Implement futimens(3)Ariel Don
Implement futimes() in terms of utimensat(). Now, utimensat() strays from POSIX compliance because it also accepts a combination of a file descriptor of a regular file and an empty path. utimensat() then uses this file descriptor instead of the path to update the last access and/or modification time of a file. That being said, its prior behavior remains intact. With the new behavior of utimensat(), `path` must point to a valid string; given a null pointer instead of an empty string, utimensat() sets `errno` to `EFAULT` and returns a failure.
2022-05-21Kernel+LibC+VFS: Implement utimensat(3)Ariel Don
Create POSIX utimensat() library call and corresponding system call to update file access and modification times.
2022-05-05Kernel: Properly define `IOV_MAX`Tim Schumacher
2022-05-03Kernel: Move Kernel/Arch/x86/SafeMem.h to Kernel/Arch/SafeMem.hTimon Kruiper
The file does not contain any specific architectural code, thus it can be moved to the Kernel/Arch directory.
2022-05-02Kernel: Don't check pledges or veil against code coverage data filesAndrew Kaster
Coverage tools like LLVM's source-based coverage or GNU's --coverage need to be able to write out coverage files from any binary, regardless of its security posture. Not ignoring these pledges and veils means we can't get our coverage data out without playing some serious tricks. However this is pretty terrible for normal exeuction, so only skip these checks when we explicitly configured userspace for coverage.
2022-04-26Kernel: Add FIOCLEX and FIONCLEX ioctlsAndreas Kling
These allow you to turn the close-on-exec flag on/off via ioctl().
2022-04-23Kernel+LibC+LibCore: Implement the unlinkat(2) syscallsin-ack
2022-04-12Kernel: Skip setting region name if none is given to mmapTim Schumacher
This keeps us from accidentally overwriting an already set region name, for example when we are mapping a file (as, in this case, the file name is already stored in the region).
2022-04-09Kernel: Remove big lock from sys$mkdirIdan Horowitz
This syscall doesn't access any unprotected shared data.
2022-04-09Kernel: Remove big lock from sys$renameIdan Horowitz
This syscall doesn't access any unprotected shared data.
2022-04-09Kernel: Remove big lock from sys$rmdirIdan Horowitz
This syscall doesn't access any unprotected shared data.
2022-04-09Kernel: Remove big lock from sys$statvfsIdan Horowitz
This syscall doesn't access any unprotected shared data.
2022-04-09Kernel: Remove big lock from sys$symlinkIdan Horowitz
This syscall doesn't access any unprotected shared data.
2022-04-09Kernel: Remove big lock from sys$linkIdan Horowitz
This syscall doesn't access any unprotected shared data.
2022-04-09Kernel: Remove big lock from sys$unlinkIdan Horowitz
This syscall doesn't access any unprotected shared data.
2022-04-09Kernel: Remove big lock from sys$setsockoptIdan Horowitz
This syscall doesn't access any unprotected shared data.
2022-04-09Kernel: Remove big lock from sys$getsockoptIdan Horowitz
This syscall doesn't access any unprotected shared data.
2022-04-09Kernel: Remove big lock from sys$shutdownIdan Horowitz
This syscall doesn't access any unprotected shared data.
2022-04-09Kernel: Remove big lock from sys$connectIdan Horowitz
This syscall doesn't access any unprotected shared data.
2022-04-09Kernel: Remove big lock from sys$closeIdan Horowitz
This syscall doesn't access any unprotected shared data.
2022-04-09Kernel: Remove big lock from sys$chownIdan Horowitz
This syscall doesn't access any unprotected shared data.
2022-04-09Kernel: Remove big lock from sys$fchownIdan Horowitz
This syscall doesn't access any unprotected shared data.
2022-04-09Kernel: Remove big lock from sys$bindIdan Horowitz
This syscall doesn't access any unprotected shared data.
2022-04-09Kernel: Remove big lock from `sys$set_coredump_metadata`Luke Wilde
The only requirement for this syscall is to make Process::m_coredump_properties SpinlockProtected.
2022-04-09Kernel: Remove big lock from `sys$accept4`Jelle Raaijmakers
The only thing we needed to check is whether `socket.accept()` returns a socket, and if not, we go back to blocking again.
2022-04-05Kernel: Make sys$mmap() round requested VM size to page size multipleAndreas Kling
This fixes an issue where File::mmap() overrides would fail because they were expecting to be called with a size evenly divisible by PAGE_SIZE.
2022-04-05Kernel: Remove unused ShouldDeallocateVirtualRange parametersAndreas Kling
Since there is no separate virtual range allocator anymore, this is no longer used for anything.
2022-04-04Kernel: Tweak broken dbgln_if() in sys$fork() after RegionTree changesAndreas Kling