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

VM code doesn't check reserved bits of PTEs are zero #457

Open
Timmmm opened this issue Apr 24, 2024 · 5 comments
Open

VM code doesn't check reserved bits of PTEs are zero #457

Timmmm opened this issue Apr 24, 2024 · 5 comments
Labels
bug Something isn't working configuration Additional configuration settings needed for the model

Comments

@Timmmm
Copy link
Collaborator

Timmmm commented Apr 24, 2024

From the Sv39 spec:

The PTE format for Sv39 is shown in Figure 60. Bits 9-0 have the same meaning as for Sv32. Bit 63 is
reserved for use by the Svnapot extension in Chapter 6. If Svnapot is not implemented, bit 63 remains
reserved and must be zeroed by software for forward compatibility, or else a page-fault exception is
raised. Bits 62-61 are reserved for use by the Svpbmt extension in Chapter 7. If Svpbmt is not
implemented, bits 62-61 remain reserved and must be zeroed by software for forward compatibility, or
else a page-fault exception is raised. Bits 60-54 are reserved for future standard use and, until their
use is defined by some standard extension, must be zeroed by software for forward compatibility. If
any of these bits are set, a page-fault exception is raised.

The current code doesn't check these reserved bits at all.

@jrtc27
Copy link
Collaborator

jrtc27 commented Apr 24, 2024

That requirement doesn’t exist in older versions of the spec IIRC

@Timmmm
Copy link
Collaborator Author

Timmmm commented Apr 24, 2024

Ah maybe. It's in the 20211203 version (current ratified one linked from the risc-v website).

@jrtc27
Copy link
Collaborator

jrtc27 commented Apr 24, 2024

20190608 (ratified v1.11) says just:

The PTE format for Sv39 is shown in Figure 4.18. Bits 9–0 have the same meaning as for Sv32. Bits 63–54 are reserved for future use and must be zeroed by software for forward compatibility.

@allenjbaum
Copy link
Collaborator

allenjbaum commented Apr 24, 2024 via email

@Timmmm
Copy link
Collaborator Author

Timmmm commented Apr 25, 2024

Yeah see #319. I would suggest that until we have flags for this it probably makes sense to implement the latest ratified version and add comments where there are differences between versions like here.

I may have a go at implementing #319 at least for the privileged/unprivileged specs. Shouldn't be too hard.

@Timmmm Timmmm added bug Something isn't working configuration Additional configuration settings needed for the model labels May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working configuration Additional configuration settings needed for the model
Projects
None yet
Development

No branches or pull requests

3 participants