Skip to contentSkip to conversation

error[E0425]: cannot find value `VM_MERGEABLE` in crate `bindings`

PATCH kernel test robot 6 participants 15 messages Oct 2, 2025 – Oct 7, 2025

Subsystems (3)
lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   7396732143a22b42bb97710173d598aaf50daa89
commit: 8355c2312fdfe590a296b8abf9414ab7ecb49d1d [13069/13300] mm/ksm: fix flag-dropping behavior in ksm_madvise
config: x86_64-rhel-9.4-rust (https://download.01.org/0day-ci/archive/20251003/[email protected]/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
rustc: rustc 1.88.0 (6b00bc388 2025-06-23)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251003/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> error[E0425]: cannot find value `VM_MERGEABLE` in crate `bindings`

--> rust/kernel/mm/virt.rs:471:49
|
471 | pub const MERGEABLE: vm_flags_t = bindings::VM_MERGEABLE as vm_flags_t;
| ^^^^^^^^^^^^ help: a constant with a similar name exists: MMF_VM_MERGEABLE
|
::: rust/bindings/bindings_generated.rs:7936:1
|
7936 | pub const MMF_VM_MERGEABLE: u32 = 16;
| ------------------------------- similarly named constant MMF_VM_MERGEABLE defined here

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
maintainer
#1 lore raw
Quoted 18 lines · On Fri, 3 Oct 2025 04:52:48 +0800 kernel test robot <[email protected]> wrote:
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   7396732143a22b42bb97710173d598aaf50daa89
commit: 8355c2312fdfe590a296b8abf9414ab7ecb49d1d [13069/13300] mm/ksm: fix flag-dropping behavior in ksm_madvise
config: x86_64-rhel-9.4-rust (https://download.01.org/0day-ci/archive/20251003/[email protected]/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
rustc: rustc 1.88.0 (6b00bc388 2025-06-23)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251003/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

Quoted 1 line
Quoted 1 line

error[E0425]: cannot find value VM_MERGEABLE in crate bindings

--> rust/kernel/mm/virt.rs:471:49
|

Quoted 7 lines
   471  |     pub const MERGEABLE: vm_flags_t = bindings::VM_MERGEABLE as vm_flags_t;
   |                                                 ^^^^^^^^^^^^ help: a constant with a similar name exists: `MMF_VM_MERGEABLE`
   |
   ::: rust/bindings/bindings_generated.rs:7936:1
   |
   7936 | pub const MMF_VM_MERGEABLE: u32 = 16;
   | ------------------------------- similarly named constant `MMF_VM_MERGEABLE` defined here

No idea. Let me cc rust-for-linux.

It's a one-line patch:

include/linux/mm.h renamed from include/linux/mm.h~mm-ksm-fix-flag-dropping-behavior-in-ksm_madvise +1 -1
@@ -296,7 +296,7 @@ extern unsigned int kobjsize(const void
 #define VM_MIXEDMAP	0x10000000	/* Can contain "struct page" and pure PFN pages */
 #define VM_HUGEPAGE	0x20000000	/* MADV_HUGEPAGE marked this vma */
 #define VM_NOHUGEPAGE	0x40000000	/* MADV_NOHUGEPAGE marked this vma */
-#define VM_MERGEABLE	0x80000000	/* KSM may merge identical pages */
+#define VM_MERGEABLE	BIT(31)		/* KSM may merge identical pages */
 
 #ifdef CONFIG_ARCH_USES_HIGH_VMA_FLAGS
 #define VM_HIGH_ARCH_BIT_0	32	/* bit only usable on 64-bit architectures */

_

#2 lore raw
Quoted 8 lines · Andrew Morton

No idea. Let me cc rust-for-linux.

It's a one-line patch:

include/linux/mm.h extern unsigned int kobjsize(const void · line 302

Quoted 8 lines
include/linux/mm.h renamed from include/linux/mm.h~mm-ksm-fix-flag-dropping-behavior-in-ksm_madvise +1 -1
@@ -296,7 +296,7 @@ extern unsigned int kobjsize(const void
 #define VM_MIXEDMAP    0x10000000      /* Can contain "struct page" and pure PFN pages */
 #define VM_HUGEPAGE    0x20000000      /* MADV_HUGEPAGE marked this vma */
 #define VM_NOHUGEPAGE  0x40000000      /* MADV_NOHUGEPAGE marked this vma */
-#define VM_MERGEABLE   0x80000000      /* KSM may merge identical pages */
+#define VM_MERGEABLE   BIT(31)         /* KSM may merge identical pages */
 
 #ifdef CONFIG_ARCH_USES_HIGH_VMA_FLAGS
 #define VM_HIGH_ARCH_BIT_0     32      /* bit only usable on 64-bit architectures */

Yeah, non-trivial macros confuse bindgen.

For the moment, you can do e.g. [1].

Other times, we have changed #defines into enums -- that also works.

I hope that helps.

Cheers,
Miguel

[1]

rust/bindings/bindings_helper.h +2 -0
index 5128e2f12038..918f4c74067b 100644
@@ -106,3 +106,5 @@ const xa_mark_t RUST_CONST_HELPER_XA_PRESENT = XA_PRESENT;
 
 const gfp_t RUST_CONST_HELPER_XA_FLAGS_ALLOC = XA_FLAGS_ALLOC;
 const gfp_t RUST_CONST_HELPER_XA_FLAGS_ALLOC1 = XA_FLAGS_ALLOC1;
+
+const vm_flags_t RUST_CONST_HELPER_VM_MERGEABLE = VM_MERGEABLE;
#3 lore raw
Quoted 15 lines · Miguel Ojeda
Quoted 14 lines · Andrew Morton

No idea. Let me cc rust-for-linux.

It's a one-line patch:

include/linux/mm.h renamed from include/linux/mm.h~mm-ksm-fix-flag-dropping-behavior-in-ksm_madvise +1 -1
@@ -296,7 +296,7 @@ extern unsigned int kobjsize(const void
 #define VM_MIXEDMAP    0x10000000      /* Can contain "struct page" and pure PFN pages */
 #define VM_HUGEPAGE    0x20000000      /* MADV_HUGEPAGE marked this vma */
 #define VM_NOHUGEPAGE  0x40000000      /* MADV_NOHUGEPAGE marked this vma */
-#define VM_MERGEABLE   0x80000000      /* KSM may merge identical pages */
+#define VM_MERGEABLE   BIT(31)         /* KSM may merge identical pages */
 
Quoted 8 lines

include/linux/mm.h extern unsigned int kobjsize(const void · line 302

Quoted 2 lines
include/linux/mm.h renamed from include/linux/mm.h~mm-ksm-fix-flag-dropping-behavior-in-ksm_madvise +0 -0
 #ifdef CONFIG_ARCH_USES_HIGH_VMA_FLAGS
 #define VM_HIGH_ARCH_BIT_0     32      /* bit only usable on 64-bit architectures */

Yeah, non-trivial macros confuse bindgen.

For the moment, you can do e.g. [1].

Other times, we have changed #defines into enums -- that also works.

It seems like bindgen's --clang-macro-fallback argument can avoid the entire class of problems, is there some reason Rust for Linux has avoided that option?

Although, in order to make it work with fixdep, additional somewhat complex build system changes are required. I've got it to almost work locally just now... :)

thanks,
John Hubbard

Quoted 19 lines

I hope that helps.

Cheers,
Miguel

[1]

rust/bindings/bindings_helper.h +2 -0
index 5128e2f12038..918f4c74067b 100644
@@ -106,3 +106,5 @@ const xa_mark_t RUST_CONST_HELPER_XA_PRESENT = XA_PRESENT;
 
 const gfp_t RUST_CONST_HELPER_XA_FLAGS_ALLOC = XA_FLAGS_ALLOC;
 const gfp_t RUST_CONST_HELPER_XA_FLAGS_ALLOC1 = XA_FLAGS_ALLOC1;
+
+const vm_flags_t RUST_CONST_HELPER_VM_MERGEABLE = VM_MERGEABLE;
#4 lore raw
Quoted 8 lines · John Hubbard

It seems like bindgen's --clang-macro-fallback argument can avoid the entire class of problems, is there some reason Rust for Linux has avoided that option?

Although, in order to make it work with fixdep, additional somewhat complex build system changes are required. I've got it to almost work locally just now... :)

I am glad you ask! ;)

We were the ones pushing for the option -- John implemented a workaround that I suggested, with optimizations on performance:

     https://github.com/rust-lang/rust-bindgen/issues/753#issuecomment-1674833380
    https://github.com/rust-lang/rust-bindgen/pull/2779

I think the last time I tried it was early this year -- here is the test patch I had:

https://lore.kernel.org/rust-for-linux/CANiq72m20pom+B9EmWO+91E8fjbMEob3JmvHRQ6UaXe_JmatfA@mail.gmail.com/

It is in my backlog to go back to the option, test it again and so on. In any case, note that we will need to increase the minimum, so it may take some time.

Further context at:

    https://github.com/Rust-for-Linux/linux/issues/353

I hope that clarifies.

Cheers,
Miguel

maintainer
#5 lore raw
In reply to Miguel Ojeda
Quoted 29 lines · On Thu, 2 Oct 2025 23:42:59 +0200 Miguel Ojeda…
Quoted 8 lines · Andrew Morton

No idea. Let me cc rust-for-linux.

It's a one-line patch:

include/linux/mm.h extern unsigned int kobjsize(const void · line 302

Quoted 8 lines
include/linux/mm.h renamed from include/linux/mm.h~mm-ksm-fix-flag-dropping-behavior-in-ksm_madvise +1 -1
@@ -296,7 +296,7 @@ extern unsigned int kobjsize(const void
 #define VM_MIXEDMAP    0x10000000      /* Can contain "struct page" and pure PFN pages */
 #define VM_HUGEPAGE    0x20000000      /* MADV_HUGEPAGE marked this vma */
 #define VM_NOHUGEPAGE  0x40000000      /* MADV_NOHUGEPAGE marked this vma */
-#define VM_MERGEABLE   0x80000000      /* KSM may merge identical pages */
+#define VM_MERGEABLE   BIT(31)         /* KSM may merge identical pages */
 
 #ifdef CONFIG_ARCH_USES_HIGH_VMA_FLAGS
 #define VM_HIGH_ARCH_BIT_0     32      /* bit only usable on 64-bit architectures */

Yeah, non-trivial macros confuse bindgen.

For the moment, you can do e.g. [1].

Other times, we have changed #defines into enums -- that also works.

...

rust/bindings/bindings_helper.h const xa_mark_t RUST_CONST_HELPER_XA_PRESENT = XA_PRESENT; · line 110

Quoted 5 lines
rust/bindings/bindings_helper.h +2 -0
@@ -106,3 +106,5 @@ const xa_mark_t RUST_CONST_HELPER_XA_PRESENT = XA_PRESENT;
 
 const gfp_t RUST_CONST_HELPER_XA_FLAGS_ALLOC = XA_FLAGS_ALLOC;
 const gfp_t RUST_CONST_HELPER_XA_FLAGS_ALLOC1 = XA_FLAGS_ALLOC1;
+
+const vm_flags_t RUST_CONST_HELPER_VM_MERGEABLE = VM_MERGEABLE;

Sorry, this is rather annoying. Rust is breaking the build for a very simple patch. Many developers aren't rust-enabled and probably aren't even able to test a fix - my attempt to get a rust build setup working didn't end happily.

Jakub's patch fixes a kernel crash and needs to be merged into mainline and -stable reasonably soon. But that is now blocked until someone who knows how to fix this error and how to test it gets down and does those things.

Jakub's patch is present in current linux-next. Can someone please send us a fix?

reviewer
#6 lore raw
Quoted 43 lines · Andrew Morton
Quoted 29 lines · On Thu, 2 Oct 2025 23:42:59 +0200 Miguel Ojeda…
Quoted 8 lines · Andrew Morton

No idea. Let me cc rust-for-linux.

It's a one-line patch:

include/linux/mm.h extern unsigned int kobjsize(const void · line 302

Quoted 8 lines
include/linux/mm.h renamed from include/linux/mm.h~mm-ksm-fix-flag-dropping-behavior-in-ksm_madvise +1 -1
@@ -296,7 +296,7 @@ extern unsigned int kobjsize(const void
 #define VM_MIXEDMAP    0x10000000      /* Can contain "struct page" and pure PFN pages */
 #define VM_HUGEPAGE    0x20000000      /* MADV_HUGEPAGE marked this vma */
 #define VM_NOHUGEPAGE  0x40000000      /* MADV_NOHUGEPAGE marked this vma */
-#define VM_MERGEABLE   0x80000000      /* KSM may merge identical pages */
+#define VM_MERGEABLE   BIT(31)         /* KSM may merge identical pages */
 
 #ifdef CONFIG_ARCH_USES_HIGH_VMA_FLAGS
 #define VM_HIGH_ARCH_BIT_0     32      /* bit only usable on 64-bit architectures */

Yeah, non-trivial macros confuse bindgen.

For the moment, you can do e.g. [1].

Other times, we have changed #defines into enums -- that also works.

...

rust/bindings/bindings_helper.h const xa_mark_t RUST_CONST_HELPER_XA_PRESENT = XA_PRESENT; · line 110

Quoted 5 lines
rust/bindings/bindings_helper.h +2 -0
@@ -106,3 +106,5 @@ const xa_mark_t RUST_CONST_HELPER_XA_PRESENT = XA_PRESENT;
 
 const gfp_t RUST_CONST_HELPER_XA_FLAGS_ALLOC = XA_FLAGS_ALLOC;
 const gfp_t RUST_CONST_HELPER_XA_FLAGS_ALLOC1 = XA_FLAGS_ALLOC1;
+
+const vm_flags_t RUST_CONST_HELPER_VM_MERGEABLE = VM_MERGEABLE;

Sorry, this is rather annoying. Rust is breaking the build for a very simple patch. Many developers aren't rust-enabled and probably aren't even able to test a fix - my attempt to get a rust build setup working didn't end happily.

Quoted 7 lines

Jakub's patch fixes a kernel crash and needs to be merged into mainline and -stable reasonably soon. But that is now blocked until someone who knows how to fix this error and how to test it gets down and does those things.

Jakub's patch is present in current linux-next. Can someone please send us a fix?

I don't have my git-send-mail-capable laptop with me right now, but the diff Miguel shared that adds one line to rust/bindings/bindings_helper.h will fix this build error.

Alice

#7 lore raw
In reply to Andrew Morton
Quoted 6 lines · Andrew Morton

Sorry, this is rather annoying. Rust is breaking the build for a very simple patch. Many developers aren't rust-enabled and probably aren't even able to test a fix - my attempt to get a rust build setup working didn't end happily.

Quoted 7 lines

Jakub's patch fixes a kernel crash and needs to be merged into mainline and -stable reasonably soon. But that is now blocked until someone who knows how to fix this error and how to test it gets down and does those things.

Jakub's patch is present in current linux-next. Can someone please send us a fix?

I am not sure I follow -- the diff I gave you should work.

If you have a branch you want me to test and/or give you a formal patch on top of that or similar, I can do that.

Cheers,
Miguel

maintainer
#8 lore raw
Quoted 12 lines · On Fri, 3 Oct 2025 00:39:16 +0200 Miguel Ojeda…
Quoted 11 lines · Andrew Morton

Sorry, this is rather annoying. Rust is breaking the build for a very simple patch. Many developers aren't rust-enabled and probably aren't even able to test a fix - my attempt to get a rust build setup working didn't end happily.

Jakub's patch fixes a kernel crash and needs to be merged into mainline and -stable reasonably soon. But that is now blocked until someone who knows how to fix this error and how to test it gets down and does those things.

Quoted 4 lines
Quoted 2 lines

Jakub's patch is present in current linux-next. Can someone please send us a fix?

I am not sure I follow -- the diff I gave you should work.

It would be nice if someone were to test it!

Quoted 2 lines

If you have a branch you want me to test and/or give you a formal patch on top of that or similar, I can do that.

Thanks. As mentioned, today's linux-next is where the problem is being observed.

I'm queueing the below as a fixup against Jakub's original. This should appear in tomorrow's linux-next. Or the day after - it's a timezone thing.

From: Andrew Morton <[email protected]>
Subject: mm-ksm-fix-flag-dropping-behavior-in-ksm_madvise-fix
Date: Thu Oct 2 03:37:47 PM PDT 2025

Rust bindgen wasn't able to handle the BIT() macro. Add a helper (from Miguel) to fix this.

---

 rust/bindings/bindings_helper.h |    1 +
 1 file changed, 1 insertion(+)
rust/bindings/bindings_helper.h renamed from rust/bindings/bindings_helper.h~mm-ksm-fix-flag-dropping-behavior-in-ksm_madvise-fix +1 -0
@@ -99,3 +99,4 @@ const xa_mark_t RUST_CONST_HELPER_XA_PRE
 
 const gfp_t RUST_CONST_HELPER_XA_FLAGS_ALLOC = XA_FLAGS_ALLOC;
 const gfp_t RUST_CONST_HELPER_XA_FLAGS_ALLOC1 = XA_FLAGS_ALLOC1;
+const vm_flags_t RUST_CONST_HELPER_VM_MERGEABLE = VM_MERGEABLE;

_

reviewer Tested-by
#9 lore raw
Quoted 59 lines · Andrew Morton
Quoted 12 lines · On Fri, 3 Oct 2025 00:39:16 +0200 Miguel Ojeda…
Quoted 11 lines · Andrew Morton

Sorry, this is rather annoying. Rust is breaking the build for a very simple patch. Many developers aren't rust-enabled and probably aren't even able to test a fix - my attempt to get a rust build setup working didn't end happily.

Jakub's patch fixes a kernel crash and needs to be merged into mainline and -stable reasonably soon. But that is now blocked until someone who knows how to fix this error and how to test it gets down and does those things.

Quoted 4 lines
Quoted 2 lines

Jakub's patch is present in current linux-next. Can someone please send us a fix?

I am not sure I follow -- the diff I gave you should work.

It would be nice if someone were to test it!

Quoted 2 lines

If you have a branch you want me to test and/or give you a formal patch on top of that or similar, I can do that.

Thanks. As mentioned, today's linux-next is where the problem is being observed.

I'm queueing the below as a fixup against Jakub's original. This should appear in tomorrow's linux-next. Or the day after - it's a timezone thing.

From: Andrew Morton <[email protected]>
Subject: mm-ksm-fix-flag-dropping-behavior-in-ksm_madvise-fix
Date: Thu Oct 2 03:37:47 PM PDT 2025

Rust bindgen wasn't able to handle the BIT() macro. Add a helper (from Miguel) to fix this.

---

 rust/bindings/bindings_helper.h |    1 +
 1 file changed, 1 insertion(+)

rust/bindings/bindings_helper.h const xa_mark_t RUST_CONST_HELPER_XA_PRE · line 102

Quoted 4 lines
rust/bindings/bindings_helper.h renamed from rust/bindings/bindings_helper.h~mm-ksm-fix-flag-dropping-behavior-in-ksm_madvise-fix +1 -0
@@ -99,3 +99,4 @@ const xa_mark_t RUST_CONST_HELPER_XA_PRE
 
 const gfp_t RUST_CONST_HELPER_XA_FLAGS_ALLOC = XA_FLAGS_ALLOC;
 const gfp_t RUST_CONST_HELPER_XA_FLAGS_ALLOC1 = XA_FLAGS_ALLOC1;
+const vm_flags_t RUST_CONST_HELPER_VM_MERGEABLE = VM_MERGEABLE;
#10 lore raw
In reply to Andrew Morton
Quoted 2 lines · Andrew Morton

It would be nice if someone were to test it!

I did...

(but on a different branch, by applying your diff, reproducing the issue, and then my diff)

Cheers,
Miguel

Tested-by
#11 lore raw
In reply to Andrew Morton
Quoted 3 lines · Andrew Morton

Thanks. As mentioned, today's linux-next is where the problem is being observed.

You're welcome -- yeah, I see it in my one of my CIs (the rust.docs.kernel.org that runs more often), but really, I think we should help you enable the Rust build -- you take patches for many things across the tree, so that would be very useful...

Nowadays it should be fairly easy to enable, i.e. even the packages from some distros work.

I have build-tested the patch on top of mm-hotfixes-unstable now too (since I don't see it applied yet), so please feel free to pick tags like:

Or even:

I test every day -next, so I will see this in my 20251002 run and will notice if it doesn't go away.

Cheers,
Miguel

Tested-by
#12 lore raw
In reply to Andrew Morton
Quoted 2 lines · Andrew Morton
Quoted 1 line · On Fri, 3 Oct 2025 00:39:16 +0200 Miguel Ojeda…

On Fri, Oct 3, 2025 at 12:27 AM Andrew Morton <[email protected]> wrote:

...

Quoted 31 lines

From: Andrew Morton <[email protected]>
Subject: mm-ksm-fix-flag-dropping-behavior-in-ksm_madvise-fix
Date: Thu Oct 2 03:37:47 PM PDT 2025

Rust bindgen wasn't able to handle the BIT() macro. Add a helper (from Miguel) to fix this.

---

 rust/bindings/bindings_helper.h |    1 +
 1 file changed, 1 insertion(+)
rust/bindings/bindings_helper.h renamed from rust/bindings/bindings_helper.h~mm-ksm-fix-flag-dropping-behavior-in-ksm_madvise-fix +1 -0
@@ -99,3 +99,4 @@ const xa_mark_t RUST_CONST_HELPER_XA_PRE
 
 const gfp_t RUST_CONST_HELPER_XA_FLAGS_ALLOC = XA_FLAGS_ALLOC;
 const gfp_t RUST_CONST_HELPER_XA_FLAGS_ALLOC1 = XA_FLAGS_ALLOC1;
+const vm_flags_t RUST_CONST_HELPER_VM_MERGEABLE = VM_MERGEABLE;
Quoted 1 line

_

Yes, this fixes the build on my system too, so:

...of course, we'll have to undo this later, as part of the fix for the Rust for Linux build system, to handle BIT() and similar macros in bindgen.

thanks,

Signature · 1 line
John Hubbard
#13 lore raw
Quoted 39 lines · John Hubbard
Quoted 2 lines · Andrew Morton
Quoted 1 line · On Fri, 3 Oct 2025 00:39:16 +0200 Miguel Ojeda…

On Fri, Oct 3, 2025 at 12:27 AM Andrew Morton <[email protected]> wrote:

...

Quoted 31 lines

From: Andrew Morton <[email protected]>
Subject: mm-ksm-fix-flag-dropping-behavior-in-ksm_madvise-fix
Date: Thu Oct 2 03:37:47 PM PDT 2025

Rust bindgen wasn't able to handle the BIT() macro. Add a helper (from Miguel) to fix this.

---

 rust/bindings/bindings_helper.h |    1 +
 1 file changed, 1 insertion(+)
rust/bindings/bindings_helper.h renamed from rust/bindings/bindings_helper.h~mm-ksm-fix-flag-dropping-behavior-in-ksm_madvise-fix +1 -0
@@ -99,3 +99,4 @@ const xa_mark_t RUST_CONST_HELPER_XA_PRE
 
 const gfp_t RUST_CONST_HELPER_XA_FLAGS_ALLOC = XA_FLAGS_ALLOC;
 const gfp_t RUST_CONST_HELPER_XA_FLAGS_ALLOC1 = XA_FLAGS_ALLOC1;
+const vm_flags_t RUST_CONST_HELPER_VM_MERGEABLE = VM_MERGEABLE;
Quoted 1 line

_

Yes, this fixes the build on my system too, so:

Quoted 6 lines

...of course, we'll have to undo this later, as part of the fix for the Rust for Linux build system, to handle BIT() and similar macros in bindgen.

Hi,

sorry for the issues this has caused. We're also changing the other defines to BIT() for consistency, it was applied to mm-new in [1]. I assume this will have the same breaking effect. Not sure what is the solution - whether to wait for the fix mentioned by John or add similar defintions to a/rust/bindings/bindings_helper.h for all consts?

[1]: https://lore.kernel.org/all/[email protected]/

Kind Regards,
Jakub

Amazon Web Services Development Center Germany GmbH Tamara-Danz-Str. 13
10243 Berlin
Geschaeftsfuehrung: Christian Schlaeger Eingetragen am Amtsgericht Charlottenburg unter HRB 257764 B
Sitz: Berlin
Ust-ID: DE 365 538 597

reviewer
#14 lore raw
Quoted 50 lines · Jakub Acs
Quoted 39 lines · John Hubbard
Quoted 2 lines · Andrew Morton
Quoted 1 line · On Fri, 3 Oct 2025 00:39:16 +0200 Miguel Ojeda…

On Fri, Oct 3, 2025 at 12:27 AM Andrew Morton <[email protected]> wrote:

...

Quoted 31 lines

From: Andrew Morton <[email protected]>
Subject: mm-ksm-fix-flag-dropping-behavior-in-ksm_madvise-fix
Date: Thu Oct 2 03:37:47 PM PDT 2025

Rust bindgen wasn't able to handle the BIT() macro. Add a helper (from Miguel) to fix this.

---

 rust/bindings/bindings_helper.h |    1 +
 1 file changed, 1 insertion(+)
rust/bindings/bindings_helper.h renamed from rust/bindings/bindings_helper.h~mm-ksm-fix-flag-dropping-behavior-in-ksm_madvise-fix +1 -0
@@ -99,3 +99,4 @@ const xa_mark_t RUST_CONST_HELPER_XA_PRE
 
 const gfp_t RUST_CONST_HELPER_XA_FLAGS_ALLOC = XA_FLAGS_ALLOC;
 const gfp_t RUST_CONST_HELPER_XA_FLAGS_ALLOC1 = XA_FLAGS_ALLOC1;
+const vm_flags_t RUST_CONST_HELPER_VM_MERGEABLE = VM_MERGEABLE;
Quoted 1 line

_

Yes, this fixes the build on my system too, so:

Quoted 6 lines

...of course, we'll have to undo this later, as part of the fix for the Rust for Linux build system, to handle BIT() and similar macros in bindgen.

Hi,

Quoted 7 lines

sorry for the issues this has caused. We're also changing the other defines to BIT() for consistency, it was applied to mm-new in [1]. I assume this will have the same breaking effect. Not sure what is the solution - whether to wait for the fix mentioned by John or add similar defintions to a/rust/bindings/bindings_helper.h for all consts?

[1]: https://lore.kernel.org/all/[email protected]/

You have two options: either add all of the constants to bindings_helper.h, or use an enum similar to commit 3634783be125 ("binder: use enum for binder ioctls").

Regarding John's mention, don't expect that for a while. It requires support in bindgen, which is shipped by your distribution, not Linux. Therefore, it takes time for improvements to become available to everyone.

Alice