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

Add draft of Svukte extension #1564

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Add draft of Svukte extension #1564

wants to merge 7 commits into from

Conversation

aswaterman
Copy link
Member

Svkt provides a means to make user-mode accesses to supervisor memory raise page faults in constant time, mitigating attacks that attempt to discover the supervisor software's address-space layout.

I plan to submit this as a fast-track soon.

src/supervisor.adoc Outdated Show resolved Hide resolved
src/supervisor.adoc Outdated Show resolved Hide resolved
src/supervisor.adoc Outdated Show resolved Hide resolved
src/supervisor.adoc Outdated Show resolved Hide resolved
src/supervisor.adoc Outdated Show resolved Hide resolved
@aswaterman aswaterman changed the title Add draft of Svkt extension Add draft of Svukte extension Aug 1, 2024
src/supervisor.adoc Outdated Show resolved Hide resolved
aswaterman and others added 4 commits August 1, 2024 13:54
Svkt provides a means to make user-mode accesses to supervisor memory raise
page faults in constant time, mitigating attacks that attempt to discover the
supervisor software's address-space layout.

I plan to submit this as a fast-track soon.
Co-authored-by: Josep Sans <[email protected]>
Signed-off-by: Andrew Waterman <[email protected]>
Changes:

- Extension renamed from Svkt to Svukte
- SVKT field renamed to UKTE
- HUVKT field moved from henvcfg to hstatus
- HUVKT field renamed to HUKTE
src/supervisor.adoc Outdated Show resolved Hide resolved
@allenjbaum
Copy link

OK, what happens if the extension is enabled, the Ubit in the PTE is set ( so the access would be valid if the extension was disabled). Does that override the U-bit? Implicitly, it does, but I'd like to see that explicit (possibly in this extension spec, and/or in the the description of the U-bit in the spec section on the definition of the U-bit

@ved-rivos
Copy link
Collaborator

OK, what happens if the extension is enabled, the Ubit in the PTE is set ( so the access would be valid if the extension was disabled). Does that override the U-bit? Implicitly, it does, but I'd like to see that explicit (possibly in this extension spec, and/or in the the description of the U-bit in the spec section on the definition of the U-bit

The basic premise of Svukte is to take advantage of the convention in all 64-bit OS that user mappings are in positive address space and supervisor mappings are in negative address space. An OS that create user mappings in negative address space - even a single mapping - cannot turn on Svukte or the OS has to provide an emulation. For instance, for x86 based Linux legacy vDSO were located in negative address space and when LASS was introduced the OS provided emulation for such legacy vDSO. Non legacy vDSO on x86 and vDSO on RISC-V are located in positive address space. The point of Svukte is to fault on user access to negative addresses without consulting the address translation caches or doing implicit accesses to the page tables.

So I think the state of the U bit is a don't care for this extension. For that matter the PTE itself may not be valid at all.

@allenjbaum
Copy link

allenjbaum commented Oct 9, 2024 via email

@aswaterman
Copy link
Member Author

OK, I'll make it explicit.

@allenjbaum
Copy link

allenjbaum commented Oct 10, 2024 via email

@aswaterman
Copy link
Member Author

I don’t understand what you’re complaining about at this point. The note I added, that the PTE contents don’t matter, is even stronger than the thing you asked for!

@lfiolhais
Copy link

Hey everyone, just to piggy back on @allenjbaum comment, as I share the same opinion. I also misinterpreted the text on my first reading, and thought the hart would have to check the U bit on the PTE on every U-mode access and deliver an exception in constant-time (even though an implementation like this would be possible). However, after the presentation at the Security HC meeting, I now understand the extension much better. The desired final implementation is to AND three bits: vaddr[2^SXLEN-1], priv == u-mode, and senvcfg.UKTE (or the equivalent for the guest). I think it would be immensely helpful to add this short sentence as an implementation hint to the reader.

pbo-linaro pushed a commit to pbo-linaro/qemu-ci that referenced this pull request Oct 18, 2024
Refer to the draft of svukte extension from:
riscv/riscv-isa-manual#1564

Svukte provides a means to make user-mode accesses to supervisor memory
raise page faults in constant time, mitigating attacks that attempt to
discover the supervisor software's address-space layout.

Signed-off-by: Fea.Wang <[email protected]>
Reviewed-by: Frank Chang <[email protected]>
Reviewed-by: Jim Shu <[email protected]>
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.

10 participants