Skip to contentSkip to conversation

define-auxiliary-vector-size-at_vector_size.patch added to -mm tree

DISCUSSION H. J. Lu 2 participants 5 messages Jul 27, 2005 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

H. J. Lu

author
#1 lore raw
Quoted 5 lines · On Tue, Jul 26, 2005 at 02:46:20PM -0700, [email protected] wrote:

The patch titled

Define auxiliary vector size, AT_VECTOR_SIZE

Quoted 9 lines

has been added to the -mm tree. Its filename is

define-auxiliary-vector-size-at_vector_size.patch

Patches currently in -mm which might be from [email protected] are

define-auxiliary-vector-size-at_vector_size.patch

My patch breaks x86_64 build. This patch will fix x86_64 build. I am also enclosing the updated full patch.

H.J.
----

arch/x86_64/ia32/ia32_binfmt.c renamed from arch/x86_64/ia32/ia32_binfmt.c.auxv +1 -3
@@ -9,6 +9,7 @@
 #include <linux/config.h> 
 #include <linux/stddef.h>
 #include <linux/rwsem.h>
+#define __ASM_X86_64_ELF_H 1
 #include <linux/sched.h>
 #include <linux/compat.h>
 #include <linux/string.h>
@@ -181,10 +182,7 @@ struct elf_prpsinfo
 
 #define user user32
 
-#define __ASM_X86_64_ELF_H 1
 #define elf_read_implies_exec(ex, have_pt_gnu_stack)	(!(have_pt_gnu_stack))
-//#include <asm/ia32.h>
-#include <linux/elf.h>
 
 typedef struct user_i387_ia32_struct elf_fpregset_t;
 typedef struct user32_fxsr_struct elf_fpxregset_t;
arch/x86_64/ia32/ia32_binfmt.c renamed from arch/x86_64/ia32/ia32_binfmt.c.auxv +1 -3
@@ -9,6 +9,7 @@
 #include <linux/config.h> 
 #include <linux/stddef.h>
 #include <linux/rwsem.h>
+#define __ASM_X86_64_ELF_H 1
 #include <linux/sched.h>
 #include <linux/compat.h>
 #include <linux/string.h>
@@ -181,10 +182,7 @@ struct elf_prpsinfo
 
 #define user user32
 
-#define __ASM_X86_64_ELF_H 1
 #define elf_read_implies_exec(ex, have_pt_gnu_stack)	(!(have_pt_gnu_stack))
-//#include <asm/ia32.h>
-#include <linux/elf.h>
 
 typedef struct user_i387_ia32_struct elf_fpregset_t;
 typedef struct user32_fxsr_struct elf_fpxregset_t;
include/linux/elf.h renamed from include/linux/elf.h.auxv +2 -0
@@ -181,6 +181,8 @@ typedef __s64	Elf64_Sxword;
 
 #define AT_SECURE 23   /* secure mode boolean */
 
+#define AT_VECTOR_SIZE  42 /* Size of auxiliary table.  */
+
 typedef struct dynamic{
   Elf32_Sword d_tag;
   union{
include/linux/sched.h renamed from include/linux/sched.h.auxv +3 -1
@@ -35,6 +35,8 @@
 #include <linux/topology.h>
 #include <linux/seccomp.h>
 
+#include <linux/elf.h>	/* For AT_VECTOR_SIZE */
+
 struct exec_domain;
 
 /*
@@ -243,7 +245,7 @@ struct mm_struct {
 	mm_counter_t _rss;
 	mm_counter_t _anon_rss;
 
-	unsigned long saved_auxv[42]; /* for /proc/PID/auxv */
+	unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */
 
 	unsigned dumpable:1;
 	cpumask_t cpu_vm_mask;
#2 lore raw
Quoted 3 lines · H. J. Lu

My patch breaks x86_64 build. This patch will fix x86_64 build. I am
also enclosing the updated full patch.

It now breaks ppc64

include/asm/elf.h: In function `dump_task_regs':
include/asm/elf.h:177: error: dereferencing pointer to incomplete type

That's because pt_regs isn't known, because sched.h is including elf.h before pt_regs gets defined. This is a pretty fragile area I'm afraid.

author
#3 lore raw
Quoted 5 lines · Andrew Morton
Quoted 3 lines · H. J. Lu

My patch breaks x86_64 build. This patch will fix x86_64 build. I am
also enclosing the updated full patch.

Quoted 7 lines

It now breaks ppc64

include/asm/elf.h: In function `dump_task_regs':
include/asm/elf.h:177: error: dereferencing pointer to incomplete type

That's because pt_regs isn't known, because sched.h is including elf.h before pt_regs gets defined. This is a pretty fragile area I'm afraid.

Should we creat a new header file like auxvector.h? Auxiliary isn't ELF specific anyway.

H.J.

#4 lore raw
Quoted 9 lines · H. J. Lu
Quoted 7 lines · Andrew Morton
Quoted 3 lines · H. J. Lu

My patch breaks x86_64 build. This patch will fix x86_64 build. I am
also enclosing the updated full patch.

It now breaks ppc64

Quoted 8 lines
Quoted 5 lines

include/asm/elf.h: In function `dump_task_regs':
include/asm/elf.h:177: error: dereferencing pointer to incomplete type

That's because pt_regs isn't known, because sched.h is including elf.h before pt_regs gets defined. This is a pretty fragile area I'm afraid.

Should we creat a new header file like auxvector.h? Auxiliary isn't ELF specific anyway.

That would work.

author
#5 lore raw
Quoted 13 lines · Andrew Morton
Quoted 12 lines · H. J. Lu
Quoted 10 lines · Andrew Morton
Quoted 3 lines · H. J. Lu

My patch breaks x86_64 build. This patch will fix x86_64 build. I am
also enclosing the updated full patch.

It now breaks ppc64

include/asm/elf.h: In function `dump_task_regs':
include/asm/elf.h:177: error: dereferencing pointer to incomplete type

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

That's because pt_regs isn't known, because sched.h is including elf.h before pt_regs gets defined. This is a pretty fragile area I'm afraid.

Should we creat a new header file like auxvector.h? Auxiliary isn't ELF specific anyway.

That would work.

How about this patch?

H.J.

include/asm-alpha/auxvec.h renamed from include/asm-alpha/auxvec.h.auxv +24 -0
@@ -0,0 +1,24 @@
+#ifndef __ASM_ALPHA_AUXVEC_H
+#define __ASM_ALPHA_AUXVEC_H
+
+/* Reserve these numbers for any future use of a VDSO.  */
+#if 0
+#define AT_SYSINFO		32
+#define AT_SYSINFO_EHDR		33
+#endif
+
+/* More complete cache descriptions than AT_[DIU]CACHEBSIZE.  If the
+   value is -1, then the cache doesn't exist.  Otherwise:
+
+      bit 0-3:	  Cache set-associativity; 0 means fully associative.
+      bit 4-7:	  Log2 of cacheline size.
+      bit 8-31:	  Size of the entire cache >> 8.
+      bit 32-63:  Reserved.
+*/
+
+#define AT_L1I_CACHESHAPE	34
+#define AT_L1D_CACHESHAPE	35
+#define AT_L2_CACHESHAPE	36
+#define AT_L3_CACHESHAPE	37
+
+#endif /* __ASM_ALPHA_AUXVEC_H */
include/asm-alpha/elf.h renamed from include/asm-alpha/elf.h.auxv +2 -20
@@ -1,6 +1,8 @@
 #ifndef __ASM_ALPHA_ELF_H
 #define __ASM_ALPHA_ELF_H
 
+#include <asm/auxvec.h>
+
 /* Special values for the st_other field in the symbol table.  */
 
 #define STO_ALPHA_NOPV		0x80
@@ -142,26 +144,6 @@ extern int dump_elf_task_fp(elf_fpreg_t 
 	: amask (AMASK_CIX) ? "ev6" : "ev67");	\
 })
 
-/* Reserve these numbers for any future use of a VDSO.  */
-#if 0
-#define AT_SYSINFO		32
-#define AT_SYSINFO_EHDR		33
-#endif
-
-/* More complete cache descriptions than AT_[DIU]CACHEBSIZE.  If the
-   value is -1, then the cache doesn't exist.  Otherwise:
-
-      bit 0-3:	  Cache set-associativity; 0 means fully associative.
-      bit 4-7:	  Log2 of cacheline size.
-      bit 8-31:	  Size of the entire cache >> 8.
-      bit 32-63:  Reserved.
-*/
-
-#define AT_L1I_CACHESHAPE	34
-#define AT_L1D_CACHESHAPE	35
-#define AT_L2_CACHESHAPE	36
-#define AT_L3_CACHESHAPE	37
-
 #ifdef __KERNEL__
 
 #define SET_PERSONALITY(EX, IBCS2)				\
include/asm-arm/auxvec.h renamed from include/asm-arm/auxvec.h.auxv +4 -0
@@ -0,0 +1,4 @@
+#ifndef __ASMARM_AUXVEC_H
+#define __ASMARM_AUXVEC_H
+
+#endif
include/asm-arm26/auxvec.h renamed from include/asm-arm26/auxvec.h.auxv +4 -0
@@ -0,0 +1,4 @@
+#ifndef __ASMARM_AUXVEC_H
+#define __ASMARM_AUXVEC_H
+
+#endif
include/asm-cris/auxvec.h renamed from include/asm-cris/auxvec.h.auxv +4 -0
@@ -0,0 +1,4 @@
+#ifndef __ASMCRIS_AUXVEC_H
+#define __ASMCRIS_AUXVEC_H
+
+#endif
include/asm-h8300/auxvec.h renamed from include/asm-h8300/auxvec.h.auxv +4 -0
@@ -0,0 +1,4 @@
+#ifndef __ASMH8300_AUXVEC_H
+#define __ASMH8300_AUXVEC_H
+
+#endif
include/asm-i386/auxvec.h renamed from include/asm-i386/auxvec.h.auxv +11 -0
@@ -0,0 +1,11 @@
+#ifndef __ASMi386_AUXVEC_H
+#define __ASMi386_AUXVEC_H
+
+/*
+ * Architecture-neutral AT_ values in 0-17, leave some room
+ * for more of them, start the x86-specific ones at 32.
+ */
+#define AT_SYSINFO		32
+#define AT_SYSINFO_EHDR		33
+
+#endif
include/asm-i386/elf.h renamed from include/asm-i386/elf.h.auxv +1 -7
@@ -9,6 +9,7 @@
 #include <asm/user.h>
 #include <asm/processor.h>
 #include <asm/system.h>		/* for savesegment */
+#include <asm/auxvec.h>
 
 #include <linux/utsname.h>
 
@@ -109,13 +110,6 @@ typedef struct user_fxsr_struct elf_fpxr
 
 #define ELF_PLATFORM  (system_utsname.machine)
 
-/*
- * Architecture-neutral AT_ values in 0-17, leave some room
- * for more of them, start the x86-specific ones at 32.
- */
-#define AT_SYSINFO		32
-#define AT_SYSINFO_EHDR		33
-
 #ifdef __KERNEL__
 #define SET_PERSONALITY(ex, ibcs2) do { } while (0)
 
include/asm-ia64/auxvec.h renamed from include/asm-ia64/auxvec.h.auxv +11 -0
@@ -0,0 +1,11 @@
+#ifndef _ASM_IA64_AUXVEC_H
+#define _ASM_IA64_AUXVEC_H
+
+/*
+ * Architecture-neutral AT_ values are in the range 0-17.  Leave some room for more of
+ * them, start the architecture-specific ones at 32.
+ */
+#define AT_SYSINFO	32
+#define AT_SYSINFO_EHDR	33
+
+#endif /* _ASM_IA64_AUXVEC_H */
include/asm-ia64/elf.h renamed from include/asm-ia64/elf.h.auxv +1 -7
@@ -12,6 +12,7 @@
 
 #include <asm/fpu.h>
 #include <asm/page.h>
+#include <asm/auxvec.h>
 
 /*
  * This is used to ensure we don't load something for the wrong architecture.
@@ -177,13 +178,6 @@ extern void ia64_elf_core_copy_regs (str
    relevant until we have real hardware to play with... */
 #define ELF_PLATFORM	NULL
 
-/*
- * Architecture-neutral AT_ values are in the range 0-17.  Leave some room for more of
- * them, start the architecture-specific ones at 32.
- */
-#define AT_SYSINFO	32
-#define AT_SYSINFO_EHDR	33
-
 #ifdef __KERNEL__
 #define SET_PERSONALITY(ex, ibcs2)	set_personality(PER_LINUX)
 #define elf_read_implies_exec(ex, executable_stack)					\
include/asm-m32r/auxvec.h renamed from include/asm-m32r/auxvec.h.auxv +4 -0
@@ -0,0 +1,4 @@
+#ifndef _ASM_M32R__AUXVEC_H
+#define _ASM_M32R__AUXVEC_H
+
+#endif  /* _ASM_M32R__AUXVEC_H */
include/asm-m68k/auxvec.h renamed from include/asm-m68k/auxvec.h.auxv +4 -0
@@ -0,0 +1,4 @@
+#ifndef __ASMm68k_AUXVEC_H
+#define __ASMm68k_AUXVEC_H
+
+#endif
include/asm-m68knommu/auxvec.h renamed from include/asm-m68knommu/auxvec.h.auxv +4 -0
@@ -0,0 +1,4 @@
+#ifndef __ASMm68k_AUXVEC_H
+#define __ASMm68k_AUXVEC_H
+
+#endif
include/asm-mips/auxvec.h renamed from include/asm-mips/auxvec.h.auxv +4 -0
@@ -0,0 +1,4 @@
+#ifndef _ASM_AUXVEC_H
+#define _ASM_AUXVEC_H
+
+#endif /* _ASM_AUXVEC_H */
include/asm-parisc/auxvec.h renamed from include/asm-parisc/auxvec.h.auxv +4 -0
@@ -0,0 +1,4 @@
+#ifndef __ASMPARISC_AUXVEC_H
+#define __ASMPARISC_AUXVEC_H
+
+#endif
include/asm-ppc/auxvec.h renamed from include/asm-ppc/auxvec.h.auxv +14 -0
@@ -0,0 +1,14 @@
+#ifndef __PPC_AUXVEC_H
+#define __PPC_AUXVEC_H
+
+/*
+ * We need to put in some extra aux table entries to tell glibc what
+ * the cache block size is, so it can use the dcbz instruction safely.
+ */
+#define AT_DCACHEBSIZE		19
+#define AT_ICACHEBSIZE		20
+#define AT_UCACHEBSIZE		21
+/* A special ignored type value for PPC, for glibc compatibility.  */
+#define AT_IGNOREPPC		22
+
+#endif
include/asm-ppc/elf.h renamed from include/asm-ppc/elf.h.auxv +1 -10
@@ -7,6 +7,7 @@
 #include <asm/types.h>
 #include <asm/ptrace.h>
 #include <asm/cputable.h>
+#include <asm/auxvec.h>
 
 /* PowerPC relocations defined by the ABIs */
 #define R_PPC_NONE		0
@@ -122,16 +123,6 @@ extern int dump_task_fpu(struct task_str
 
 #define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
 
-/*
- * We need to put in some extra aux table entries to tell glibc what
- * the cache block size is, so it can use the dcbz instruction safely.
- */
-#define AT_DCACHEBSIZE		19
-#define AT_ICACHEBSIZE		20
-#define AT_UCACHEBSIZE		21
-/* A special ignored type value for PPC, for glibc compatibility.  */
-#define AT_IGNOREPPC		22
-
 extern int dcache_bsize;
 extern int icache_bsize;
 extern int ucache_bsize;
include/asm-ppc64/auxvec.h renamed from include/asm-ppc64/auxvec.h.auxv +19 -0
@@ -0,0 +1,19 @@
+#ifndef __PPC64_AUXVEC_H
+#define __PPC64_AUXVEC_H
+
+/*
+ * We need to put in some extra aux table entries to tell glibc what
+ * the cache block size is, so it can use the dcbz instruction safely.
+ */
+#define AT_DCACHEBSIZE		19
+#define AT_ICACHEBSIZE		20
+#define AT_UCACHEBSIZE		21
+/* A special ignored type value for PPC, for glibc compatibility.  */
+#define AT_IGNOREPPC		22
+
+/* The vDSO location. We have to use the same value as x86 for glibc's
+ * sake :-)
+ */
+#define AT_SYSINFO_EHDR		33
+
+#endif /* __PPC64_AUXVEC_H */
include/asm-ppc64/elf.h renamed from include/asm-ppc64/elf.h.auxv +1 -15
@@ -4,6 +4,7 @@
 #include <asm/types.h>
 #include <asm/ptrace.h>
 #include <asm/cputable.h>
+#include <asm/auxvec.h>
 
 /* PowerPC relocations defined by the ABIs */
 #define R_PPC_NONE		0
@@ -237,21 +238,6 @@ do {								\
 
 #endif
 
-/*
- * We need to put in some extra aux table entries to tell glibc what
- * the cache block size is, so it can use the dcbz instruction safely.
- */
-#define AT_DCACHEBSIZE		19
-#define AT_ICACHEBSIZE		20
-#define AT_UCACHEBSIZE		21
-/* A special ignored type value for PPC, for glibc compatibility.  */
-#define AT_IGNOREPPC		22
-
-/* The vDSO location. We have to use the same value as x86 for glibc's
- * sake :-)
- */
-#define AT_SYSINFO_EHDR		33
-
 extern int dcache_bsize;
 extern int icache_bsize;
 extern int ucache_bsize;
include/asm-s390/auxvec.h renamed from include/asm-s390/auxvec.h.auxv +4 -0
@@ -0,0 +1,4 @@
+#ifndef __ASMS390_AUXVEC_H
+#define __ASMS390_AUXVEC_H
+
+#endif
include/asm-sh/auxvec.h renamed from include/asm-sh/auxvec.h.auxv +4 -0
@@ -0,0 +1,4 @@
+#ifndef __ASM_SH_AUXVEC_H
+#define __ASM_SH_AUXVEC_H
+
+#endif /* __ASM_SH_AUXVEC_H */
include/asm-sh64/auxvec.h renamed from include/asm-sh64/auxvec.h.auxv +4 -0
@@ -0,0 +1,4 @@
+#ifndef __ASM_SH64_AUXVEC_H
+#define __ASM_SH64_AUXVEC_H
+
+#endif /* __ASM_SH64_AUXVEC_H */
include/asm-sparc/auxvec.h renamed from include/asm-sparc/auxvec.h.auxv +4 -0
@@ -0,0 +1,4 @@
+#ifndef __ASMSPARC_AUXVEC_H
+#define __ASMSPARC_AUXVEC_H
+
+#endif /* !(__ASMSPARC_AUXVEC_H) */
include/asm-sparc64/auxvec.h renamed from include/asm-sparc64/auxvec.h.auxv +4 -0
@@ -0,0 +1,4 @@
+#ifndef __ASM_SPARC64_AUXVEC_H
+#define __ASM_SPARC64_AUXVEC_H
+
+#endif /* !(__ASM_SPARC64_AUXVEC_H) */
include/asm-um/auxvec.h renamed from include/asm-um/auxvec.h.auxv +4 -0
@@ -0,0 +1,4 @@
+#ifndef __UM_AUXVEC_H
+#define __UM_AUXVEC_H
+
+#endif
include/asm-v850/auxvec.h renamed from include/asm-v850/auxvec.h.auxv +4 -0
@@ -0,0 +1,4 @@
+#ifndef __V850_AUXVEC_H__
+#define __V850_AUXVEC_H__
+
+#endif /* __V850_AUXVEC_H__ */
include/asm-x86_64/auxvec.h renamed from include/asm-x86_64/auxvec.h.auxv +4 -0
@@ -0,0 +1,4 @@
+#ifndef __ASM_X86_64_AUXVEC_H
+#define __ASM_X86_64_AUXVEC_H
+
+#endif
include/linux/auxvec.h renamed from include/linux/auxvec.h.auxv +31 -0
@@ -0,0 +1,31 @@
+#ifndef _LINUX_AUXVEC_H
+#define _LINUX_AUXVEC_H
+
+#include <asm/auxvec.h>
+
+/* Symbolic values for the entries in the auxiliary table
+   put on the initial stack */
+#define AT_NULL   0	/* end of vector */
+#define AT_IGNORE 1	/* entry should be ignored */
+#define AT_EXECFD 2	/* file descriptor of program */
+#define AT_PHDR   3	/* program headers for program */
+#define AT_PHENT  4	/* size of program header entry */
+#define AT_PHNUM  5	/* number of program headers */
+#define AT_PAGESZ 6	/* system page size */
+#define AT_BASE   7	/* base address of interpreter */
+#define AT_FLAGS  8	/* flags */
+#define AT_ENTRY  9	/* entry point of program */
+#define AT_NOTELF 10	/* program is not ELF */
+#define AT_UID    11	/* real uid */
+#define AT_EUID   12	/* effective uid */
+#define AT_GID    13	/* real gid */
+#define AT_EGID   14	/* effective gid */
+#define AT_PLATFORM 15  /* string identifying CPU for optimizations */
+#define AT_HWCAP  16    /* arch dependent hints at CPU capabilities */
+#define AT_CLKTCK 17	/* frequency at which times() increments */
+
+#define AT_SECURE 23   /* secure mode boolean */
+
+#define AT_VECTOR_SIZE  42 /* Size of auxiliary table.  */
+
+#endif /* _LINUX_AUXVEC_H */
include/linux/elf.h renamed from include/linux/elf.h.auxv +1 -23
@@ -2,6 +2,7 @@
 #define _LINUX_ELF_H
 
 #include <linux/types.h>
+#include <linux/auxvec.h>
 #include <asm/elf.h>
 
 #ifndef elf_read_implies_exec
@@ -158,29 +159,6 @@ typedef __s64	Elf64_Sxword;
 #define ELF64_ST_BIND(x)	ELF_ST_BIND(x)
 #define ELF64_ST_TYPE(x)	ELF_ST_TYPE(x)
 
-/* Symbolic values for the entries in the auxiliary table
-   put on the initial stack */
-#define AT_NULL   0	/* end of vector */
-#define AT_IGNORE 1	/* entry should be ignored */
-#define AT_EXECFD 2	/* file descriptor of program */
-#define AT_PHDR   3	/* program headers for program */
-#define AT_PHENT  4	/* size of program header entry */
-#define AT_PHNUM  5	/* number of program headers */
-#define AT_PAGESZ 6	/* system page size */
-#define AT_BASE   7	/* base address of interpreter */
-#define AT_FLAGS  8	/* flags */
-#define AT_ENTRY  9	/* entry point of program */
-#define AT_NOTELF 10	/* program is not ELF */
-#define AT_UID    11	/* real uid */
-#define AT_EUID   12	/* effective uid */
-#define AT_GID    13	/* real gid */
-#define AT_EGID   14	/* effective gid */
-#define AT_PLATFORM 15  /* string identifying CPU for optimizations */
-#define AT_HWCAP  16    /* arch dependent hints at CPU capabilities */
-#define AT_CLKTCK 17	/* frequency at which times() increments */
-
-#define AT_SECURE 23   /* secure mode boolean */
-
 typedef struct dynamic{
   Elf32_Sword d_tag;
   union{
include/linux/sched.h renamed from include/linux/sched.h.auxv +3 -1
@@ -35,6 +35,8 @@
 #include <linux/topology.h>
 #include <linux/seccomp.h>
 
+#include <linux/auxvec.h>	/* For AT_VECTOR_SIZE */
+
 struct exec_domain;
 
 /*
@@ -243,7 +245,7 @@ struct mm_struct {
 	mm_counter_t _rss;
 	mm_counter_t _anon_rss;
 
-	unsigned long saved_auxv[42]; /* for /proc/PID/auxv */
+	unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */
 
 	unsigned dumpable:1;
 	cpumask_t cpu_vm_mask;