mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zhi Wang <zhiw@nvidia.com>
To: Alice Ryhl <aliceryhl@google.com>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Tamir Duberstein" <tamird@kernel.org>,
	"Alexandre Courbot" <acourbot@nvidia.com>,
	"Onur Özkan" <work@onurozkan.dev>,
	"Dave Jiang" <dave.jiang@intel.com>,
	"Jason Gunthorpe" <jgg@ziepe.ca>,
	"Saeed Mahameed" <saeedm@nvidia.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Sami Tolvanen" <samitolvanen@google.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH] rust: fwctl: declare cfi_encoding for fwctl_rpc_scope
Date: Tue, 20 Oct 2026 12:08:52 +0300	[thread overview]
Message-ID: <20261020120852.6d2ff11b@inno-dell> (raw)
In-Reply-To: <CAH5fLgj6oCjVheVLYu+X=ptFA-+x4cznX1+bgWT3ayndiA6eiw@mail.gmail.com>

On Tue, 20 Oct 2026 11:04:43 +0200
Alice Ryhl <aliceryhl@google.com> wrote:

> On Tue, Oct 20, 2026 at 10:56 AM Zhi Wang <zhiw@nvidia.com> wrote:
> >
> > On Tue, 20 Oct 2026 08:28:37 +0000
> > Alice Ryhl <aliceryhl@google.com> 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@nvidia.com>
> >
> > BTW: I saw this “lru_status” needs the same treatment, guess bindgen
> > will someday automatically handle this?  
> 
> I believe lru_status is already handled.
> 

Yes, lru_status is already handled.

I meant that both lru_status and fwctl_rpc_scope need explicit entries
in rust/bindgen_parameters. I was wondering whether there are plans for
bindgen to generate the newtype and matching CFI encoding automatically
for enums used in function-pointer signatures, so future additions
wouldn't need the same manual setup.

> Alice
> 


  reply	other threads:[~2026-10-20  9:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20  8:28 Alice Ryhl
2026-10-20  8:55 ` Zhi Wang
2026-10-20  9:04   ` Alice Ryhl
2026-10-20  9:08     ` Zhi Wang [this message]
2026-10-20  9:40       ` Alice Ryhl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261020120852.6d2ff11b@inno-dell \
    --to=zhiw@nvidia.com \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=dave.jiang@intel.com \
    --cc=gary@garyguo.net \
    --cc=jgg@ziepe.ca \
    --cc=jic23@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=saeedm@nvidia.com \
    --cc=samitolvanen@google.com \
    --cc=stable@vger.kernel.org \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=work@onurozkan.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®