rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yury Norov <yury.norov@gmail.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: "Burak Emir" <bqe@google.com>, "Kees Cook" <kees@kernel.org>,
	"Rasmus Villemoes" <linux@rasmusvillemoes.dk>,
	"Viresh Kumar" <viresh.kumar@linaro.org>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Gustavo A . R . Silva" <gustavoars@kernel.org>,
	"Carlos LLama" <cmllamas@google.com>,
	"Pekka Ristola" <pekkarr@protonmail.com>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-hardening@vger.kernel.org,
	"Philip Li" <philip.li@intel.com>
Subject: Re: [PATCH v15 0/5] rust: adds Bitmap API, ID pool and bindings
Date: Fri, 5 Sep 2025 17:48:42 -0400	[thread overview]
Message-ID: <aLtautgAVKdqNv2R@yury> (raw)
In-Reply-To: <aLrjNze2_L_vAnWX@yury>

(Actually adding Philip in the list.)

On Fri, Sep 05, 2025 at 09:18:50AM -0400, Yury ooNorov wrote:
> + Philip Li <philip.li@intel.com>
> 
> On Fri, Sep 05, 2025 at 11:29:22AM +0200, Miguel Ojeda wrote:
> > On Thu, Sep 4, 2025 at 8:02 PM Yury Norov <yury.norov@gmail.com> wrote:
> > >
> > > Added in bitmap-for-next for testing. Thanks!
> > 
> > linux-next breaks with CONFIG_RUST_BITMAP_HARDENED=y:
> > 
> >      error[E0425]: cannot find function `owned_bitmap_out_of_bounds`
> > in this scope
> >        --> rust/kernel/bitmap.rs:484:1
> >         |
> >     484 | #[kunit_tests(rust_kernel_bitmap)]
> >         | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
> > 
> > because the proc macro doesn't support `cfg`s (moving it below
> > `#[test]` wouldn't work either). I have filled:
> > 
> >     https://github.com/Rust-for-Linux/linux/issues/1185
> > 
> > so that we don't forget about it.
> > 
> > Meanwhile, I would recommend e.g. moving the `cfg` inside the
> > function, something like:
> > 
> >     diff --git a/rust/kernel/bitmap.rs b/rust/kernel/bitmap.rs
> >     index 6e0824579781..2f00e91e9c35 100644
> >     --- a/rust/kernel/bitmap.rs
> >     +++ b/rust/kernel/bitmap.rs
> >     @@ -551,18 +551,21 @@ fn bitmap_set_clear_find() -> Result<(), AllocError> {
> >              Ok(())
> >          }
> > 
> >     -    #[cfg(not(CONFIG_RUST_BITMAP_HARDENED))]
> >          #[test]
> >          fn owned_bitmap_out_of_bounds() -> Result<(), AllocError> {
> >     -        let mut b = BitmapVec::new(128, GFP_KERNEL)?;
> >     +        #[cfg(not(CONFIG_RUST_BITMAP_HARDENED))]
> >     +        {
> >     +            let mut b = BitmapVec::new(128, GFP_KERNEL)?;
> >     +
> >     +            b.set_bit(2048);
> >     +            b.set_bit_atomic(2048);
> >     +            b.clear_bit(2048);
> >     +            b.clear_bit_atomic(2048);
> >     +            assert_eq!(None, b.next_bit(2048));
> >     +            assert_eq!(None, b.next_zero_bit(2048));
> >     +            assert_eq!(None, b.last_bit());
> >     +        }
> > 
> >     -        b.set_bit(2048);
> >     -        b.set_bit_atomic(2048);
> >     -        b.clear_bit(2048);
> >     -        b.clear_bit_atomic(2048);
> >     -        assert_eq!(None, b.next_bit(2048));
> >     -        assert_eq!(None, b.next_zero_bit(2048));
> >     -        assert_eq!(None, b.last_bit());
> >              Ok(())
> >          }
> 
> Thanks for the testing, Miguel! I've folded-in your fix and added
> your co-developed-by tag. Please let me know if it doesn't work for
> you.
> 
> Philip, is it possible to add CONFIG_RUST_BITMAP_HARDENED=y/n in your
> testing too?
> 
> Thanks,
> Yury

  parent reply	other threads:[~2025-09-05 21:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-04 16:50 [PATCH v15 0/5] rust: adds Bitmap API, ID pool and bindings Burak Emir
2025-09-04 16:50 ` [PATCH v15 1/5] rust: add bindings for bitmap.h Burak Emir
2025-09-04 16:50 ` [PATCH v15 2/5] rust: add bindings for bitops.h Burak Emir
2025-09-04 16:50 ` [PATCH v15 3/5] rust: add bitmap API Burak Emir
2025-09-04 16:50 ` [PATCH v15 4/5] rust: add find_bit_benchmark_rust module Burak Emir
2025-09-04 16:50 ` [PATCH v15 5/5] rust: add dynamic ID pool abstraction for bitmap Burak Emir
2025-09-04 18:02 ` [PATCH v15 0/5] rust: adds Bitmap API, ID pool and bindings Yury Norov
2025-09-05  9:29   ` Miguel Ojeda
2025-09-05 13:18     ` Yury ooNorov
2025-09-05 15:56       ` Miguel Ojeda
2025-09-05 21:51         ` Yury Norov
2025-09-05 21:48       ` Yury Norov [this message]
2025-09-06  0:46         ` Philip Li
2025-09-06 14:24           ` Yury Norov
2025-09-06  9:05     ` Dan Carpenter
2025-09-06  9:18     ` Dan Carpenter
2025-09-06 14:27       ` Yury Norov
2025-09-08  7:25         ` Burak Emir
2025-09-08  9:24         ` Miguel Ojeda
2025-09-08 10:03           ` Dan Carpenter

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=aLtautgAVKdqNv2R@yury \
    --to=yury.norov@gmail.com \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=bqe@google.com \
    --cc=cmllamas@google.com \
    --cc=gary@garyguo.net \
    --cc=gustavoars@kernel.org \
    --cc=kees@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=ojeda@kernel.org \
    --cc=pekkarr@protonmail.com \
    --cc=philip.li@intel.com \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    --cc=viresh.kumar@linaro.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;
as well as URLs for NNTP newsgroup(s).