summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-01-29Kernel: Return -ENOTDIR for non-directory mount targetLinus Groh
The absence of this check allowed silly things like this: # touch file # mount /dev/hda file
2021-01-29Kernel: Prevent mmap-ing as both fixed and randomizedSahan Fernando
2021-01-28Kernel: sys$mmap PAGE_ROUND_UP size before calling allocate_randomized (#5154)Jorropo
`allocate_randomized` assert an already sanitized size but `mmap` were just forwarding whatever the process asked so it was possible to trigger a kernel panic from an unpriviliged process just by asking some randomly placed memory and a size non alligned with the page size. This fixes this issue by rounding up to the next page size before calling `allocate_randomized`. Fixes #5149
2021-01-28Ports (jq): Add .patch extension to the diff to fit the wildcard (#5148)Jorropo
This fixes the build of `jq`. `diff` were not matched by `patches/*.patch`, this seems to have gone unnoticed in a refactor.
2021-01-28LibWeb: Add simple implementation of Document.createElementNSLuke
2021-01-28Kernel: Allow specifying a physical alignment when allocatingTom
Some drivers may require allocating contiguous physical pages with a specific alignment for the physical address.
2021-01-28Kernel: Retire SchedulerData and add Thread lookup tableTom
This allows us to get rid of the thread lists in SchedulerData. Also, instead of iterating over all threads to find a thread by id, just use a lookup table. In the rare case of having to iterate over all threads, just iterate the lookup table.
2021-01-28AK: Provide traits for DistinctNumeric<T>AnotherTest
2021-01-28Kernel: Remove outdated debug logging from RangeAllocatorAndreas Kling
If someone wants to debug this code, it's better that they rewrite the logging code to take randomization and guard pages into account.
2021-01-28LibELF: Implement ASLR for shared libraries :^)Andreas Kling
Use mmap() with the new MAP_RANDOMIZED flag to load shared libraries at random addresses in each process. To avoid address space collisions, we start by doing a large chunk mmap that covers enough VM for both text and data, then we unmap and remap the data segment separately, once we know everything will fit. This is pretty cool! :^)
2021-01-28Kernel+LibC: Add MAP_RANDOMIZED flag for sys$mmap()Andreas Kling
This can be used to request random VM placement instead of the highly predictable regular mmap(nullptr, ...) VM allocation strategy. It will soon be used to implement ASLR in the dynamic loader. :^)
2021-01-28Kernel: Add sanity check assertion in RangeAllocator::allocate_specificAndreas Kling
The specific virtual address should always be page aligned.
2021-01-28Kernel: Add sanity check assertion in RangeAllocator::allocate_anywhereAndreas Kling
The requested alignment should always be a multiple of the page size.
2021-01-28LibJS: Fix crash when printing error for missing class extends value prototypeLinus Groh
If it's missing we get an empty value, but we can't use that with to_string_without_side_effects() so we have to use undefined as the default. Fixes #5142.
2021-01-28LibJS: Call the correct base class in LexicalEnvironment::visit_edges()Andreas Kling
We were calling directly up to Cell, skipping over ScopeObject. This made us not mark the scope chain parent for lexical environments, sometimes causing them to get GC'd and use-after-free'd. Found by Fuzzilli. Fixes #5140.
2021-01-28Lagom+AK: Remove remains of clang -Wconsumed usageAndreas Kling
We stopped using that warning ages ago since it confused the compiler.
2021-01-28LibWeb: Add simple implementation of Node.removeChild()Andreas Kling
2021-01-28LibWeb: Remove accidentally committed changes from ↵Andreas Kling
b72f067f0daac88ebe66e3f714e517b995b48e7b
2021-01-28Kernel: Generate coredump backtraces from "threads for coredump" listAndreas Kling
This broke with the change that gave each process a list of its own threads. Since threads are removed slightly earlier from that list during process teardown, we're not able to use it for generating coredump backtraces. Fortunately we have the "threads for coredump" list for just this purpose. :^)
2021-01-28Kernel+Userland: Remove unused "effective priority" from threadsAndreas Kling
This has been merged with the regular Thread::priority field after the recent changes to the scheduler.
2021-01-28Vim: Add change word and delete word functionalityZac
Add the functionality of key sequences 'cw', 'ce', 'cb', 'dw', 'de' and 'db'.
2021-01-28Kernel: Make KernelRng thread-safeTom
This adds an optional argument to get_good_random_bytes that can be used to only return randomness if it doesn't have to block. Also add a SpinLock around using FortunaPRNG. Fixes #5132
2021-01-28Kernel: Remove colonel special-case from Process::for_each_threadTom
Since each Process now has its own list of threads, we don't need to treat colonel any different anymore. This also means that it reports all kernel threads, not just the idle threads.
2021-01-28BXVGADevice+MBVGADevice: Correctly check page-aligned mmapsPeter Elliott
In ab14b0ac64cd8bcaf7060050a7ec5a99cf7bd121, mmap was changed so that the size of the region is aligned before it was passed to the device driver. The previous logic would assert when the framebuffer size was not a multiple of the page size. I've also taken the liberty of returning an error on mmap failure rather than asserting.
2021-01-27Revert "Kernel: Fix Thread::relock_process leaving critical section"Andreas Kling
This reverts commit e9e76b80749c74bc1ef6bd24c30d11103a28a27e. This was causing a noticeable slowdown, and we're not sure that it was actually necessary.
2021-01-27Kernel: Add a compile-time switch to enable scheduling on all CPUsTom
This is meant to be temporary only and should be removed once scheduling on all CPUs is stable.
2021-01-27Kernel: Fix Thread::relock_process leaving critical sectionTom
We don't want to explicitly enable interrupts when leaving the critical section to trigger a context switch.
2021-01-27Kernel: Don't hold scheduler lock while setting up blocker in Thread::blockTom
This fixes a deadlock when one processor is trying to block while another is trying to unblock the same.
2021-01-27Kernel: Release MM lock while yielding from inode page fault handlerTom
We need to make sure other processors can grab the MM lock while we wait, so release it when we might block. Reading the page from disk may also block, so release it during that time as well.
2021-01-27Kernel: Keep a list of threads per ProcessTom
This allow us to iterate only the threads of the process.
2021-01-27Kernel: Implement thread priority queuesTom
Rather than walking all Thread instances and putting them into a vector to be sorted by priority, queue them into priority sorted linked lists as soon as they become ready to be executed.
2021-01-27Kernel: Track processor idle state and wake processors when waking threadsTom
Attempt to wake idle processors to get threads to be scheduled more quickly. We don't want to wait until the next timer tick if we have processors that aren't doing anything.
2021-01-27Kernel: Use the CPU# as logical apic idTom
2021-01-27AK: Include the processor id in log messagesTom
2021-01-27Kernel: Remove Range "valid" state and use Optional<Range> insteadAndreas Kling
It's easier to understand VM ranges if they are always valid. We can simply use an empty Optional<Range> to encode absence when needed.
2021-01-27DynamicLoader: Pass MAP_FIXED to mmap() where applicableAndreas Kling
Otherwise the kernel is free to allocate a different address.
2021-01-27Kernel: sys$mmap() without MAP_FIXED should consider address a hintAndreas Kling
If we can't use that specific address, it's still okay to put it anywhere else in VM.
2021-01-27Kernel: Make Processor::id a static functionTom
This eliminates the window between calling Processor::current and the member function where a thread could be moved to another processor. This is generally not as big of a concern as with Processor::current_thread, but also slightly more light weight.
2021-01-27Kernel: Make Thread::current smp-safeTom
Change Thread::current to be a static function and read using the fs register, which eliminates a window between Processor::current() returning and calling a function on it, which can trigger preemption and a move to a different processor, which then causes operating on the wrong object.
2021-01-27Kernel: Make entering and leaving critical sections atomicTom
We also need to store m_in_critical in the Thread upon switching, and we need to restore it. This solves a problem where threads moving between different processors could end up with an unexpected value.
2021-01-27Kernel: Use new Thread::previous_mode to track ticksTom
2021-01-27Kernel: Track previous mode when entering/exiting trapsTom
This allows us to determine what the previous mode (user or kernel) was, e.g. in the timer interrupt. This is used e.g. to determine whether a signal handler should be set up. Fixes #5096
2021-01-27HackStudio: Integate with C++ parser-based autocompleteItamar
By default, C++ auto completion will still be performed by the lexer-based logic. However, the parser-based logic can be switched on via the menubar.
2021-01-27HackStudio: Attach previous Language Client when detachingItamar
Previously, if a new LanguageClient was created & destroyed, the ServerConnection to the language server would be left without an attached LanguageClient. As a result, auto-completion results would not be updated in the UI. Starting with this commit, the LanguageClient holds a WeakPtr to the previous LanguageClient that was attached to the ServerConnection, and re-attaches it after detaching itself.
2021-01-27HackStudio: Add parser-based c++ autocomplete engineItamar
2021-01-27LibCpp: Add the beginning of a C++ parserItamar
This parser will be used by the C++ langauge server to provide better auto-complete (& maybe also other things in the future). It is designed to be error tolerant, and keeps track of the position spans of the AST nodes, which should be useful later for incremental parsing.
2021-01-27EditingEngine: Fix move_to_previous_word not working on last char of docZac
Code meant for the move_to_next_word functions which set the cursor to the last character in the file if it was reached was copied into the move_to_previous_word functions which lead them not moving when the function was called from the end of the file.
2021-01-27Kernel: Assert in RangeAllocator that sizes are multiple of PAGE_SIZEAndreas Kling
2021-01-27LibJS: Add overflow checks when creating TypedArray from ArrayBufferAndreas Kling
Thanks to Iliad for finding this! :^)
2021-01-27LibGfx: Correct the allocated buffer size in serialize_to_byte_buffer()AnotherTest
Fixes #5131.