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(trace-generation): ensure and test that memory reads are zero initialized #1322

Open
eightfilms opened this issue Mar 1, 2024 · 0 comments

Comments

@eightfilms
Copy link
Contributor

eightfilms commented Mar 1, 2024

Some memory in our VM is initialised according to what's in the ELF. Some of it is initialised according to the contents of various tapes.

But the vast majority falls outside of these two cases.

Early on we made the design decision that all such memory should be zero initialized, because that's the least surprising behaviour for our users (eg it's also what Linux does for security reasons, when the kernel hands memory to your program), and would cause the least harm, if people misunderstand the convention.


The two reasonable alternatives we considered were:

  • Fail the program on reading uninitialised memory. This is simplest to implement for us, but can be very frustrating for users.
  • Allow the prover to provide arbitrary values. This would be a neat way to inject arbitrary values into the program, ie to replace the private io tape. But it would really trip up the unwary, and could lead to huge security problems in guest programs.

This issue concerns 'Mozak memory', ie the memory regions where we load our tapes. When we added the tape-via-pre-initialised-memory mechanism, there was some miscommunication and we accidentally stopped the zero-initialisation of those regions.

So let's fix that to close this issue.

As for testing: we can write a guest program that reads arbitrary random memory addresses (using proptest).

@matthiasgoergens matthiasgoergens changed the title vm(trace-generation): ensure and test that all memory reads are zero initialized vm(trace-generation): ensure and test that memory reads are zero initialized Mar 1, 2024
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

No branches or pull requests

2 participants