summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls
AgeCommit message (Collapse)Author
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
2022-04-04Kernel: Mark sys$adjtime() as not needing the big lockAndreas Kling
This syscall works on global kernel state and so doesn't need protection from threads in the same process.
2022-04-04Kernel: Mark sys$clock_settime() as not needing the big logAndreas Kling
This syscall ends up disabling interrupts while changing the time, and the clock is a global resource anyway, so preventing threads in the same process from running wouldn't solve anything.
2022-04-04Kernel: Mark sys$sched_{set,get}param() as not needing the big lockAndreas Kling
Both of these syscalls take the scheduler lock while accessing the thread priority, so there's no reliance on the process big lock.
2022-04-04Kernel: Randomize non-specific VM allocations done by sys$execve()Andreas Kling
Stuff like TLS regions, main thread stacks, etc. All deserve to be randomized unless the ELF requires specific placement. :^)
2022-04-03Kernel: Mark sys$listen() as not needing the big lockAndreas Kling
This syscall already performs the necessary locking and so doesn't need to rely on the process big lock.
2022-04-03Kernel: Don't hog file descriptor table lock in sys$bind()Andreas Kling
We don't need to hold the lock across the entire syscall. Once we've fetched the open file description we're interested in, we can let go.
2022-04-03Kernel: Don't hog file descriptor table lock in sys$listen()Andreas Kling
We don't need to hold the lock across the entire syscall. Once we've fetched the open file description we're interested in, we can let go.
2022-04-03Kernel: Mark sys$sendfd() and sys$recvfd() as not needing the big lockAndreas Kling
These syscalls already perform the necessary locking and don't rely on the process big lock.
2022-04-03Kernel: Unbreak ASLR in the new RegionTree worldAndreas Kling
Functions that allocate and/or place a Region now take a parameter that tells it whether to randomize unspecified addresses.
2022-04-03Kernel: Make VM allocation atomic for userspace regionsAndreas Kling
This patch move AddressSpace (the per-process memory manager) to using the new atomic "place" APIs in RegionTree as well, just like we did for MemoryManager in the previous commit. This required updating quite a few places where VM allocation and actually committing a Region object to the AddressSpace were separated by other code. All you have to do now is call into AddressSpace once and it'll take care of everything for you.
2022-04-03Kernel: Add Memory::RegionTree to share code between AddressSpace and MMAndreas Kling
RegionTree holds an IntrusiveRedBlackTree of Region objects and vends a set of APIs for allocating memory ranges. It's used by AddressSpace at the moment, and will be used by MM soon.
2022-04-03Kernel: Use AddressSpace region tree for range allocationAndreas Kling
This patch stops using VirtualRangeAllocator in AddressSpace and instead looks for holes in the region tree when allocating VM space. There are many benefits: - VirtualRangeAllocator is non-intrusive and would call kmalloc/kfree when used. This new solution is allocation-free. This was a source of unpleasant MM/kmalloc deadlocks. - We consolidate authority on what the address space looks like in a single place. Previously, we had both the range allocator *and* the region tree both being used to determine if an address was valid. Now there is only the region tree. - Deallocation of VM when splitting regions is no longer complicated, as we don't need to keep two separate trees in sync.
2022-04-03Kernel: Store AddressSpace memory regions in an IntrusiveRedBlackTreeAndreas Kling
This means we never need to allocate when inserting/removing regions from the address space.
2022-04-03Kernel: Implement `f_basetype` in statvfsTim Schumacher
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2022-03-29Kernel: Disallow elevating pledge promises with no_error setAli Mohammad Pur
8233da33985bf834685bc215a8a9ed261e674f5f introduced a not-so-subtle bug where an application with an existing pledge set containing `no_error` could elevate its pledge set by pledging _anything_, this commit makes sure that no new promise is accepted.
2022-03-26Kernel: Add a 'no_error' pledge promiseAli Mohammad Pur
This makes pledge() ignore promises that would otherwise cause it to fail with EPERM, which is very useful for allowing programs to run under a "jail" so to speak, without having them termiate early due to a failing pledge() call.