Skip to content

WinApi SYSTEM_INFO dwPageSize always returning 0 #2136

Closed
@V0ldek

Description

@V0ldek

This is a rather weird issue I reported first in the page_size crate. When running Miri with any of the Tier 1 Windows targets the crate reports page size 0, which is a fatal error for my use, where I want to allocate aligned to the page boundary.

This is witnessed most easily by the GitHub Action run. My code panics when the page size is not a power of two, so in this case it crashes with:

thread 'main' panicked at 'detected page size 0 that is not a power of two, this is unsupported', src/alignment.rs:111:21

The page size query works perfectly well for Unix targets.

Replication

This can be confirmed by referencing page_size and asking for it like this:

fn main() {
    println!("Page size: {}", page_size::get());
}

and running Miri:

cargo +nightly miri run --target x86_64-pc-windows-gnu

resulting in:

> Page size: 0

Whereas running it without Miri gives the correct result (on my PC it's 4KB):

cargo run
> Page size: 4096

If it matters, the host OS seems to not affect this, the issue is the same running the command both from Unix and Windows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-shimsArea: This affects the external function shimsA-windowsArea: affects only Windows targetsE-good-first-issueA good way to start contributing, mentoring is available

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions