Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Further fixes for usermode handling #289

Merged
merged 3 commits into from
Aug 28, 2023

Conversation

wipawel
Copy link
Contributor

@wipawel wipawel commented Aug 27, 2023

This PR is based on #284. Please review the #284 first and rebase this one to limit the changes.
Only top 3 commits differ.

    arch,entry,usermode: fix user pagetable mappings alignment
    
    The exception handlers as well as interrupt handlers need to be
    properly mapped into user pagetables. Add global symbols to find their
    addresses and align the beginning on a page boundary.
    
    Similar entry_usermode() and syscall_handler_entry() need to be aligned
    and ideally share the same page.
    
    The syscall_exit() and similar routines do not need user pagetable
    mappings.
    
    Add also an explicit mapping for user_cr3 variable.
    arch,entry: cleanup: rearrange code
    
    Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
    arch,usermode: fix user stack handling in enter_usermode()
    
    We need to preserve user stack address on percpu first, to use allow
    simple stack switching.
    
    We need to switch to user pagetables before putting IRET frame onto
    user stack.
    
    Signed-off-by: Pawel Wieczorkiewicz <[email protected]>

@wipawel wipawel added cleanup bugfix This fixes a bug labels Aug 27, 2023
@wipawel wipawel requested a review from a team as a code owner August 27, 2023 15:25
We need to preserve user stack address on percpu first, to use allow
simple stack switching.

We need to switch to user pagetables before putting IRET frame onto
user stack.

Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
@wipawel wipawel enabled auto-merge (rebase) August 28, 2023 07:34
common/usermode.c Outdated Show resolved Hide resolved
minipli-oss
minipli-oss previously approved these changes Aug 28, 2023
The exception handlers as well as interrupt handlers need to be
properly mapped into user pagetables. Add global symbols to find their
addresses and align the beginning on a page boundary.

Similar entry_usermode() and syscall_handler_entry() need to be aligned
and ideally share the same page.

The syscall_exit() and similar routines do not need user pagetable
mappings.

Add also an explicit mapping for user_cr3 variable.

Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
Copy link
Contributor

@minipli-oss minipli-oss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Thanks again, Pawel!

@wipawel wipawel merged commit f597ad1 into KernelTestFramework:mainline Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This fixes a bug cleanup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants