Closed Connor1996 closed 3 years ago
The key and value are from on-stack Vec<u8>. Maybe the Vec isn't aligned with the type of key and value. https://github.com/rust-bpf/rust-bcc/blob/c4e5ef83568b220c8bf271a6f80e9579b2df1e5e/src/table.rs#L160
Vec<u8>
Vec
Using std::ptr::read on these misaligned ptrs may cause trouble. Should it use std::ptr::read_unalign instead? https://github.com/rust-bpf/rust-bcc/blob/f28fa173f8b9e6cac28924105049dc8c37e8e780/examples/contextswitch.rs#L160
std::ptr::read
std::ptr::read_unalign
I think you're right. Would accept a PR that changes these to read_unaligned in the examples.
The key and value are from on-stack
Vec<u8>
. Maybe theVec
isn't aligned with the type of key and value. https://github.com/rust-bpf/rust-bcc/blob/c4e5ef83568b220c8bf271a6f80e9579b2df1e5e/src/table.rs#L160Using
std::ptr::read
on these misaligned ptrs may cause trouble. Should it usestd::ptr::read_unalign
instead? https://github.com/rust-bpf/rust-bcc/blob/f28fa173f8b9e6cac28924105049dc8c37e8e780/examples/contextswitch.rs#L160