summaryrefslogtreecommitdiff
path: root/Kernel
AgeCommit message (Collapse)Author
2023-06-04Kernel: Rename Syscall.cpp => Syscalls/SyscallHandler.cppLiav A
2023-06-04Kernel: Move InterruptDisabler to the Interrupts subdirectoryLiav A
2023-06-04Kernel: Move Performance-measurement code to the Tasks subdirectoryLiav A
2023-06-04Kernel: Move TimerQueue code to the Time subdirectoryLiav A
2023-06-04Kernel: Move all boot-related code to the new Boot subdirectoryLiav A
2023-06-04Kernel: Move ExecutionMode.h to the Security subdirectoryLiav A
2023-06-04Everywhere: Move global Kernel pattern code to Kernel/Library directoryLiav A
This has KString, KBuffer, DoubleBuffer, KBufferBuilder, IOWindow, UserOrKernelBuffer and ScopedCritical classes being moved to the Kernel/Library subdirectory. Also, move the panic and assertions handling code to that directory.
2023-06-04Kernel: Move task-crash related code to the Tasks subdirectoryLiav A
2023-06-04Kernel: Move Credentials.{cpp,h} to the Security subdirectoryLiav A
2023-06-04Kernel: Move {Virtual,Physical}Address classes to the Memory directoryLiav A
2023-06-04Kernel: Move UBSanitizer and AddressSanitizer to Security subdirectoryLiav A
2023-06-04Kernel: Move Random.{h,cpp} code to Security subdirectoryLiav A
2023-06-04Kernel: Move all tasks-related code to the Tasks subdirectoryLiav A
2023-06-04Kernel: Move Jail code to a new subdirectoryLiav A
2023-06-02Kernel+Userland: Ensure proper unveil permissions before using rm/rmdirLiav A
When deleting a directory, the rmdir syscall should fail if the path was unveiled without the 'c' permission. This matches the same behavior that OpenBSD enforces when doing this kind of operation. When deleting a file, the unlink syscall should fail if the path was unveiled without the 'w' permission, to ensure that userspace is aware of the possibility of removing a file only when the path was unveiled as writable. When using the userdel utility, we now unveil that directory path with the unveil 'c' permission so removal of an account home directory is done properly.
2023-06-02Kernel: Move the Storage directory to be a new directory under DevicesLiav A
The Storage subsystem, like the Audio and HID subsystems, exposes Unix device files (for example, in the /dev directory). To ensure consistency across the repository, we should make the Storage subsystem to reside in the Kernel/Devices directory like the two other mentioned subsystems.
2023-06-02Kernel: Remove unused Platform.h include in linker scriptkleines Filmröllchen
This had only been in use for architecture detection before the removal of 32 bit x86.
2023-05-31Kernel/aarch64: Make sure stack pointer is always 16 byte alignedTimon Kruiper
This is enforced by the hardware and an exception is generated when the stack pointer is not properly aligned. This brings us closer to booting the aarch64 Kernel on baremetal.
2023-05-28Kernel/aarch64: Add RPi/MMIO.cpp to `SOURCES_RUNNING_WITHOUT_MMU`Daniel Bertalan
Otherwise, `MMIO::MMIO` will fault on the RPi 3 due to accessing `__stack_chk_guard` before the kernel is mapped into high memory.
2023-05-28Kernel/aarch64: Make `Processor::capture_stack_trace` stub non-crashingDaniel Bertalan
This is the only kernel issue blocking us from running the test suite. Having userspace backtraces printed to the debug console during crashes isn't vital to the system's function, so let's just return an empty trace and print a FIXME instead of crashing.
2023-05-27AK+Everywhere: Don't crash on invalid monthsBen Wiederhake
Sadly, we don't have proper error propagation here. However, crashing the Kernel just because a CDROM contains an invalid month seems like a bad idea.
2023-05-27AK: Test from_unix_time_parts intensivelyBen Wiederhake
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: Make Ext2FSInode::traverse_as_directory to take m_inode_lockLiav A
The contents of the directory inode could change if we are not taking so we must take the m_inode_lock to prevent corruption when reading the directory contents.
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-27Kernel: Don't lock ProcFS mutex when calling traverse_as_directoryLiav A
This is not needed, because when we are doing this traversing, functions that are called from this function are using proper and more "atomic" locking.
2023-05-27Kernel: Don't lock SysFS filesystem mutex calling traverse_as_directoryLiav A
This locking is simply not needed because the associated SysFS component will use proper and more "atomic" locking on its own.
2023-05-26Kernel/aarch64: Use the correct MMIO base address in the MMUCaoimhe
2023-05-25Kernel/aarch64: Fix build after #17842Daniel Bertalan
2023-05-24Everywhere: Use MonotonicTime instead of Durationkleines Filmröllchen
This is easily identifiable by anyone who uses Duration::now_monotonic, and any downstream users of that data.
2023-05-24Kernel: Use UnixDateTime wherever applicablekleines Filmröllchen
"Wherever applicable" = most places, actually :^), especially for networking and filesystem timestamps. This includes changes to unzip, which uses DOSPackedTime, since that is changed for the FAT file systems.
2023-05-24AK: Rename Time to Durationkleines Filmröllchen
That's what this class really is; in fact that's what the first line of the comment says it is. This commit does not rename the main files, since those will contain other time-related classes in a little bit.
2023-05-21Kernel: Move NVMeInterruptQueue initialization out of its constructorPankaj Raghav
Add a helper initialize_interrupt_queue() helper to enable_irq instead of doing it as part of its object construction as it can fail. This is similar to how AHCI initializes its interrupt as well.
2023-05-21Kernel/NVMe: Add try_create() to NVMe{Poll|Interrupt}QueuePankaj Raghav
NVMe{Poll|Interrupt}Queue don't have a try_create() method. Add one to keep it consistent with how we create objects. Also this commit is in preparation to moving any initialization related code out of the constructor.
2023-05-21Kernel: Convert rw_dma_page to NonnullRefPtr in NVMeQueuePankaj Raghav
Propagate error if the rw_dma_page is NULL in try_create and use relase_nonnull to convert RefPtr to NonnullRefPtr before passing it to the NVMeQueue.
2023-05-21Kernel: Remove the unused {cq|sq}_dma_page from NVMeQueuePankaj Raghav
{cq|sq}_dma_page are not used by the NVMeQueue class. Remove them.
2023-05-21Kernel: Move handle_interrupt out-of-line in PCIIRQHandlerPankaj Raghav
Upgrade to GCC 13.1.0 triggered an UBSAN in PCIIRQHandler. Moving the handle_interrupt() function out-of-line fixes this issue.
2023-05-21Kernel/aarch64: Detect if access faults come from SafeMemDaniel Bertalan
This commit lets us differentiate whether access faults are caused by accessing junk memory addresses given to us by userspace or if we hit a kernel bug. The stub implementations of the `safe_*` functions currently don't let us jump back into them and return a value indicating failure, so we panic if such a fault happens. Practically, this means that we still crash, but if the access violation was caused by something else, we take the usual kernel crash code path and print a register and memory dump, rather than hitting the `TODO_AARCH64` in `handle_safe_access_fault`.
2023-05-21Kernel/aarch64: Flatten `safe_{memset,strnlen,memcpy}()`Daniel Bertalan
We want to detect if an access fault comes from within these operations, so they cannot be calling out to the non-safe variants.
2023-05-21Kernel/aarch64: Stub out atomic SafeMem functionsDaniel Bertalan
These are used in futexes, which are needed if we want to get further in `run-tests`. For now, we have no way to return a non-fatal error if an access fault is raised while executing these, so the kernel will panic. Some would consider this a DoS vulnerability where a malicious userspace app can crash the kernel by passing bogus pointers to it, but I prefer to call it progress :^)
2023-05-19Kernel: Enable data and instruction cache on aarch64Andrew Kaster
Enabling these will fix the Unsupported Exclusive or Atomic access data fault we get on bare metal Raspberry Pi 3. On A53/A57 chips (and newer), atomic compare-exchange operations require the data cache to be enabled.
2023-05-19Kernel: Update reset value and register names of SCTLR_EL1 per Arm ARMAndrew Kaster
Referencing ARM DDI 0487J.a, update the names of previously reserved fields, and set the reset_value() of the SCTLR_EL1 struct to reflect the defaults we want for this register on reboot.
2023-05-19Kernel: Check only for the first equal sign in the kernel command lineHediadyoin1
... key-value decomposition The RaspberryPi firmware will give us a value for the 'video' key that contains multiple equal signs: ``` video=HDMI-A-1:1920x1080M@30D,margin_left=48,margin_right=48,[...] ``` Instead of asserting that this only has one equal sign, let's just split it by the first one.
2023-05-19Kernel/ScatterGatherList: Add region_name as a part of try_create APIPankaj Raghav
Remove the hardcoded "AHCI Scattered DMA" for region name as it is a part of a common API. Add region_name parameter to the try_create API so that this API can be used by other drivers with the correct Memory region name.
2023-05-19Kernel/ScatterGatherList: Move constructor init code to try_createPankaj Raghav
The constructor code of ScatterGatherList had code that can return error. Move it to try_create for better error propagation. This removes one TODO() and one release_value_but_fixme_should_propagate_errors().
2023-05-19Kernel/ScatterGatherList: Return ErrorOr from try_createPankaj Raghav
This removes the TODO from the try_create API to return ErrorOr. This is also a preparation patch to move the init code in the constructor that can fail to this try_create function.
2023-05-19Kernel: Move a bunch of generic devices code into new subdirectoryLiav A
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: Fix memory mapping size of the BootFramebufferConsoleDaniel Bertalan
The Multiboot header stores the framebuffer's pitch in bytes, so multiplying it by the pixel's size is not necessary. We ended up allocating 4 times as much memory as needed, which caused us to overlap the MMIO reserved memory area on the Raspberry Pi.