Re: [PATCH v3 1/4] mm: declare VMA flags by bit
From: Alice Ryhl
Date: Tue Jan 13 2026 - 14:31:26 EST
On Tue, Jan 13, 2026 at 8:14 PM Lorenzo Stoakes
<lorenzo.stoakes@xxxxxxxxxx> wrote:
>
> On Tue, Jan 13, 2026 at 08:02:17PM +0100, Alice Ryhl wrote:
> > On Tue, Jan 13, 2026 at 7:52 PM Chris Mason <clm@xxxxxxxx> wrote:
> > >
> > > On Tue, 25 Nov 2025 10:00:59 +0000 Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx> wrote:
> > >
> > > [ ... ]
> > > >
> > > > Finally, we update the rust binding helper as now it cannot auto-detect the
> > > > flags at all.
> > > >
> > >
> > > I did a run of all the MM commits from 6.18 to today's linus, and this one
> > > had a copy/paste error. I'd normally just send a patch for this, but in
> > > terms of showing the review output:
> > >
> > > > diff --git a/rust/bindings/bindings_helper.h b/rust/bindings/bindings_helper.h
> > > > index 2e43c66635a2c..4c327db01ca03 100644
> > > > --- a/rust/bindings/bindings_helper.h
> > > > +++ b/rust/bindings/bindings_helper.h
> > > > @@ -108,7 +108,32 @@ const xa_mark_t RUST_CONST_HELPER_XA_PRESENT = XA_PRESENT;
> > >
> > > [ ... ]
> > >
> > > > +const vm_flags_t RUST_CONST_HELPER_VM_MAYREAD = VM_MAYREAD;
> > > > +const vm_flags_t RUST_CONST_HELPER_VM_MAYWRITE = VM_MAYWRITE;
> > > > +const vm_flags_t RUST_CONST_HELPER_VM_MAYEXEC = VM_MAYEXEC;
> > > > +const vm_flags_t RUST_CONST_HELPER_VM_MAYSHARE = VM_MAYEXEC;
> > > ^^^^^^^^^^
> > >
> > > Should this be VM_MAYSHARE instead of VM_MAYEXEC? This appears to be a
> > > copy-paste error that would cause Rust code using VmFlags::MAYSHARE to
> > > get bit 6 (VM_MAYEXEC) instead of bit 7 (VM_MAYSHARE).
> > >
> > > The pattern of the preceding lines shows each constant should reference
> > > its matching flag:
> > >
> > > RUST_CONST_HELPER_VM_MAYREAD = VM_MAYREAD
> > > RUST_CONST_HELPER_VM_MAYWRITE = VM_MAYWRITE
> > > RUST_CONST_HELPER_VM_MAYEXEC = VM_MAYEXEC
> > > RUST_CONST_HELPER_VM_MAYSHARE = VM_MAYSHARE <- expected
> > >
> > > > +const vm_flags_t RUST_CONST_HELPER_VM_PFNMAP = VM_PFNMAP;
> >
> > Uh, good catch. Do you want to send a fix patch?
>
> It's in 6.18 so would need to be a Cc: stable patch with a Fixes etc. rather
> than a fix-patch, unless that's what you meant?
That's what I meant, yeah.
Alice