summaryrefslogtreecommitdiff
path: root/Kernel/API
AgeCommit message (Collapse)Author
2023-05-27Kernel: Mark sys$get_dir_entries as not needing the big lockLiav A
After examination of all overriden Inode::traverse_as_directory methods it seems like proper locking is already existing everywhere, so there's no need to take the big process lock anymore, as there's no access to shared process structures anyway.
2023-05-27Kernel: Mark sys$fork as not needing the big lockLiav A
All shared structures are already protected by "atomic" spinlocks for those structures, so there's no need to take the big process lock.
2023-05-27Kernel: Mark sys$umount as not needing the big lockLiav A
All accesses to the mount table are already serialized by the actual spinlock of that table.
2023-05-17Kernel+Userland: Split bind-mounting and re-mounting from mount syscallLiav A
These 2 are an actual separate types of syscalls, so let's stop using special flags for bind mounting or re-mounting and instead let userspace calling directly for this kind of actions.
2023-05-17Kernel: Alias `_SC_PAGE_SIZE` to `_SC_PAGESIZE`Tim Schumacher
Both of those are specified by POSIX.
2023-04-24Kernel: Allow configuring a Jail to not impose PID isolation restrictionLiav A
This is quite useful for userspace applications that can't cope with the restriction, but it's still useful to impose other non-configurable restrictions by using jails.
2023-04-23Kernel+LibC: Implement `pthread_create` for AArch64Daniel Bertalan
Instead of storing x86_64 register names in `SC_create_thread_params`, let the Kernel figure out how to pass the parameters to `pthread_create_helper`.
2023-04-14Kernel/Net: Implement SIOCGIFINDEX and SIOCGIFNAME for socketsArda Cinar
These ioctls exist on Linux and can be used to implement libc functions if_indextoname and if_nametoindex (without needing to parse any JSON).
2023-04-10Kernel: Add the futimens syscallLiav A
We have a problem with the original utimensat syscall because when we do call LibC futimens function, internally we provide an empty path, and the Kernel get_syscall_path_argument method will detect this as an invalid path. This happens to spit an error for example in the touch utility, so if a user is running "touch non_existing_file", it will create that file, but the user will still see an error coming from LibC futimens function. This new syscall gets an open file description and it provides the same functionality as utimensat, on the specified open file description. The new syscall will be used later by LibC to properly implement LibC futimens function so the situation described with relation to the "touch" utility could be fixed.
2023-04-09Kernel/HID: Untie the PS2 protocol, i8042 hardware and generic devicesLiav A
For a very long time, the kernel had only support for basic PS/2 devices such as the PS2 AT keyboard and regular PS2 mouse (with a scroll wheel). To adapt to this, we had very simple abstractions in place, essentially, the PS2 devices were registered as IRQ handlers (IRQ 1 and 12), and when an interrupt was triggered, we simply had to tell the I8042Controller to fetch a byte for us, then send it back to the appropriate device for further processing and queueing of either a key event, or a mouse packet so userspace can do something meaningful about it. When we added the VMWare mouse integration feature it was easily adapted to this paradigm, requiring small changes across the handling code for these devices. This patch is a major cleanup for any future advancements in the HID subsystem. It ensures we do things in a much more sane manner: - We stop using LockRefPtrs. Currently, after the initialization of the i8042 controller, we never have to change RefPtrs in that class, as we simply don't support PS2 hotplugging currently. Also, we remove the unnecessary getters for keyboard and mouse devices which also returned a LockRefPtr. - There's a clear separation between PS2 devices and the actual device nodes that normally exist in /dev. PS2 devices are not polled, because when the user uses these devices, they will trigger an IRQ which when is handled, could produce either a MousePacket or KeyEvent, depending on the device state. The separation is crucial for buses that are polled, for example - USB is a polled bus and will not generate an IRQ for HID devices. - There's a clear separation in roles of each structure. The PS2 devices which are attached to a I8042Controller object are managing the device state, while the generic MouseDevice and KeyboardDevice manage all related tasks of a CharacterDevice, as well as interpreting scan code events and mouse relative/absolute coordinates.
2023-04-06Kernel: Mark sys$msync as not needing the big lockIdan Horowitz
All accesses to shared mutable data are already serialized behind the process address space spinlock.
2023-04-06Kernel: Mark sys$mremap as not needing the big lockIdan Horowitz
All accesses to shared mutable data are already serialized behind the process address space spinlock.
2023-04-06Kernel: Mark sys$munmap as not needing the big lockIdan Horowitz
All accesses to shared mutable data are already serialized behind the process address space spinlock.
2023-04-06Kernel: Mark sys$set_mmap_name as not needing the big lockIdan Horowitz
All accesses to shared mutable data are already serialized behind the process address space spinlock.
2023-04-06Kernel: Mark sys$mprotect as not needing the big lockIdan Horowitz
All accesses to shared mutable data are already serialized behind the process address space spinlock.
2023-04-06Kernel: Mark sys$mmap as not needing the big lockIdan Horowitz
All accesses to shared mutable data are already serialized behind the process address space spinlock.
2023-04-06Kernel: Mark sys$map_time_page as not needing the big lockIdan Horowitz
All accesses to shared mutable data are already serialized behind the process address space spinlock.
2023-04-06Kernel: Mark sys$madvise as not needing the big lockIdan Horowitz
All accesses to shared mutable data are already serialized behind the process address space spinlock.
2023-04-05Kernel: Mark sys$setpgid as not needing the big lockAndreas Kling
This function is already serialized by access to process protected data.
2023-04-05Kernel: Mark sys$setsid as not needing the big lockAndreas Kling
This function is now serialized by access to the process group list, and to the current process's protected data.
2023-04-05Kernel: Mark sys$faccessat as not needing the big lockAndreas Kling
2023-04-04Kernel: Mark inode watcher syscalls as not needing the big lockAndreas Kling
These syscalls are already protected by existing locking mechanisms, including the mutex inside InodeWatcher.
2023-04-04Kernel: Mark sys$killpg as not needing the big lockAndreas Kling
Same as sys$kill, nothing here that isn't already protected by existing locks.
2023-04-04Kernel: Mark sys$kill as not needing the big lockAndreas Kling
This syscall sends a signal to other threads or itself. This mechanism is already guarded by locking mechanisms, and widely used within the kernel without help from the big lock.
2023-04-04Kernel: Mark sys$getrusage as not needing the big lockAndreas Kling
Same deal as sys$times, nothing here that needs locking at the moment.
2023-04-04Kernel: Make sys$times not use the big lockAndreas Kling
...and also make the Process tick counters clock_t instead of u32. It seems harmless to get interrupted in the middle of reading these counters and reporting slightly fewer ticks in some category.
2023-04-04Kernel+Userland: Make some of the POSIX types largerAndreas Kling
Expand the following types from 32-bit to 64-bit: - blkcnt_t - blksize_t - dev_t - nlink_t - suseconds_t - clock_t This matches their size on other 64-bit systems.
2023-04-04Kernel: Mark sys$umask as not needing the big lockAndreas Kling
The body of this syscall is already serialized by calling with_mutable_protected_data().
2023-04-04Kernel: Mark sys$sigtimedwait as not needing the big lockAndreas Kling
Yet another syscall that only messes with the current thread.
2023-04-04Kernel: Mark sys$sigpending as not needing the big lockAndreas Kling
Another one that only touches the current thread.
2023-04-04Kernel: Mark sys$sigprocmask as not needing the big lockAndreas Kling
Another one that only messes with the current thread.
2023-04-04Kernel: Mark sys$sigsuspend as not needing the big lockAndreas Kling
This syscall is only concerned with the current thread.
2023-04-04Kernel: Mark sys$sigreturn as not needing the big lockAndreas Kling
This syscall is only concerned with the current thread (except in the case of a pledge violation, when it will add some details about that to the process coredump metadata. That stuff is already serialized.)
2023-04-04Kernel: Mark sys$open as not needing the big lockAndreas Kling
All the individual sub-operations of this syscall are protected by their own locking mechanisms, so it should be okay to get it off the big lock.
2023-04-04Kernel: Make sys$getsid not require the big lockAndreas Kling
Reorganize the code slightly to avoid creating a TOCTOU bug, then mark the syscall as not needing the big lock anymore.
2023-04-04Kernel: Mark sys$getpgrp as not needing the big lockAndreas Kling
Access to the process's process group is already serialized by SpinlockProtected.
2023-04-04Kernel: Mark sys$getpgid as not needing the big lockAndreas Kling
Access to the process's process group is already serialized by SpinlockProtected.
2023-04-04Kernel: Mark sys$fcntl as not needing the big lockAndreas Kling
This syscall operates on the file descriptor table, and on individual open file descriptions. Both of those are already protected by scoped locking mechanisms.
2023-04-04Kernel: Make sys$disown not require the big lockAndreas Kling
This syscall had a TOCTOU where it checked the peer's PPID before locking the protected data (where the PPID is stored). After closing the race window, we can mark the syscall as not needing the big lock.
2023-04-04Kernel: Mark sys$alarm as not needing the big lockAndreas Kling
Access to Process::m_alarm_timer is serialized via SpinlockProtected, so there's no longer need for this syscall to use the big lock.
2023-03-15Kernel: Merge {get,set}_process_name syscalls to the prctl syscallLiav A
It makes much more sense to have these actions being performed via the prctl syscall, as they both require 2 plain arguments to be passed to the syscall layer, and in contrast to most syscalls, we don't get in these removed syscalls an automatic representation of Userspace<T>, but two FlatPtr(s) to perform casting on them in the prctl syscall which is suited to what has been done in the removed syscalls. Also, it makes sense to have these actions in the prctl syscall, because they are strongly related to the process control concept of the prctl syscall.
2023-03-13Kernel: Don't include Kernel/Arch/RegisterState from userspaceAndrew Kaster
Any userspace cpp file that included <syscall.h> would end up with a large glob of Kernel headers included, all the way down to Kernel/Arch/x86_64/CPU.h and friends. Only the kernel needs RegisterState, so hide it from userspace.
2023-03-11Kernel: Add non standard value to sys$sysconfFabian Dellwing
Add `_SC_PHYS_PAGES` to sys$sysconf syscall. This value is needed for a port I'm working on.
2023-03-05Kernel: Move process coredump metadata modification to the prctl syscallLiav A
2023-03-01Kernel: Move TYPEDEF_* TTY macros to API/ttydefaults.h fileLiav A
This allows us to get rid of an include to LibC/sys/ttydefaults.h in the Kernel TTY implementation. Also, move ttydefchars static const struct to another file called Kernel/API/ttydefaultschars.h, so it could be used too in the Kernel TTY implementation without the need to include anything from LibC.
2023-03-01Kernel+LibC: Move the FD_SETSIZE declaration to API/POSIX/select.h fileLiav A
2023-02-25Kernel: Mark sys$prctl() as not needing the big lockLiav A
This syscall has sufficient locking and therefore it doesn't need the big lock being taken.
2023-02-24Kernel+Userland: Refine preventing syscall annotations of Regions optionLiav A
Instead of using a special case of the annotate_mapping syscall, let's introduce a new prctl option to disallow further annotations of Regions as new syscall Region(s).
2023-02-24Kernel+Userland: Unify declarations for KCOV in Kernel/API/kcov.hLiav A
2023-02-24Kernel+Userland: Move prctl numbers header file to Kernel/API directoryLiav A