Rust for Linux List
 help / color / mirror / Atom feed
From: Andreas Hindborg <a.hindborg@kernel.org>
To: Yuan Tan <ytan089@ucr.edu>,
	ojeda@kernel.org, boqun@kernel.org,
	rust-for-linux@vger.kernel.org
Cc: zhiyunq@cs.ucr.edu, ardalan@uci.edu, pgovind2@uci.edu,
	dzueck@uci.edu, Yuan Tan <ytan089@ucr.edu>
Subject: Re: [PATCH 0/1] rust: block: mq: make GenDisk Send impl sound
Date: Mon, 08 Jun 2026 12:14:29 +0200	[thread overview]
Message-ID: <87zf15gwze.fsf@kernel.org> (raw)
In-Reply-To: <87pl25i47i.fsf@kernel.org>

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

> Hi,
>
> Yuan Tan <ytan089@ucr.edu> writes:
>
>> Hi Linux kernel maintainers,
>>
>> We are developing a tool called FerroLens to detect potential unsound
>> behavior in Rust code in the Linux kernel. FerroLens reported the following
>> bug in rust/kernel/gendisk.rs.
>>
>> Gendisk is marked as Send although the fields it contains may not be.
>> Specifically, the QueueData held in the raw gendisk pointer may not be safe
>> to send across threads. Therefore, sending the Gendisk from one thread to
>> another and dropping on a different thread may cause unsound behavior.
>>
>> Additionally, Gendisk contains an Arc<TagSet<T>>. This Arc would be Send
>> and Sync if the underlying TagSet<T> were Send and Sync. But this is not
>> explicitly derived, although it can be, since the API does not modify the
>> TagSet.
>
> Thanks for the patch. The `GenDisk` `Send` fix looks correct to me.

Actually, I think we need a bound on the Arc as well:

  unsafe impl<T> Send for GenDisk<T>
  where
      T: Operations,
      T::QueueData: Send,
      Arc<TagSet<T>>: Send,
  {
  }

Best regards,
Andreas Hindborg



  reply	other threads:[~2026-06-08 10:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-05  4:49 [PATCH 0/1] rust: block: mq: make GenDisk Send impl sound Yuan Tan
2026-06-05  4:49 ` [PATCH 1/1] " Yuan Tan
2026-06-05 12:04 ` [PATCH 0/1] " Andreas Hindborg
2026-06-08 10:14   ` Andreas Hindborg [this message]
2026-06-05 13:50 ` 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=87zf15gwze.fsf@kernel.org \
    --to=a.hindborg@kernel.org \
    --cc=ardalan@uci.edu \
    --cc=boqun@kernel.org \
    --cc=dzueck@uci.edu \
    --cc=ojeda@kernel.org \
    --cc=pgovind2@uci.edu \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=ytan089@ucr.edu \
    --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