-
Notifications
You must be signed in to change notification settings - Fork 14k
Open
Labels
C-bugCategory: This is a bug.Category: This is a bug.O-hermitOperating System: HermitOperating System: HermitT-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Description
I tried using a custom global allocator on hermit. ReadDir fails as a result:
thread 'main' (1) panicked at /home/marcus/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/fs/hermit.rs:198:32:
misaligned pointer dereference: address must be a multiple of 0x8 but is 0x4000c1fffcf5
Aligning all allocations to at least 8 bytes fixes the issue, so I looked into the file. It seems like the buffer used for ReadDir is not suitably aligned:
// all DirEntry's will have a reference to this struct
struct InnerReadDir {
root: PathBuf,
dir: Vec<u8>,
}dir is later expected to be aligned to 8 bytes:
let dir = unsafe { &*(self.inner.dir.as_ptr().add(offset) as *const dirent64) };rustc --version --verbose:
rustc 1.92.0-nightly (3d8c1c1fc 2025-10-06)
binary: rustc
commit-hash: 3d8c1c1fc077d04658de63261d8ce2903546db13
commit-date: 2025-10-06
host: x86_64-unknown-linux-gnu
release: 1.92.0-nightly
LLVM version: 21.1.2
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.O-hermitOperating System: HermitOperating System: HermitT-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.