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

pagetables: allow user and kernel maps in same pgd #296

Merged
merged 1 commit into from
Sep 1, 2023

Conversation

sktt
Copy link
Contributor

@sktt sktt commented Aug 29, 2023

KTF allows user mode to allocate high addresses, which normally are only available to kernel. However, to handle this somewhat gracefully, we need to check if already-existent page table protection bits conflicts with those of new maps.

We downgrade the current flags if the most recent mapping's flags are more permissive than current flags. This is all a bit sketchy but useful, so print a big warning if this ever happens.

@sktt sktt requested a review from a team as a code owner August 29, 2023 16:26
Copy link
Contributor

@wipawel wipawel left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. Somehow this change makes me uneasy. But I do see the value for testing.

arch/x86/pagetables.c Outdated Show resolved Hide resolved
arch/x86/pagetables.c Outdated Show resolved Hide resolved
arch/x86/pagetables.c Outdated Show resolved Hide resolved
arch/x86/pagetables.c Show resolved Hide resolved
tests/unittests.c Show resolved Hide resolved
@sktt sktt force-pushed the high_user_addresses branch from 6b42dfc to 3418264 Compare August 31, 2023 17:49
Copy link
Contributor

@wipawel wipawel left a comment

Choose a reason for hiding this comment

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

Other than the comment LGTM

arch/x86/pagetables.c Show resolved Hide resolved
@sktt sktt force-pushed the high_user_addresses branch 2 times, most recently from b72d7a5 to 31eafdd Compare August 31, 2023 19:59
KTF allows user mode to allocate high addresses, which normally are only
available to kernel. However, to handle this somewhat gracefully, we need
to check if already-existent page table protection bits conflicts with
those of a new pgentry.

This means that we may fixup NX, RW or USER flags if the new mapping is
more permissive than current one. This is a bit sketchy, yet useful for
certains tests. Therefore, print a big warning if this ever happens.

Signed-off-by: Johannes Wikner <[email protected]>
@sktt sktt force-pushed the high_user_addresses branch from 31eafdd to 7ca8552 Compare September 1, 2023 16:53
@wipawel wipawel merged commit de99b45 into KernelTestFramework:mainline Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants