Revamped memory management system#10
Draft
Ioan-Cristian wants to merge 168 commits into
Draft
Conversation
This allows the checker to try multiple keys when verifying a signature.
This generalizes setting the sig verification key from just once at init to being able to set dynamically, allowing for multiple keys to be used with signature verification.
This module provides the signature verification but can hold multiple keys and supports switching between them.
Enable the test ecdsa sig check to support switching between keys.
There are now two signature keys that can be used to verify app signatures. I've checked that I can install apps signed with both keys and they both run.
This means the implementor isn't required to hold the slice that could contain a private key.
Not sure why that was there.
If a caller selects a key that is already active just set that key again. Do not return an error.
Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
… array Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
… loader Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
…ion with MPUs Until this commit, the kernel checked whether the virtual address space of a process intersects with its own virtual address space. This approach does not work for MPUs where the kernel and processes share the same "virtual" address space. This commit fixes this issue by adding a config value which tells the kernel whether a MPU is used. The method used for checking if the process memory configuration is valid has been changed to take use of the config value. Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
kernel: Implement `ProcessArray` to hold an array of `&Process`s with interior mutability
Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
Architectures don't need process' starting RAM or its break, as they should never write to process memory directly. The sole exceptions are ARMv*-M architectures which push and pop data directly on the stack at the hardware level. However, ARMv*-M chips lack a MMU, so the user virtual memory address space and the kernel virtual memory address space are identical. Furthermore, the hardware guarantees that the memory pointed by [SP; SP + STACK_FRAME] is accessible to user space. Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
Flushing the TLB is an expensive operation. Doing it after each configured region degrades system performances. The TLB is now flushed when enabling user protection, which happens once per process switch. Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
Before flushing the TLB, check whether the MMU has been reconfigured. This eliminates unnecessary flushes. Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
On some architectures, the minimum ammount of memory required to run a process may be null. This caused a panic in the kernel during ProcessStandard::create(). The case is now handled by asking the memory manager for 1 byte if the architecture specifies a null ammount of memory. Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
Since the kernel can handle back requests of null memory, revert back to 0 memory. Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
…rocess Signed-off-by: Ioan-Cristian CÎRSTEA <ioan.cirstea@oxidos.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Overview
This pull request revamps the memory management system completely. The goals of the new memory management are:
Testing Strategy
This pull request was tested by running
libtock-rsapplications on Raspberry Pi Pico, QEMU RISC-V 32-bit and QEMU x86.TODO or Help Wanted
This pull request still needs to clarify the following points:
libtock-rs). A future patch will address this issue.ProcessStandard::create()needs to be refactored in several functions that can be reused byProcessStandard::reset().(). Impossible to implement since the kernel needs&dyn Process, which in turn means thatProcessneeds to be object-safe.dyn Process, which in turn means thatProcessneeds to be object-safe.Documentation Updated
Formatting
make prepush.