task: assign each task a unique portion of the kernel address space #588
+218
−139
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.
Each task uses a portion of the kernel address space to store task-specific memory, which is only visible in the context of the task that owns it. However, references to task-specific memory can be passed between tasks, and Rust memory safety relies on the principle that any reference (which is captured by its virtual address) must refer to the same underlying data in every context in which that reference is used. This safety principle is defeated if any address is valid in more than one task at a time. Assigning each task a unique portion of the address space ensures that any per-task address that crosses a task boundary will cause a fault instead of referring to the wrong data.