Glommio is a thread-per-core crate that makes writing highly parallel asynchronous applications in a thread-per-core architecture easier for rustaceans.
Other
2.93k
stars
161
forks
source link
Valgrind complains about uninitialized memory in buffer returned by read_at_aligned #647
I'm getting a lot of Valgrind errors accessing the ReadResult after a read_at_aligned in DmaFile:
Conditional jump or move depends on uninitialised value(s)
and
Use of uninitialised value of size 8
I'm currently working around this by adding a dependency on crabgrind & explicitly annotating the memory as defined. This is probably a bug (or inherent limitation) in Valgrind, but just in case this is fixable within glommio (e.g. by initializing the memory with 0s when it's allocated?).
Repro:
use glommio::io::OpenOptions;
fn main() {
glommio::LocalExecutor::default().run(async move {
let file = OpenOptions::new().tmpfile(true).read(true).write(true).dma_open("/tmp/").await.expect("couldn't open file");
let mut buf = file.alloc_dma_buffer(4096);
let mut idx = 0usize;
buf.as_bytes_mut().fill_with(|| {idx += 1; idx as u8});
file.write_at(buf, 0).await.expect("failed to write buffer");
let read = file.read_at_aligned(0, 512).await.expect("failed to read buffer");
let sum = read.iter().map(|&b| b as usize).sum::<usize>();
assert_eq!(sum, 65280);
let read = file.read_at_aligned(512, 4096).await.expect("failed to read buffer");
assert_eq!(read.len(), 3584);
let sum = read.iter().map(|&b| b as usize).sum::<usize>();
assert_eq!(sum, 456960);
});
}
I'm getting a lot of Valgrind errors accessing the ReadResult after a read_at_aligned in DmaFile:
and
I'm currently working around this by adding a dependency on
crabgrind
& explicitly annotating the memory as defined. This is probably a bug (or inherent limitation) in Valgrind, but just in case this is fixable within glommio (e.g. by initializing the memory with 0s when it's allocated?).Repro:
repro.zip
Upstream: https://bugs.kde.org/show_bug.cgi?id=485400