Bug#394385: PAGE_SIZE is incorrectly exposed
# affects libc6-dev on other archs as well
reassign 394385 glibc
found 394385 2.3.6.ds1-4
tags 394385 patch
thanks
On Fri, Oct 20, 2006 at 04:16:35PM -0600, Troy Heber wrote:
> PAGE_SIZE is no longer exposed to user space in <asm/page.h>, see
> Bug#393023. However, <sys/user.h> defines NBPG to be PAGE_SIZE which
> prevents packages that use it form building gdb (Bug#394381) and crash
> (Bug#394267).
Attached is a patch which replaces the hard-coded values of PAGE_SIZE with
calls to sysconf(_SC_PAGESIZE) in sys/user.h, for all architectures. This
is somewhat pre-emptive since PAGE_SIZE is still defined on a number of
these archs, but there's no sense in having to fix the same bug again later
the next time the kernel changes...
Thanks,
--
Steve Langasek Give me a lever long enough and a Free OS
Debian Developer to set it on, and I can move the world.
vorlon@debian.org http://www.debian.org/
Index: glibc-2.3.6/sysdeps/unix/sysv/linux/alpha/sys/user.h
===================================================================
--- glibc-2.3.6.orig/sysdeps/unix/sysv/linux/alpha/sys/user.h 2006-10-20 20:40:59.000000000 -0700
+++ glibc-2.3.6/sysdeps/unix/sysv/linux/alpha/sys/user.h 2006-10-20 20:41:11.000000000 -0700
@@ -41,7 +41,7 @@
char u_comm[32]; /* user command name */
};
-#define NBPG PAGE_SIZE
+#define NBPG sysconf(_SC_PAGESIZE)
#define UPAGES 1
#define HOST_TEXT_START_ADDR (u.start_code)
#define HOST_DATA_START_ADDR (u.start_data)
Index: glibc-2.3.6/sysdeps/unix/sysv/linux/i386/sys/user.h
===================================================================
--- glibc-2.3.6.orig/sysdeps/unix/sysv/linux/i386/sys/user.h 2006-10-20 20:41:45.000000000 -0700
+++ glibc-2.3.6/sysdeps/unix/sysv/linux/i386/sys/user.h 2006-10-20 20:42:35.000000000 -0700
@@ -92,8 +92,7 @@
int u_debugreg [8];
};
-#define PAGE_SHIFT 12
-#define PAGE_SIZE (1UL << PAGE_SHIFT)
+#define PAGE_SIZE sysconf(_SC_PAGESIZE)
#define PAGE_MASK (~(PAGE_SIZE-1))
#define NBPG PAGE_SIZE
#define UPAGES 1
Index: glibc-2.3.6/sysdeps/unix/sysv/linux/ia64/sys/user.h
===================================================================
--- glibc-2.3.6.orig/sysdeps/unix/sysv/linux/ia64/sys/user.h 2006-10-20 20:46:09.000000000 -0700
+++ glibc-2.3.6/sysdeps/unix/sysv/linux/ia64/sys/user.h 2006-10-20 20:46:16.000000000 -0700
@@ -45,7 +45,7 @@
char u_comm[32]; /* User command name. */
};
-#define NBPG PAGE_SIZE
+#define NBPG sysconf(_SC_PAGESIZE)
#define UPAGES 1
#define HOST_TEXT_START_ADDR (u.start_code)
#define HOST_DATA_START_ADDR (u.start_data)
Index: glibc-2.3.6/sysdeps/unix/sysv/linux/mips/sys/user.h
===================================================================
--- glibc-2.3.6.orig/sysdeps/unix/sysv/linux/mips/sys/user.h 2006-10-20 20:45:07.000000000 -0700
+++ glibc-2.3.6/sysdeps/unix/sysv/linux/mips/sys/user.h 2006-10-20 20:47:24.000000000 -0700
@@ -207,8 +207,7 @@
#endif
-#define PAGE_SHIFT 12
-#define PAGE_SIZE (1UL << PAGE_SHIFT)
+#define PAGE_SIZE sysconf(_SC_PAGESIZE)
#define PAGE_MASK (~(PAGE_SIZE-1))
#define NBPG PAGE_SIZE
#define UPAGES 1
Index: glibc-2.3.6/sysdeps/unix/sysv/linux/x86_64/sys/user.h
===================================================================
--- glibc-2.3.6.orig/sysdeps/unix/sysv/linux/x86_64/sys/user.h 2006-10-20 20:46:43.000000000 -0700
+++ glibc-2.3.6/sysdeps/unix/sysv/linux/x86_64/sys/user.h 2006-10-20 20:47:15.000000000 -0700
@@ -164,8 +164,7 @@
};
#endif /* __WORDSIZE */
-#define PAGE_SHIFT 12
-#define PAGE_SIZE (1UL << PAGE_SHIFT)
+#define PAGE_SIZE sysconf(_SC_PAGESIZE)
#define PAGE_MASK (~(PAGE_SIZE-1))
#define NBPG PAGE_SIZE
#define UPAGES 1
Reply to: