Re: [PATCH] rust: fwctl: declare cfi_encoding for fwctl_rpc_scope

From: Jason Gunthorpe

Date: Wed Oct 21 2026 - 13:22:01 EST


On Tue, Oct 20, 2026 at 08:28:37AM +0000, Alice Ryhl 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().
>
> Cc: stable@xxxxxxxxxxxxxxx
> Fixes: e052daab94ee ("rust: introduce abstractions for fwctl")
> Signed-off-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
> ---
> rust/bindgen_parameters | 2 ++
> rust/kernel/fwctl.rs | 12 ++++++------
> 2 files changed, 8 insertions(+), 6 deletions(-)

Applied

Thanks,
Jason