Re: [PATCH] rust: fwctl: declare cfi_encoding for fwctl_rpc_scope
From: Alice Ryhl
Date: Tue Oct 20 2026 - 05:09:32 EST
On Tue, Oct 20, 2026 at 10:56 AM Zhi Wang <zhiw@xxxxxxxxxx> wrote:
>
> On Tue, 20 Oct 2026 08:28:37 +0000
> Alice Ryhl <aliceryhl@xxxxxxxxxx> wrote:
>
> > Currently, VTable::fw_rpc_callback() takes scope as a u32, whereas C
> > calls fwctl_ops::fw_rpc with enum fwctl_rpc_scope. With kCFI enabled,
> > enum types are encoded distinctly from integers, causing every fw_rpc
> > indirect call into a Rust fwctl driver to trip a CFI failure. Thus,
> > generate fwctl_rpc_scope as a newtype with a cfi_encoding attribute
> > and use it in fw_rpc_callback().
> >
>
> Thanks for the fix. Looks good to me.
>
> Reviewed-by: Zhi Wang <zhiw@xxxxxxxxxx>
>
> BTW: I saw this “lru_status” needs the same treatment, guess bindgen
> will someday automatically handle this?
I believe lru_status is already handled.
Alice