Commit 36d57ac4a818cb4aa3edbdf63ad2ebc31106f925
Committed by
Linus Torvalds
1 parent
32605a1815
Exists in
master
and in
39 other branches
[PATCH] auxiliary vector cleanups
The size of auxiliary vector is fixed at 42 in linux/sched.h. But it isn't very obvious when looking at linux/elf.h. This patch adds AT_VECTOR_SIZE so that we can change it if necessary when a new vector is added. Because of include file ordering problems, doing this necessitated the extraction of the AT_* symbols into a standalone header file. Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 32 changed files with 196 additions and 83 deletions Side-by-side Diff
- include/asm-alpha/auxvec.h
- include/asm-alpha/elf.h
- include/asm-arm/auxvec.h
- include/asm-arm26/auxvec.h
- include/asm-cris/auxvec.h
- include/asm-frv/auxvec.h
- include/asm-h8300/auxvec.h
- include/asm-i386/auxvec.h
- include/asm-i386/elf.h
- include/asm-ia64/auxvec.h
- include/asm-ia64/elf.h
- include/asm-m32r/auxvec.h
- include/asm-m68k/auxvec.h
- include/asm-m68knommu/auxvec.h
- include/asm-mips/auxvec.h
- include/asm-parisc/auxvec.h
- include/asm-ppc/auxvec.h
- include/asm-ppc/elf.h
- include/asm-ppc64/auxvec.h
- include/asm-ppc64/elf.h
- include/asm-s390/auxvec.h
- include/asm-sh/auxvec.h
- include/asm-sh64/auxvec.h
- include/asm-sparc/auxvec.h
- include/asm-sparc64/auxvec.h
- include/asm-um/auxvec.h
- include/asm-v850/auxvec.h
- include/asm-x86_64/auxvec.h
- include/asm-xtensa/auxvec.h
- include/linux/auxvec.h
- include/linux/elf.h
- include/linux/sched.h
include/asm-alpha/auxvec.h
1 | +#ifndef __ASM_ALPHA_AUXVEC_H | |
2 | +#define __ASM_ALPHA_AUXVEC_H | |
3 | + | |
4 | +/* Reserve these numbers for any future use of a VDSO. */ | |
5 | +#if 0 | |
6 | +#define AT_SYSINFO 32 | |
7 | +#define AT_SYSINFO_EHDR 33 | |
8 | +#endif | |
9 | + | |
10 | +/* More complete cache descriptions than AT_[DIU]CACHEBSIZE. If the | |
11 | + value is -1, then the cache doesn't exist. Otherwise: | |
12 | + | |
13 | + bit 0-3: Cache set-associativity; 0 means fully associative. | |
14 | + bit 4-7: Log2 of cacheline size. | |
15 | + bit 8-31: Size of the entire cache >> 8. | |
16 | + bit 32-63: Reserved. | |
17 | +*/ | |
18 | + | |
19 | +#define AT_L1I_CACHESHAPE 34 | |
20 | +#define AT_L1D_CACHESHAPE 35 | |
21 | +#define AT_L2_CACHESHAPE 36 | |
22 | +#define AT_L3_CACHESHAPE 37 | |
23 | + | |
24 | +#endif /* __ASM_ALPHA_AUXVEC_H */ |
include/asm-alpha/elf.h
1 | 1 | #ifndef __ASM_ALPHA_ELF_H |
2 | 2 | #define __ASM_ALPHA_ELF_H |
3 | 3 | |
4 | +#include <asm/auxvec.h> | |
5 | + | |
4 | 6 | /* Special values for the st_other field in the symbol table. */ |
5 | 7 | |
6 | 8 | #define STO_ALPHA_NOPV 0x80 |
... | ... | @@ -141,26 +143,6 @@ |
141 | 143 | ? (amask(AMASK_BWX) ? "ev5" : "ev56") \ |
142 | 144 | : amask (AMASK_CIX) ? "ev6" : "ev67"); \ |
143 | 145 | }) |
144 | - | |
145 | -/* Reserve these numbers for any future use of a VDSO. */ | |
146 | -#if 0 | |
147 | -#define AT_SYSINFO 32 | |
148 | -#define AT_SYSINFO_EHDR 33 | |
149 | -#endif | |
150 | - | |
151 | -/* More complete cache descriptions than AT_[DIU]CACHEBSIZE. If the | |
152 | - value is -1, then the cache doesn't exist. Otherwise: | |
153 | - | |
154 | - bit 0-3: Cache set-associativity; 0 means fully associative. | |
155 | - bit 4-7: Log2 of cacheline size. | |
156 | - bit 8-31: Size of the entire cache >> 8. | |
157 | - bit 32-63: Reserved. | |
158 | -*/ | |
159 | - | |
160 | -#define AT_L1I_CACHESHAPE 34 | |
161 | -#define AT_L1D_CACHESHAPE 35 | |
162 | -#define AT_L2_CACHESHAPE 36 | |
163 | -#define AT_L3_CACHESHAPE 37 | |
164 | 146 | |
165 | 147 | #ifdef __KERNEL__ |
166 | 148 |
include/asm-arm/auxvec.h
include/asm-arm26/auxvec.h
include/asm-cris/auxvec.h
include/asm-frv/auxvec.h
include/asm-h8300/auxvec.h
include/asm-i386/auxvec.h
include/asm-i386/elf.h
... | ... | @@ -9,6 +9,7 @@ |
9 | 9 | #include <asm/user.h> |
10 | 10 | #include <asm/processor.h> |
11 | 11 | #include <asm/system.h> /* for savesegment */ |
12 | +#include <asm/auxvec.h> | |
12 | 13 | |
13 | 14 | #include <linux/utsname.h> |
14 | 15 | |
... | ... | @@ -108,13 +109,6 @@ |
108 | 109 | but that could change... */ |
109 | 110 | |
110 | 111 | #define ELF_PLATFORM (system_utsname.machine) |
111 | - | |
112 | -/* | |
113 | - * Architecture-neutral AT_ values in 0-17, leave some room | |
114 | - * for more of them, start the x86-specific ones at 32. | |
115 | - */ | |
116 | -#define AT_SYSINFO 32 | |
117 | -#define AT_SYSINFO_EHDR 33 | |
118 | 112 | |
119 | 113 | #ifdef __KERNEL__ |
120 | 114 | #define SET_PERSONALITY(ex, ibcs2) do { } while (0) |
include/asm-ia64/auxvec.h
1 | +#ifndef _ASM_IA64_AUXVEC_H | |
2 | +#define _ASM_IA64_AUXVEC_H | |
3 | + | |
4 | +/* | |
5 | + * Architecture-neutral AT_ values are in the range 0-17. Leave some room for more of | |
6 | + * them, start the architecture-specific ones at 32. | |
7 | + */ | |
8 | +#define AT_SYSINFO 32 | |
9 | +#define AT_SYSINFO_EHDR 33 | |
10 | + | |
11 | +#endif /* _ASM_IA64_AUXVEC_H */ |
include/asm-ia64/elf.h
... | ... | @@ -12,6 +12,7 @@ |
12 | 12 | |
13 | 13 | #include <asm/fpu.h> |
14 | 14 | #include <asm/page.h> |
15 | +#include <asm/auxvec.h> | |
15 | 16 | |
16 | 17 | /* |
17 | 18 | * This is used to ensure we don't load something for the wrong architecture. |
... | ... | @@ -176,13 +177,6 @@ |
176 | 177 | implementation specific libraries for optimization. Not terribly |
177 | 178 | relevant until we have real hardware to play with... */ |
178 | 179 | #define ELF_PLATFORM NULL |
179 | - | |
180 | -/* | |
181 | - * Architecture-neutral AT_ values are in the range 0-17. Leave some room for more of | |
182 | - * them, start the architecture-specific ones at 32. | |
183 | - */ | |
184 | -#define AT_SYSINFO 32 | |
185 | -#define AT_SYSINFO_EHDR 33 | |
186 | 180 | |
187 | 181 | #ifdef __KERNEL__ |
188 | 182 | #define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX) |
include/asm-m32r/auxvec.h
include/asm-m68k/auxvec.h
include/asm-m68knommu/auxvec.h
include/asm-mips/auxvec.h
include/asm-parisc/auxvec.h
include/asm-ppc/auxvec.h
1 | +#ifndef __PPC_AUXVEC_H | |
2 | +#define __PPC_AUXVEC_H | |
3 | + | |
4 | +/* | |
5 | + * We need to put in some extra aux table entries to tell glibc what | |
6 | + * the cache block size is, so it can use the dcbz instruction safely. | |
7 | + */ | |
8 | +#define AT_DCACHEBSIZE 19 | |
9 | +#define AT_ICACHEBSIZE 20 | |
10 | +#define AT_UCACHEBSIZE 21 | |
11 | +/* A special ignored type value for PPC, for glibc compatibility. */ | |
12 | +#define AT_IGNOREPPC 22 | |
13 | + | |
14 | +#endif |
include/asm-ppc/elf.h
... | ... | @@ -7,6 +7,7 @@ |
7 | 7 | #include <asm/types.h> |
8 | 8 | #include <asm/ptrace.h> |
9 | 9 | #include <asm/cputable.h> |
10 | +#include <asm/auxvec.h> | |
10 | 11 | |
11 | 12 | /* PowerPC relocations defined by the ABIs */ |
12 | 13 | #define R_PPC_NONE 0 |
... | ... | @@ -121,16 +122,6 @@ |
121 | 122 | #define ELF_PLATFORM (NULL) |
122 | 123 | |
123 | 124 | #define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) |
124 | - | |
125 | -/* | |
126 | - * We need to put in some extra aux table entries to tell glibc what | |
127 | - * the cache block size is, so it can use the dcbz instruction safely. | |
128 | - */ | |
129 | -#define AT_DCACHEBSIZE 19 | |
130 | -#define AT_ICACHEBSIZE 20 | |
131 | -#define AT_UCACHEBSIZE 21 | |
132 | -/* A special ignored type value for PPC, for glibc compatibility. */ | |
133 | -#define AT_IGNOREPPC 22 | |
134 | 125 | |
135 | 126 | extern int dcache_bsize; |
136 | 127 | extern int icache_bsize; |
include/asm-ppc64/auxvec.h
1 | +#ifndef __PPC64_AUXVEC_H | |
2 | +#define __PPC64_AUXVEC_H | |
3 | + | |
4 | +/* | |
5 | + * We need to put in some extra aux table entries to tell glibc what | |
6 | + * the cache block size is, so it can use the dcbz instruction safely. | |
7 | + */ | |
8 | +#define AT_DCACHEBSIZE 19 | |
9 | +#define AT_ICACHEBSIZE 20 | |
10 | +#define AT_UCACHEBSIZE 21 | |
11 | +/* A special ignored type value for PPC, for glibc compatibility. */ | |
12 | +#define AT_IGNOREPPC 22 | |
13 | + | |
14 | +/* The vDSO location. We have to use the same value as x86 for glibc's | |
15 | + * sake :-) | |
16 | + */ | |
17 | +#define AT_SYSINFO_EHDR 33 | |
18 | + | |
19 | +#endif /* __PPC64_AUXVEC_H */ |
include/asm-ppc64/elf.h
... | ... | @@ -4,6 +4,7 @@ |
4 | 4 | #include <asm/types.h> |
5 | 5 | #include <asm/ptrace.h> |
6 | 6 | #include <asm/cputable.h> |
7 | +#include <asm/auxvec.h> | |
7 | 8 | |
8 | 9 | /* PowerPC relocations defined by the ABIs */ |
9 | 10 | #define R_PPC_NONE 0 |
... | ... | @@ -236,21 +237,6 @@ |
236 | 237 | (exec_stk != EXSTACK_DISABLE_X) : 0) |
237 | 238 | |
238 | 239 | #endif |
239 | - | |
240 | -/* | |
241 | - * We need to put in some extra aux table entries to tell glibc what | |
242 | - * the cache block size is, so it can use the dcbz instruction safely. | |
243 | - */ | |
244 | -#define AT_DCACHEBSIZE 19 | |
245 | -#define AT_ICACHEBSIZE 20 | |
246 | -#define AT_UCACHEBSIZE 21 | |
247 | -/* A special ignored type value for PPC, for glibc compatibility. */ | |
248 | -#define AT_IGNOREPPC 22 | |
249 | - | |
250 | -/* The vDSO location. We have to use the same value as x86 for glibc's | |
251 | - * sake :-) | |
252 | - */ | |
253 | -#define AT_SYSINFO_EHDR 33 | |
254 | 240 | |
255 | 241 | extern int dcache_bsize; |
256 | 242 | extern int icache_bsize; |
include/asm-s390/auxvec.h
include/asm-sh/auxvec.h
include/asm-sh64/auxvec.h
include/asm-sparc/auxvec.h
include/asm-sparc64/auxvec.h
include/asm-um/auxvec.h
include/asm-v850/auxvec.h
include/asm-x86_64/auxvec.h
include/asm-xtensa/auxvec.h
include/linux/auxvec.h
1 | +#ifndef _LINUX_AUXVEC_H | |
2 | +#define _LINUX_AUXVEC_H | |
3 | + | |
4 | +#include <asm/auxvec.h> | |
5 | + | |
6 | +/* Symbolic values for the entries in the auxiliary table | |
7 | + put on the initial stack */ | |
8 | +#define AT_NULL 0 /* end of vector */ | |
9 | +#define AT_IGNORE 1 /* entry should be ignored */ | |
10 | +#define AT_EXECFD 2 /* file descriptor of program */ | |
11 | +#define AT_PHDR 3 /* program headers for program */ | |
12 | +#define AT_PHENT 4 /* size of program header entry */ | |
13 | +#define AT_PHNUM 5 /* number of program headers */ | |
14 | +#define AT_PAGESZ 6 /* system page size */ | |
15 | +#define AT_BASE 7 /* base address of interpreter */ | |
16 | +#define AT_FLAGS 8 /* flags */ | |
17 | +#define AT_ENTRY 9 /* entry point of program */ | |
18 | +#define AT_NOTELF 10 /* program is not ELF */ | |
19 | +#define AT_UID 11 /* real uid */ | |
20 | +#define AT_EUID 12 /* effective uid */ | |
21 | +#define AT_GID 13 /* real gid */ | |
22 | +#define AT_EGID 14 /* effective gid */ | |
23 | +#define AT_PLATFORM 15 /* string identifying CPU for optimizations */ | |
24 | +#define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */ | |
25 | +#define AT_CLKTCK 17 /* frequency at which times() increments */ | |
26 | + | |
27 | +#define AT_SECURE 23 /* secure mode boolean */ | |
28 | + | |
29 | +#define AT_VECTOR_SIZE 42 /* Size of auxiliary table. */ | |
30 | + | |
31 | +#endif /* _LINUX_AUXVEC_H */ |
include/linux/elf.h
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 | #define _LINUX_ELF_H |
3 | 3 | |
4 | 4 | #include <linux/types.h> |
5 | +#include <linux/auxvec.h> | |
5 | 6 | #include <asm/elf.h> |
6 | 7 | |
7 | 8 | #ifndef elf_read_implies_exec |
... | ... | @@ -157,29 +158,6 @@ |
157 | 158 | #define ELF32_ST_TYPE(x) ELF_ST_TYPE(x) |
158 | 159 | #define ELF64_ST_BIND(x) ELF_ST_BIND(x) |
159 | 160 | #define ELF64_ST_TYPE(x) ELF_ST_TYPE(x) |
160 | - | |
161 | -/* Symbolic values for the entries in the auxiliary table | |
162 | - put on the initial stack */ | |
163 | -#define AT_NULL 0 /* end of vector */ | |
164 | -#define AT_IGNORE 1 /* entry should be ignored */ | |
165 | -#define AT_EXECFD 2 /* file descriptor of program */ | |
166 | -#define AT_PHDR 3 /* program headers for program */ | |
167 | -#define AT_PHENT 4 /* size of program header entry */ | |
168 | -#define AT_PHNUM 5 /* number of program headers */ | |
169 | -#define AT_PAGESZ 6 /* system page size */ | |
170 | -#define AT_BASE 7 /* base address of interpreter */ | |
171 | -#define AT_FLAGS 8 /* flags */ | |
172 | -#define AT_ENTRY 9 /* entry point of program */ | |
173 | -#define AT_NOTELF 10 /* program is not ELF */ | |
174 | -#define AT_UID 11 /* real uid */ | |
175 | -#define AT_EUID 12 /* effective uid */ | |
176 | -#define AT_GID 13 /* real gid */ | |
177 | -#define AT_EGID 14 /* effective gid */ | |
178 | -#define AT_PLATFORM 15 /* string identifying CPU for optimizations */ | |
179 | -#define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */ | |
180 | -#define AT_CLKTCK 17 /* frequency at which times() increments */ | |
181 | - | |
182 | -#define AT_SECURE 23 /* secure mode boolean */ | |
183 | 161 | |
184 | 162 | typedef struct dynamic{ |
185 | 163 | Elf32_Sword d_tag; |
include/linux/sched.h
... | ... | @@ -35,6 +35,8 @@ |
35 | 35 | #include <linux/topology.h> |
36 | 36 | #include <linux/seccomp.h> |
37 | 37 | |
38 | +#include <linux/auxvec.h> /* For AT_VECTOR_SIZE */ | |
39 | + | |
38 | 40 | struct exec_domain; |
39 | 41 | |
40 | 42 | /* |
... | ... | @@ -261,7 +263,7 @@ |
261 | 263 | mm_counter_t _rss; |
262 | 264 | mm_counter_t _anon_rss; |
263 | 265 | |
264 | - unsigned long saved_auxv[42]; /* for /proc/PID/auxv */ | |
266 | + unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ | |
265 | 267 | |
266 | 268 | unsigned dumpable:2; |
267 | 269 | cpumask_t cpu_vm_mask; |