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

Build a container for miri tests #61

Closed
jsha opened this issue Mar 11, 2021 · 3 comments
Closed

Build a container for miri tests #61

jsha opened this issue Mar 11, 2021 · 3 comments

Comments

@jsha
Copy link
Collaborator

jsha commented Mar 11, 2021

Right now we're getting this error for the miri tests:

error: component 'miri' for target 'x86_64-unknown-linux-gnu' is unavailable for download for channel nightly
Sometimes not all components are available in any given nightly. If you don't need the component, you can remove it with:

    rustup component remove --toolchain nightly --target x86_64-unknown-linux-gnu miri

We should build a container with a given version of nightly that we know has the miri component, so we're not vulnerable to breakages like this. That would also be beneficial for build times, since right now we build some things for the miri test job, and that's slow.

This was referenced Mar 19, 2021
@djc
Copy link
Member

djc commented Nov 8, 2021

Given the UB found in #195, probably good to prioritize this?

@jsha
Copy link
Collaborator Author

jsha commented Nov 9, 2021

Good to prioritize, but worth noting that Miri wouldn't have caught the UB in #195. That UB occurred at the FFI boundary, but Miri only handles Rust. To catch it we would have needed Rust tests that explicitly exercised the case of creating an invalid enum to pass to rustls_error.

It looks like Miri now provides instructions on how to include it in CI while accounting for the problem that it doesn't exist in all nightly builds: https://github.com/rust-lang/miri#running-miri-on-ci

To properly exercise our code, under Miri, we'll want to write a bunch more unittests on the Rust side. It would also be good to have an integration test that acts like client.c / server.c. However:

Miri runs the program as a platform-independent interpreter, so the program has no access to most platform-specific APIs or FFI. A few APIs have been implemented (such as printing to stdout) but most have not: for example, Miri currently does not support SIMD or networking.

Fortunately the read_tls / write_tls interfaces in rustls don't require writing to an actual network, so we can just simulate a network connection with a pair of buffers.

@jsha
Copy link
Collaborator Author

jsha commented Nov 11, 2021

Done in #199. We didn't wind up needing to create a container. 🎉

@jsha jsha closed this as completed Nov 11, 2021
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