summaryrefslogtreecommitdiff
path: root/Kernel
AgeCommit message (Collapse)Author
2021-01-15Kernel: Make Process::allocate_region*() return KResultOr<Region*>Andreas Kling
This allows region allocation to return specific errors and we don't have to assume every failure is an ENOMEM.
2021-01-15Kernel: Make sys$anon_create() require the "stdio" promise if pledgedAndreas Kling
2021-01-15Kernel: Fix bogus negation of alloc_fd() error in sys$anon_create()Andreas Kling
Thanks to Idan for spotting this!
2021-01-15Kernel: Add anonymous files, created with sys$anon_create()Andreas Kling
This patch adds a new AnonymousFile class which is a File backed by an AnonymousVMObject that can only be mmap'ed and nothing else, really. I'm hoping that this can become a replacement for shbufs. :^)
2021-01-15Kernel: Make Locker remember whether the lock is heldTom
This allows temporarily unlocking a lock or re-locking it, and it will only unlock if it is still being held. Fixes #4352
2021-01-14ProcFS: Ignore directories in refresh_data().Mart G
2021-01-12Kernel: Use current process EUID in doing profiling access controlAndreas Kling
2021-01-12Libraries: Move to Userland/Libraries/Andreas Kling
2021-01-12AK: Simplify constructors and conversions from nullptr_tLenny Maiorani
Problem: - Many constructors are defined as `{}` rather than using the ` = default` compiler-provided constructor. - Some types provide an implicit conversion operator from `nullptr_t` instead of requiring the caller to default construct. This violates the C++ Core Guidelines suggestion to declare single-argument constructors explicit (https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c46-by-default-declare-single-argument-constructors-explicit). Solution: - Change default constructors to use the compiler-provided default constructor. - Remove implicit conversion operators from `nullptr_t` and change usage to enforce type consistency without conversion.
2021-01-11Kernel: Remove /proc/mountsAndreas Kling
Everyone was already using /proc/df which has all the info anyway.
2021-01-11Kernel: Remove /proc/inodesAndreas Kling
There was nothing interesting in this file.
2021-01-11Kernel: Only send SIGTTOU if TTY termios has TOSTOP flagAndreas Kling
Fixes #4909
2021-01-11Kernel: Add dedicated "ptrace" pledge promiseAndreas Kling
The vast majority of programs don't ever need to use sys$ptrace(), and it seems like a high-value system call to prevent a compromised process from using. This patch moves sys$ptrace() from the "proc" promise to its own, new "ptrace" promise and updates the affected apps.
2021-01-11Kernel: Remove MM_DEBUG debug spam codeAndreas Kling
This was too spammy to ever actually be used anyway.
2021-01-11Kernel: Convert a bunch of String::format() => String::formatted()Andreas Kling
2021-01-11Everywhere: Fix incorrect uses of String::format and StringBuilder::appendfSahan Fernando
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.
2021-01-11Everywhere: Fix incorrect uses of String::format and StringBuilder::appendfSahan Fernando
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.
2021-01-11SinglyLinkedList: Implement `find` in terms of `AK::find`Lenny Maiorani
Problem: - The implementation of `find` is coupled to the implementation of `SinglyLinkedList`. Solution: - Decouple the implementation of `find` from the class by using a generic `find` algorithm.
2021-01-11DoublyLinkedList: Implement `find` in terms of `AK::find`Lenny Maiorani
Problem: - The implementation of `find` is coupled to the implementation of `DoublyLinkedList`. - `append` and `prepend` are implemented multiple times so that r-value references can be moved from into the new node. This is probably not called very often because a pr-value or x-value needs to be used here. Solution: - Decouple the implementation of `find` from the class by using a generic `find` algorithm. - Make `append` and `prepend` be function templates so that they can have binding references which can be forwarded.
2021-01-11Kernel: Don't dump perfcore for non-dumpable processesAndreas Kling
Fixes #4904
2021-01-11Everywhere: Replace a bundle of dbg with dbgln.asynts
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.Everything:
2021-01-11Everywhere: Replace a bundle of dbg with dbgln.asynts
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.Everything:
2021-01-11Everywhere: Replace a bundle of dbg with dbgln.asynts
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.Everything:
2021-01-11Everywhere: Replace a bundle of dbg with dbgln.asynts
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.Everything:
2021-01-11Everywhere: Replace a bundle of dbg with dbgln.asynts
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.Everything:
2021-01-11Kernel: Fix perfcore filename generation build errorAndreas Kling
2021-01-11Kernel+Profiler: Make profiling per-process and without core dumpsAndreas Kling
This patch merges the profiling functionality in the kernel with the performance events mechanism. A profiler sample is now just another perf event, rather than a dedicated thing. Since perf events were already per-process, this now makes profiling per-process as well. Processes with perf events would already write out a perfcore.PID file to the current directory on death, but since we may want to profile a process and then let it continue running, recorded perf events can now be accessed at any time via /proc/PID/perf_events. This patch also adds information about process memory regions to the perfcore JSON format. This removes the need to supply a core dump to the Profiler app for symbolication, and so the "profiler coredump" mechanism is removed entirely. There's still a hard limit of 4MB worth of perf events per process, so this is by no means a perfect final design, but it's a nice step forward for both simplicity and stability. Fixes #4848 Fixes #4849
2021-01-10Kernel: Avoid collision between dynamic loader and main programItamar
When loading non position-independent programs, we now take care not to load the dynamic loader at an address that collides with the location the main program wants to load at. Fixes #4847.
2021-01-10Kernel: Plumb the elf header of the main program down to Process::loadItamar
This will enable us to take the desired load address of non-position independent programs into account when randomizing the load address of the dynamic loader.
2021-01-10Kernel: Defer handling of key press events in VirtualConsoleAndrew Kaster
Trying to pass these onto the Terminal while handling an IRQ is a recipe for disaster. Use Processor::deferred_call_queue to create an ad-hoc "second half" of the interrupt handler. Fixes #4889
2021-01-10LibVT: Respect the Negative attribute when drawing textAnotherTest
This makes the "reverse video" SGR actually work.
2021-01-10Kernel+SystemServer+CrashDaemon: Better control where we put core dumpsAndreas Kling
SystemServer now creates the /tmp/coredump and /tmp/profiler_coredumps directories at startup, ensuring that they are owned by root, and with basic 0755 permissions. The kernel will also now refuse to put core dumps in a directory that doesn't fulfill the following criteria: - Owned by 0:0 - Directory with sticky bit not set - 0755 permissions Fixes #4435 Fixes #4850
2021-01-10Kernel: Don't allow non-root, non-owners to rmdir any child of stickyAndreas Kling
We were not handling sticky parents properly in sys$rmdir(). Child directories of a sticky parent should not be rmdir'able by just anyone. Only the owner and root. Fixes #4875.
2021-01-09Ext2FS: Zero out new space when growing an inodeAndreas Kling
Before this change, truncating an Ext2FS inode to a larger size than it was before would give you uninitialized on-disk data. Fix this by zeroing out all the new space when doing an inode resize. This is pretty naively implemented via Inode::write_bytes() and there's lots of room for cleverness here in the future.
2021-01-09Ext2FS: Convert dbg() to dbgln()Andreas Kling
Also remove some dbg()'s that were printing incorrect information.
2021-01-09Everywhere: Replace a bundle of dbg with dbgln.asynts
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.Everything: The modifications in this commit were automatically made using the following command: find . -name '*.cpp' -exec sed -i -E 's/dbg\(\) << ("[^"{]*");/dbgln\(\1\);/' {} \;
2021-01-09Everywhere: Replace a bundle of dbg with dbgln.asynts
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.
2021-01-09Everywhere: Replace a bundle of dbg with dbgln.asynts
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.
2021-01-09AK: Add Formatter<FormatString> as helper class.asynts
2021-01-09Kernel: Defer switching the paging scope in ptrace(PT_POKE) a littleAndreas Kling
If we can fail with EFAULT early, might as well avoid switching the paging scope.
2021-01-09Kernel: Don't put gratuitous cursing in kernel logAndreas Kling
2021-01-09Kernel/USB: Implement test transferJesse Buhagiar
We can now test a _very_ basic transaction via `do_debug_transfer()`. This function merely attaches some TDs to the LSCTRL queue head and points some input and output buffers. We then sense an interrupt with USBSTS value of 1, meaning Interrupt On Completion (of the transaction). At this point, the input buffer is filled with some data.
2021-01-09Kernel/USB: Simplify scheduleJesse Buhagiar
It seems like Haiku and Grub do this, so let's not bother with any fancy timing stuff for now (to at least get _something_ working...)
2021-01-09Kernel/USB: Ignore shared IRQsJesse Buhagiar
According the USB spec/UHCI datasheet (as well as the Linux and BSD source code), if we receive an IRQ and USBSTS is 0, then the IRQ does not belong to us and we should immediately jump out of the handler.
2021-01-09Kernel/USB: Add basic root port detection/managementJesse Buhagiar
We can now read/write to the two root ports exposed to the UHCI controller, and detect when a device is plugged in or out via a kernel process that constantly scans the port for any changes. This is very basic, but is a bit of fun to see the kernel detecting hardware on the fly :^)
2021-01-09Kernel/USB: Implement UHCI Data structuresJesse Buhagiar
Implemented both Queue Heads and Transfer Descriptors. These are required to actually perform USB transactions. The UHCI driver sets up a pool of these that can be allocated when we need them. It seems some drivers have these statically allocated, so it might be worth looking into that, but for now, the simple way seems to be to allocate them on the fly as we need them, and then release them.
2021-01-09Kernel/USB: Prevent system crash via correct UHCI inititilisationJesse Buhagiar
It seems that not setting the framelist address register was causing the entire system to lock up as it generated an insane interrupt storm in the IRQ handler for the UHCI controller. We now allocate a 4KiB aligned page via `MemoryManager::allocate_supervisor_physical_page()` and set every value to 1. In effect, this creates a framelist with each entry being a "TERMINATE" entry in which the controller stalls until its' 1mS time slice is up. Some more registers have also been set for consistency, though it seems like this don't need to be set explicitly in software.
2021-01-09Kernel/USB: Move USB classes into `USB` namespaceJesse Buhagiar
The entire USB spec involves more than just UHCI, so let's put everything into it's own nice namespace :^)
2021-01-09Kernel/USB: Move USB related files to into specific directoryJesse Buhagiar
As the USB/UHCI driver grows in size, it'll be much cleaner to have all of the USB related files in one folder where they can be easily accessed :^)
2021-01-06Syscall: Changed 'setkeymap' to take also the Shift+AltGr map.Davide Carella