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

vmm: don't vmap non-canonical addresses #327

Merged
merged 1 commit into from
Nov 13, 2023

Conversation

sktt
Copy link
Contributor

@sktt sktt commented Nov 9, 2023

Passing a non-canonical address to vmap would still map it, leading to #GP further down the line.

e.g., 0xffff000000000000 would map address for va=0. Let's just return NULL.

@sktt sktt requested a review from a team as a code owner November 9, 2023 15:39
@sktt sktt force-pushed the check-non-canon branch 2 times, most recently from 7c7aaf7 to 68dc913 Compare November 9, 2023 15:41
@sktt sktt added improvement A small enhancement, that makes already implemented features better Priority: 4 Nice-to-have feature labels Nov 9, 2023
arch/x86/pagetables.c Outdated Show resolved Hide resolved
@sktt sktt force-pushed the check-non-canon branch 4 times, most recently from 9c1e40b to 0f6d58c Compare November 12, 2023 22:34
arch/x86/pagetables.c Outdated Show resolved Hide resolved
Moving over the BITS_PER_LONG from bitmap.h to compiler.h.
Shifting the sign bit to the highest position turns the pointer
into a negative number that will remain sign extended when shifting
it back down.

Signed-off-by: Johannes Wikner <[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, Johannes!

@sktt
Copy link
Contributor Author

sktt commented Nov 13, 2023

LGTM! Thanks, Johannes!

thanks for the great tip!

@wipawel wipawel merged commit 71752e2 into KernelTestFramework:mainline Nov 13, 2023
7 checks passed
@sktt sktt deleted the check-non-canon branch November 13, 2023 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement A small enhancement, that makes already implemented features better Priority: 4 Nice-to-have feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants