mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andreas Hindborg <a.hindborg@kernel.org>
To: Bilal Hashim <AeeSec@126.com>, Miguel Ojeda <ojeda@kernel.org>
Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	Bilal Hashim <AeeSec@126.com>
Subject: Re: [PATCH] rust: configfs: initialize AttributeList at compile time without UnsafeCell
Date: Mon, 30 Nov 2026 17:00:02 +0100	[thread overview]
Message-ID: <87v75es41p.fsf@t14s.mail-host-address-is-not-set> (raw)
In-Reply-To: <87y0aas4d5.fsf@t14s.mail-host-address-is-not-set>

Andreas Hindborg <a.hindborg@kernel.org> writes:

> Hi Bilal,
>
> "Bilal Hashim" <AeeSec@126.com> writes:
>
>> The configfs_attrs! macro currently declares a global static AttributeList
>> wrapping an UnsafeCell<[*mut c_void; N]> and populates it at runtime via
>> AttributeList::add() on every macro invocation.
>>
>> Although the static identifier is lexically scoped inside the macro block,
>> the static storage is globally shared across all invocations and threads.
>> When a function invoking configfs_attrs! (such as make_group() in
>> drivers/block/rnull/configfs.rs) executes concurrently on multiple
>> threads, or while C configfs concurrently reads ct_attrs_const, the
>> unsynchronized &mut writes into the static UnsafeCell cause aliasing UB
>> and a data race.
>>
>> Replace UnsafeCell and the runtime AttributeList::add() calls with a pure
>> const AttributeList initialized at compile time inside the static item.
>> This eliminates the data race, removes the runtime pointer stores from
>> make_group(), and allows the attribute table to reside in read-only
>> memory.
>
> Thanks for the patch!

You should also include these people in the Cc list:

Boqun Feng <boqun@kernel.org> (reviewer:RUST)
Gary Guo <gary@garyguo.net> (reviewer:RUST)
"Björn Roy Baron" <bjorn3_gh@protonmail.com> (reviewer:RUST)
Benno Lossin <lossin@kernel.org> (reviewer:RUST)
Alice Ryhl <aliceryhl@google.com> (reviewer:RUST)
Trevor Gross <tmgross@umich.edu> (reviewer:RUST)
Danilo Krummrich <dakr@kernel.org> (reviewer:RUST)
Daniel Almeida <daniel.almeida@collabora.com> (reviewer:RUST)
Tamir Duberstein <tamird@kernel.org> (reviewer:RUST)
Alexandre Courbot <acourbot@nvidia.com> (reviewer:RUST)
"Onur Özkan" <work@onurozkan.dev> (reviewer:RUST)

You can use scripts/get_maintainer.pl to get the list.

I would encourage you to use the `b4` tool to submit patches. It
automates a lot of the stuff that people often get wrong [1].

Best regards,
Andreas Hindborg

[1] https://b4.docs.kernel.org/en/latest/


      reply	other threads:[~2026-11-30 16:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <NXvOf3zl4DgB-JlcZcWAvbuWb0188vJIT62ksFA84ON5lyL7Gay3LqY2i0kzLg_hwQqUw4qGcaWUaAsS93vtWA==@protonmail.internalid>
2026-11-27 12:06 ` Bilal Hashim
2026-11-30 15:53   ` Andreas Hindborg
2026-11-30 16:00     ` Andreas Hindborg [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=87v75es41p.fsf@t14s.mail-host-address-is-not-set \
    --to=a.hindborg@kernel.org \
    --cc=AeeSec@126.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    /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®