-
Notifications
You must be signed in to change notification settings - Fork 88
Description
The custom allocator in wdk_alloc
is based on on ExAllocatePool2
which uses a 16 byte alignment on 64 bit systems if the allocation size is < PAGE_SIZE and PAGE_SIZE otherwise. We need to validate that this does not violate alignment requirements of Rust types.
Primitive Rust types should be fine. The biggest alignment requirement is 16 bytes for u128
and i128
which does not conflict with ExAllocatePool2
's behaviour.
We just need to check for composite types. As per the Rust reference Rust composite types with standard repr will have an alignment at least as big the maximum alignment of its fields. Types with #[repr(align)]
or those with fields of types with #[repr(align)]
can have arbitrary alignment requirements. The allocator should work correctly in all these cases.