musl libc defines PAGE_SIZE as a signed int in <limits.h>
under _GNU_SOURCE, conflicting with kernel headers that
require an unsigned 64-bit definition:

  include/x86/processor.h:372:9: warning: 'PAGE_SIZE' redefined
  /usr/include/x86_64-linux-musl/limits.h:97:9: note: this is the
  location of the previous definition

Undefine PAGE_SIZE immediately after the #include <limits.h> to
prevent musl's definition from leaking into kernel headers. This
is a no-op on glibc, which does not define PAGE_SIZE in <limits.h>.

Reported-by: Aqib Faruqui <[email protected]>
Link: https://lore.kernel.org/kvm/[email protected]/
Signed-off-by: Hisam Mehboob <[email protected]>
---
 tools/include/linux/bitops.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/include/linux/bitops.h b/tools/include/linux/bitops.h
index b4e4cd071f8c..62117a77ceb5 100644
--- a/tools/include/linux/bitops.h
+++ b/tools/include/linux/bitops.h
@@ -4,6 +4,7 @@
 
 #include <asm/types.h>
 #include <limits.h>
+#undef PAGE_SIZE
 #ifndef __WORDSIZE
 #define __WORDSIZE (__SIZEOF_LONG__ * 8)
 #endif
-- 
2.51.0


Reply via email to