mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: FUJITA Tomonori <tomo@flapping.org>
To: samitolvanen@google.com
Cc: ojeda@kernel.org, boqun@kernel.org, gary@garyguo.net,
	bjorn3_gh@protonmail.com, lossin@kernel.org,
	a.hindborg@kernel.org, aliceryhl@google.com, tmgross@umich.edu,
	dakr@kernel.org, daniel.almeida@collabora.com, tamird@kernel.org,
	acourbot@nvidia.com, work@onurozkan.dev,
	fujita.tomonori@gmail.com, frederic@kernel.org, lyude@redhat.com,
	tglx@kernel.org, anna-maria@linutronix.de, jstultz@google.com,
	sboyd@kernel.org, abdiel.janulgue@gmail.com,
	robin.murphy@arm.com, rust-for-linux@vger.kernel.org,
	linux-kernel@vger.kernel.org, driver-core@lists.linux.dev
Subject: Re: [PATCH 2/3] rust: hrtimer: declare cfi_encoding for hrtimer_restart
Date: Tue, 20 Oct 2026 21:50:22 +0900 (JST)	[thread overview]
Message-ID: <20261020.215022.576606933901583722.tomo@flapping.org> (raw)
In-Reply-To: <20261019-rust-cfi-fixes-v1-2-9503472ba738@google.com>

On Mon, 19 Oct 2026 23:34:38 +0000
Sami Tolvanen <samitolvanen@google.com> wrote:

> The hrtimer callbacks return bindings::hrtimer_restart, which bindgen
> generates as c_uint. C calls them through hrtimer->function, which
> returns enum hrtimer_restart. kCFI encodes enum types by name even with
> integer normalization, so the type ids never match and every call fails
> the CFI check.
> 
> Generate hrtimer_restart as a newtype with a cfi_encoding, as is done
> for lru_status, and adapt HrTimerRestart to the newtype.
> 
> Fixes: 8a8afe9349fb ("rust: hrtimer: introduce hrtimer support")
> Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
> ---
>  rust/bindgen_parameters     | 2 ++
>  rust/kernel/time/hrtimer.rs | 6 +++---
>  2 files changed, 5 insertions(+), 3 deletions(-)

Tested the hrtimer doctests on x86_64 QEMU with CONFIG_CFI=y. Without
this patch they hit a CFI failure in __hrtimer_run_queues, and with it
they pass.

Reviewed-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Tested-by: FUJITA Tomonori <fujita.tomonori@gmail.com>

  parent reply	other threads:[~2026-10-20 12:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19 23:34 [PATCH 0/3] rust: Fix CFI type mismatches Sami Tolvanen
2026-10-19 23:34 ` [PATCH 1/3] rust: irq: declare cfi_encoding for irqreturn Sami Tolvanen
2026-10-20  8:12   ` Alice Ryhl
2026-10-19 23:34 ` [PATCH 2/3] rust: hrtimer: declare cfi_encoding for hrtimer_restart Sami Tolvanen
2026-10-20  8:12   ` Alice Ryhl
2026-10-20 12:50   ` FUJITA Tomonori [this message]
2026-10-19 23:34 ` [PATCH 3/3] rust: dma: declare cfi_encoding for dma_data_direction Sami Tolvanen
2026-10-20  8:13   ` Alice Ryhl
2026-10-20 10:51 ` [PATCH 0/3] rust: Fix CFI type mismatches Miguel Ojeda
2026-10-20 11:58 ` Gary Guo

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=20261020.215022.576606933901583722.tomo@flapping.org \
    --to=tomo@flapping.org \
    --cc=a.hindborg@kernel.org \
    --cc=abdiel.janulgue@gmail.com \
    --cc=acourbot@nvidia.com \
    --cc=aliceryhl@google.com \
    --cc=anna-maria@linutronix.de \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=driver-core@lists.linux.dev \
    --cc=frederic@kernel.org \
    --cc=fujita.tomonori@gmail.com \
    --cc=gary@garyguo.net \
    --cc=jstultz@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=lyude@redhat.com \
    --cc=ojeda@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=samitolvanen@google.com \
    --cc=sboyd@kernel.org \
    --cc=tamird@kernel.org \
    --cc=tglx@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®