Linux Modules
 help / color / mirror / Atom feed
From: Petr Pavlu <petr.pavlu@suse.com>
To: Priya Bala Govindasamy <pgovind2@uci.edu>
Cc: mcgrof@kernel.org, da.gomez@kernel.org, samitolvanen@google.com,
	ojeda@kernel.org, atomlin@atomlin.com, 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,
	linux-modules@vger.kernel.org, rust-for-linux@vger.kernel.org,
	stable@vger.kernel.org, ardalan@uci.edu, zhiyunq@cs.ucr.edu,
	dzueck@uci.edu
Subject: Re: [PATCH v2] rust: module_param: Fix potentially incorrect access of `SetOnce<T>`
Date: Wed, 14 Oct 2026 11:20:59 +0200	[thread overview]
Message-ID: <6ebcb36b-8d0a-43cc-a47a-5b4a8af02833@suse.com> (raw)
In-Reply-To: <20260923203145.18714-1-pgovind2@uci.edu>

On 9/23/26 10:31 PM, Priya Bala Govindasamy wrote:
> The `set_param` function casts `kernel_param.arg` to `*const SetOnce<T>`
> But the Rust module macro in rust/macros/module.rs initializes `arg` with
> `#param_name.as_void_ptr()`, and `#param_name` is a `ModuleParamAccess<T>`,
> not a `SetOnce<T>`.
> 
> ModuleParamAccess<T> has default Rust layout but `set_param` accesses its
> first field SetOnce<T> assuming it to be at offset 0. This is not
> guaranteed by Rust and could cause type confusion leading to data
> corruption.
> 
> Fix this by casting `kernel_param.arg` to `ModuleParamAccess<T>` and
> then accessing the `value: SetOnce<T>` field.
> 
> Fixes: 0b08fc292842 ("rust: introduce module_param module")
> Cc: stable@vger.kernel.org
> Reported-by: Dylan Zueck <dzueck@uci.edu>
> Assisted-by: LLM
> Suggested-by: Andreas Hindborg <a.hindborg@kernel.org>
> Signed-off-by: Priya Bala Govindasamy <pgovind2@uci.edu>

I've queued the patch (v2) on modules-next for v7.4-rc1.

-- 
Thanks,
Petr

      reply	other threads:[~2026-10-14  9:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17 17:43 [PATCH 0/1] rust: module_param: Fix potentially incorrect access of `SetOnce<T>` Priya Bala Govindasamy
2026-09-17 17:43 ` [PATCH 1/1] " Priya Bala Govindasamy
2026-09-20 20:12   ` Miguel Ojeda
2026-09-22 12:16   ` Petr Pavlu
2026-09-22 12:38   ` Andreas Hindborg
2026-09-23 20:31 ` [PATCH v2] " Priya Bala Govindasamy
2026-10-14  9:20   ` Petr Pavlu [this message]

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=6ebcb36b-8d0a-43cc-a47a-5b4a8af02833@suse.com \
    --to=petr.pavlu@suse.com \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=aliceryhl@google.com \
    --cc=ardalan@uci.edu \
    --cc=atomlin@atomlin.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=da.gomez@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=dzueck@uci.edu \
    --cc=gary@garyguo.net \
    --cc=linux-modules@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=pgovind2@uci.edu \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=samitolvanen@google.com \
    --cc=stable@vger.kernel.org \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=work@onurozkan.dev \
    --cc=zhiyunq@cs.ucr.edu \
    /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