(Actually adding Philip in the list.)
On Fri, Sep 05, 2025 at 09:18:50AM -0400, Yury ooNorov wrote:
> + Philip Li <[email protected]>
>
> On Fri, Sep 05, 2025 at 11:29:22AM +0200, Miguel Ojeda wrote:
> > On Thu, Sep 4, 2025 at 8:02 PM Yury Norov <[email protected]> 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