Re: [PATCH 1/2] rust: pin-init: internal: init: remove `#[disable_initialized_field_access]`
From: Benno Lossin
Date: Mon Mar 02 2026 - 09:17:21 EST
On Sun Mar 1, 2026 at 6:12 PM CET, Janne Grunau wrote:
> On Sat, Feb 28, 2026 at 12:37:04PM +0100, Benno Lossin wrote:
>> @asahi folks, let me know if I should prioritize a solution for packed
>> structs. Otherwise I'd like not support it at the moment, as that
>> requires some deeper changes to the internals of pin-init. I'm tracking
>> the status of packed structs in:
>
> I have worked around this in the downstream AOP audio driver now. I did
> not do that initially since it looked more involved and we were planning
> to bring support back.
> These structs describe messages for communication with a coprocessor via
> shared memory. They are derived by observing messages by tracing. So
> there is only limited understanding how the messages are formated. Their
> layout has for obvious reason match exactly so `#[repr(C, packed)]` is
> the obvious choice.
> One of the structs had a size of N * 4 - 1 which results in a alignment
> of 1. Fortunately the struct could be padded to multiple of 4.
> Nevertheless it was required to replace a few u32 with an unaligned
> version.
>
> I'm not sure if there is a need to support unaligned fields in pin-init.
> The workarounds in the asahi GPU and AOP audio drivers are acceptable
> and could stay indefinitely.
Thanks for the quick work! Yeah that sounds like a good solution for the
problem. Adding unaligned pointer support to initialization is quite a
pain. If it comes up we can still do it of course (but I'd only do it if
we can't find a workaround).
Cheers,
Benno