From bc6f2a284c63313e789d8cd294531e1cc2dc8c99 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Tue, 20 Oct 2026 08:28:37 +0000 Subject: rust: fwctl: declare cfi_encoding for fwctl_rpc_scope 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(). Link: https://patch.msgid.link/r/20261020-fwctl-cfi-encoding-v1-1-ebb30d1500df@google.com Cc: stable@vger.kernel.org Fixes: e052daab94ee ("rust: introduce abstractions for fwctl") Signed-off-by: Alice Ryhl Reviewed-by: Zhi Wang Signed-off-by: Jason Gunthorpe --- rust/bindgen_parameters | 2 ++ 1 file changed, 2 insertions(+) (limited to 'rust/bindgen_parameters') diff --git a/rust/bindgen_parameters b/rust/bindgen_parameters index 8402b0c93545..e4f8c07743a8 100644 --- a/rust/bindgen_parameters +++ b/rust/bindgen_parameters @@ -27,6 +27,8 @@ --opaque-type spinlock # enums that appear in indirect function calls should specify a cfi type +--newtype-enum fwctl_rpc_scope +--with-attribute-custom-enum=fwctl_rpc_scope='#[cfi_encoding="15fwctl_rpc_scope"]' --newtype-enum lru_status --with-attribute-custom-enum=lru_status='#[cfi_encoding="10lru_status"]' -- cgit v1.2.3