bytecodealliance / bytecodealliance/rustix

Add memory sanitizer (msan) support for rand::getrandom_uninit (and io::read)

Open
#1,071 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2.1k
Forks
294
Avg merge
4h 7m
Merged PRs (30d)
2

Description

In order to use create a rustix backend for the `getrandom` crate that would pass its tests using memory sanitizer, these functions nedd to `__msan_unpoison` their output buffer only when they succeed, when `#[cfg(sanitize = "memory")]` (only available on Nightly):

* `rand::getrandom_uninit`
* ,io::read

`rand::getrandom_uninit` is the most urgent, as people probably won't be running memory sanitizer on a kernel so old that `getrandom` would fall back to reading from `/dev/urandom`.

See https://github.com/rust-random/getrandom/pull/463 for my attempt to do this directly within `getrandom`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.