[mm_supv]: Allocate the Ring 3 stack per demotion instead of using the pre-allocated array
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- rust
- Domain
- operating-systems, security
Research direction
Start with the TODO in patina_mm_supervisor/src/privilege_mgmt/syscall_setup.rs and trace how get_cpl3_stack supplies the Ring 3 stack during demotion and return. Then inspect validate_named_regions, verify_passdown_protections, and the page-table walk that enforce the current PassDown stack assumptions. Done means a per-demotion User stack is allocated, scrubbed and freed, with allocation failure handled and the HOB checks updated.
Written by the indexing model from the issue text.
Description
Feature Overview
Each CPU's Ring 3 stack is a fixed slice of one array MM Init allocates (PassDown cpl3_stack_base, cpl3_stack_size per core). SyscallInterface::get_cpl3_stack returns the slice for the core. The stacks stay mapped user-writable for the life of the supervisor and are reused across demotions, so whatever one user call leaves on the stack is still there for the next. Tracked from a TODO in patina_mm_supervisor/src/privilege_mgmt/syscall_setup.rs.
/// TODO: Consider allocating a page before demotion and freeing it on return instead of
/// using the pre-allocated stack array.
pub fn get_cpl3_stack(&self, cpu_index: usize) -> Result<u64, SyscallSetupError> {
https://github.com/OpenDevicePartnership/patina/pull/1875#discussion_r4555674267
Solution Overview
Allocate a User stack from the supervisor page allocator before each demotion, and scrub and free it on return, the same way other user allocations are freed. This needs a decision on the per-MMI allocation cost and on what to do when allocation fails. The current HOB checks (validate_named_regions, verify_passdown_protections and the page-table walk) treat the PassDown stacks as the only user-writable memory in MMRAM outside modules, so they would need to change too.
Alternatives Considered
No response
Urgency
Low
Are you going to implement the feature request?
I will implement the feature
Do you need maintainer feedback?
No maintainer feedback needed
Anything else?
No response
- Dominant language
- Rust
- Stars
- 568
- Forks
- 63
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 60
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from OpenDevicePartnership/patina
-
state:needs-owner state:needs-triage type:documentation
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
OpenDevicePartnership/patina#1987 ·
Maintainers usually reply within 1 day
-
state:backlog state:needs-triage type:feature-request urgency:medium
Difficulty 5/5 Over a week Newbie friendliness 28/100
OpenDevicePartnership/patina#2039 ·
Maintainers usually reply within 1 day
-
Potential Major Update: Drop `Deref` from `Protocol<P>`Possibly taken @makubacki claimed this 7 days ago. Open
OpenDevicePartnership/patina#2036 · 1 assignee ·
Maintainers usually reply within 1 day
-
[Feature]: Enforce service thread safety through automatic Send and Sync implementationsPossibly taken @Javagedes claimed this 8 days ago. Openstate:needs-triage type:feature-request urgency:medium
OpenDevicePartnership/patina#2027 · 1 assignee ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
OpenDevicePartnership/patina#2024 ·
Maintainers usually reply within 1 day
All issues in OpenDevicePartnership/patina
Similar issues
-
platform:windows provider:antigravity-cli providers setup triaged wontfix
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
can1357/oh-my-pi#21349 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
erkamyaman/rea-games#246 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
aaif-goose/goose#13970 ·
Maintainers usually reply within 1 day
-
comp-documentation
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ClickHouse/ClickHouse#136277 ·
Maintainers usually reply within 1 day