]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm: abstract set_mask_bits() invocation to mm_types.h to satisfy ARC
authorLorenzo Stoakes <lorenzo.stoakes@oracle.com>
Tue, 26 Aug 2025 11:25:16 +0000 (12:25 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 12 Sep 2025 00:24:53 +0000 (17:24 -0700)
There's some horrible recursive header issue for ARCH whereby you can't
even apparently include very fundamental headers like compiler_types.h in
linux/sched/coredump.h.

So work around this by putting the thing that needs this (use of
ACCESS_PRIVATE()) into mm_types.h which presumably in some fashion avoids
this issue.

This also makes it consistent with __mm_flags_get_dumpable() so is a good
change to make things more consistent and neat anyway.

Link: https://lkml.kernel.org/r/0e7ad263-1ff7-446d-81fe-97cff9c0e7ed@lucifer.local
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202508240502.frw1Krzo-lkp@intel.com/
Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/mm_types.h
include/linux/sched/coredump.h

index 0e001dbad4559d6424b50612c73e33c40591ab70..9d224075d895664db62b8a0c923b0d5a010ef984 100644 (file)
@@ -1255,6 +1255,18 @@ static inline unsigned long __mm_flags_get_word(const struct mm_struct *mm)
        return bitmap_read(bitmap, 0, BITS_PER_LONG);
 }
 
+/*
+ * Update the first system word of mm flags ONLY, applying the specified mask to
+ * it, then setting all flags specified by bits.
+ */
+static inline void __mm_flags_set_mask_bits_word(struct mm_struct *mm,
+               unsigned long mask, unsigned long bits)
+{
+       unsigned long *bitmap = ACCESS_PRIVATE(&mm->_flags, __mm_flags);
+
+       set_mask_bits(bitmap, mask, bits);
+}
+
 #define MM_MT_FLAGS    (MT_FLAGS_ALLOC_RANGE | MT_FLAGS_LOCK_EXTERN | \
                         MT_FLAGS_USE_RCU)
 extern struct mm_struct init_mm;
index 19ecfcceb27ad4bba5123613806b6eac544958dd..b7fafe9990734c7d55b7ddf71e5e61a1291c9ec7 100644 (file)
@@ -2,7 +2,6 @@
 #ifndef _LINUX_SCHED_COREDUMP_H
 #define _LINUX_SCHED_COREDUMP_H
 
-#include <linux/compiler_types.h>
 #include <linux/mm_types.h>
 
 #define SUID_DUMP_DISABLE      0       /* No setuid dumping */
@@ -20,9 +19,7 @@ static inline unsigned long __mm_flags_get_dumpable(struct mm_struct *mm)
 
 static inline void __mm_flags_set_mask_dumpable(struct mm_struct *mm, int value)
 {
-       unsigned long *bitmap = ACCESS_PRIVATE(&mm->_flags, __mm_flags);
-
-       set_mask_bits(bitmap, MMF_DUMPABLE_MASK, value);
+       __mm_flags_set_mask_bits_word(mm, MMF_DUMPABLE_MASK, value);
 }
 
 extern void set_dumpable(struct mm_struct *mm, int value);