Linux Audio

Check our new training course

Loading...
v3.5.6
  1/*
  2 * (C) Copyright 2002 Linus Torvalds
  3 * Portions based on the vdso-randomization code from exec-shield:
  4 * Copyright(C) 2005-2006, Red Hat, Inc., Ingo Molnar
  5 *
  6 * This file contains the needed initializations to support sysenter.
  7 */
  8
  9#include <linux/init.h>
 10#include <linux/smp.h>
 11#include <linux/thread_info.h>
 12#include <linux/sched.h>
 13#include <linux/gfp.h>
 14#include <linux/string.h>
 15#include <linux/elf.h>
 16#include <linux/mm.h>
 17#include <linux/err.h>
 18#include <linux/module.h>
 
 19
 20#include <asm/cpufeature.h>
 21#include <asm/msr.h>
 22#include <asm/pgtable.h>
 23#include <asm/unistd.h>
 24#include <asm/elf.h>
 25#include <asm/tlbflush.h>
 26#include <asm/vdso.h>
 27#include <asm/proto.h>
 28
 29enum {
 30	VDSO_DISABLED = 0,
 31	VDSO_ENABLED = 1,
 32	VDSO_COMPAT = 2,
 33};
 34
 35#ifdef CONFIG_COMPAT_VDSO
 36#define VDSO_DEFAULT	VDSO_COMPAT
 37#else
 38#define VDSO_DEFAULT	VDSO_ENABLED
 39#endif
 40
 41#ifdef CONFIG_X86_64
 42#define vdso_enabled			sysctl_vsyscall32
 43#define arch_setup_additional_pages	syscall32_setup_pages
 
 44#endif
 45
 46/*
 47 * This is the difference between the prelinked addresses in the vDSO images
 48 * and the VDSO_HIGH_BASE address where CONFIG_COMPAT_VDSO places the vDSO
 49 * in the user address space.
 50 */
 51#define VDSO_ADDR_ADJUST	(VDSO_HIGH_BASE - (unsigned long)VDSO32_PRELINK)
 52
 53/*
 54 * Should the kernel map a VDSO page into processes and pass its
 55 * address down to glibc upon exec()?
 56 */
 57unsigned int __read_mostly vdso_enabled = VDSO_DEFAULT;
 58
 59static int __init vdso_setup(char *s)
 60{
 61	vdso_enabled = simple_strtoul(s, NULL, 0);
 62
 
 
 
 63	return 1;
 64}
 65
 66/*
 67 * For consistency, the argument vdso32=[012] affects the 32-bit vDSO
 68 * behavior on both 64-bit and 32-bit kernels.
 69 * On 32-bit kernels, vdso=[012] means the same thing.
 70 */
 71__setup("vdso32=", vdso_setup);
 72
 73#ifdef CONFIG_X86_32
 74__setup_param("vdso=", vdso32_setup, vdso_setup, 0);
 75
 76EXPORT_SYMBOL_GPL(vdso_enabled);
 77#endif
 78
 79static __init void reloc_symtab(Elf32_Ehdr *ehdr,
 80				unsigned offset, unsigned size)
 81{
 82	Elf32_Sym *sym = (void *)ehdr + offset;
 83	unsigned nsym = size / sizeof(*sym);
 84	unsigned i;
 85
 86	for(i = 0; i < nsym; i++, sym++) {
 87		if (sym->st_shndx == SHN_UNDEF ||
 88		    sym->st_shndx == SHN_ABS)
 89			continue;  /* skip */
 90
 91		if (sym->st_shndx > SHN_LORESERVE) {
 92			printk(KERN_INFO "VDSO: unexpected st_shndx %x\n",
 93			       sym->st_shndx);
 94			continue;
 95		}
 96
 97		switch(ELF_ST_TYPE(sym->st_info)) {
 98		case STT_OBJECT:
 99		case STT_FUNC:
100		case STT_SECTION:
101		case STT_FILE:
102			sym->st_value += VDSO_ADDR_ADJUST;
103		}
104	}
105}
106
107static __init void reloc_dyn(Elf32_Ehdr *ehdr, unsigned offset)
108{
109	Elf32_Dyn *dyn = (void *)ehdr + offset;
110
111	for(; dyn->d_tag != DT_NULL; dyn++)
112		switch(dyn->d_tag) {
113		case DT_PLTGOT:
114		case DT_HASH:
115		case DT_STRTAB:
116		case DT_SYMTAB:
117		case DT_RELA:
118		case DT_INIT:
119		case DT_FINI:
120		case DT_REL:
121		case DT_DEBUG:
122		case DT_JMPREL:
123		case DT_VERSYM:
124		case DT_VERDEF:
125		case DT_VERNEED:
126		case DT_ADDRRNGLO ... DT_ADDRRNGHI:
127			/* definitely pointers needing relocation */
128			dyn->d_un.d_ptr += VDSO_ADDR_ADJUST;
129			break;
130
131		case DT_ENCODING ... OLD_DT_LOOS-1:
132		case DT_LOOS ... DT_HIOS-1:
133			/* Tags above DT_ENCODING are pointers if
134			   they're even */
135			if (dyn->d_tag >= DT_ENCODING &&
136			    (dyn->d_tag & 1) == 0)
137				dyn->d_un.d_ptr += VDSO_ADDR_ADJUST;
138			break;
139
140		case DT_VERDEFNUM:
141		case DT_VERNEEDNUM:
142		case DT_FLAGS_1:
143		case DT_RELACOUNT:
144		case DT_RELCOUNT:
145		case DT_VALRNGLO ... DT_VALRNGHI:
146			/* definitely not pointers */
147			break;
148
149		case OLD_DT_LOOS ... DT_LOOS-1:
150		case DT_HIOS ... DT_VALRNGLO-1:
151		default:
152			if (dyn->d_tag > DT_ENCODING)
153				printk(KERN_INFO "VDSO: unexpected DT_tag %x\n",
154				       dyn->d_tag);
155			break;
156		}
157}
158
159static __init void relocate_vdso(Elf32_Ehdr *ehdr)
160{
161	Elf32_Phdr *phdr;
162	Elf32_Shdr *shdr;
163	int i;
164
165	BUG_ON(memcmp(ehdr->e_ident, ELFMAG, SELFMAG) != 0 ||
166	       !elf_check_arch_ia32(ehdr) ||
167	       ehdr->e_type != ET_DYN);
168
169	ehdr->e_entry += VDSO_ADDR_ADJUST;
170
171	/* rebase phdrs */
172	phdr = (void *)ehdr + ehdr->e_phoff;
173	for (i = 0; i < ehdr->e_phnum; i++) {
174		phdr[i].p_vaddr += VDSO_ADDR_ADJUST;
175
176		/* relocate dynamic stuff */
177		if (phdr[i].p_type == PT_DYNAMIC)
178			reloc_dyn(ehdr, phdr[i].p_offset);
179	}
180
181	/* rebase sections */
182	shdr = (void *)ehdr + ehdr->e_shoff;
183	for(i = 0; i < ehdr->e_shnum; i++) {
184		if (!(shdr[i].sh_flags & SHF_ALLOC))
185			continue;
186
187		shdr[i].sh_addr += VDSO_ADDR_ADJUST;
188
189		if (shdr[i].sh_type == SHT_SYMTAB ||
190		    shdr[i].sh_type == SHT_DYNSYM)
191			reloc_symtab(ehdr, shdr[i].sh_offset,
192				     shdr[i].sh_size);
193	}
194}
195
196static struct page *vdso32_pages[1];
197
198#ifdef CONFIG_X86_64
199
200#define	vdso32_sysenter()	(boot_cpu_has(X86_FEATURE_SYSENTER32))
201#define	vdso32_syscall()	(boot_cpu_has(X86_FEATURE_SYSCALL32))
202
203/* May not be __init: called during resume */
204void syscall32_cpu_init(void)
205{
206	/* Load these always in case some future AMD CPU supports
207	   SYSENTER from compat mode too. */
208	checking_wrmsrl(MSR_IA32_SYSENTER_CS, (u64)__KERNEL_CS);
209	checking_wrmsrl(MSR_IA32_SYSENTER_ESP, 0ULL);
210	checking_wrmsrl(MSR_IA32_SYSENTER_EIP, (u64)ia32_sysenter_target);
211
212	wrmsrl(MSR_CSTAR, ia32_cstar_target);
213}
214
215#define compat_uses_vma		1
216
217static inline void map_compat_vdso(int map)
218{
219}
220
221#else  /* CONFIG_X86_32 */
222
223#define vdso32_sysenter()	(boot_cpu_has(X86_FEATURE_SEP))
224#define vdso32_syscall()	(0)
225
226void enable_sep_cpu(void)
227{
228	int cpu = get_cpu();
229	struct tss_struct *tss = &per_cpu(init_tss, cpu);
230
231	if (!boot_cpu_has(X86_FEATURE_SEP)) {
232		put_cpu();
233		return;
234	}
235
236	tss->x86_tss.ss1 = __KERNEL_CS;
237	tss->x86_tss.sp1 = sizeof(struct tss_struct) + (unsigned long) tss;
238	wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0);
239	wrmsr(MSR_IA32_SYSENTER_ESP, tss->x86_tss.sp1, 0);
240	wrmsr(MSR_IA32_SYSENTER_EIP, (unsigned long) ia32_sysenter_target, 0);
241	put_cpu();	
242}
243
244static struct vm_area_struct gate_vma;
245
246static int __init gate_vma_init(void)
247{
248	gate_vma.vm_mm = NULL;
249	gate_vma.vm_start = FIXADDR_USER_START;
250	gate_vma.vm_end = FIXADDR_USER_END;
251	gate_vma.vm_flags = VM_READ | VM_MAYREAD | VM_EXEC | VM_MAYEXEC;
252	gate_vma.vm_page_prot = __P101;
253
254	return 0;
255}
256
257#define compat_uses_vma		0
258
259static void map_compat_vdso(int map)
260{
261	static int vdso_mapped;
262
263	if (map == vdso_mapped)
264		return;
265
266	vdso_mapped = map;
267
268	__set_fixmap(FIX_VDSO, page_to_pfn(vdso32_pages[0]) << PAGE_SHIFT,
269		     map ? PAGE_READONLY_EXEC : PAGE_NONE);
270
271	/* flush stray tlbs */
272	flush_tlb_all();
273}
274
275#endif	/* CONFIG_X86_64 */
276
277int __init sysenter_setup(void)
278{
279	void *syscall_page = (void *)get_zeroed_page(GFP_ATOMIC);
280	const void *vsyscall;
281	size_t vsyscall_len;
282
283	vdso32_pages[0] = virt_to_page(syscall_page);
284
285#ifdef CONFIG_X86_32
286	gate_vma_init();
287#endif
288
 
289	if (vdso32_syscall()) {
290		vsyscall = &vdso32_syscall_start;
291		vsyscall_len = &vdso32_syscall_end - &vdso32_syscall_start;
292	} else if (vdso32_sysenter()){
293		vsyscall = &vdso32_sysenter_start;
294		vsyscall_len = &vdso32_sysenter_end - &vdso32_sysenter_start;
 
 
 
 
295	} else {
296		vsyscall = &vdso32_int80_start;
297		vsyscall_len = &vdso32_int80_end - &vdso32_int80_start;
 
298	}
299
300	memcpy(syscall_page, vsyscall, vsyscall_len);
301	relocate_vdso(syscall_page);
 
 
 
 
302
303	return 0;
304}
305
306/* Setup a VMA at program startup for the vsyscall page */
307int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
308{
309	struct mm_struct *mm = current->mm;
310	unsigned long addr;
311	int ret = 0;
312	bool compat;
 
313
314#ifdef CONFIG_X86_X32_ABI
315	if (test_thread_flag(TIF_X32))
316		return x32_setup_additional_pages(bprm, uses_interp);
317#endif
318
319	if (vdso_enabled == VDSO_DISABLED)
320		return 0;
321
322	down_write(&mm->mmap_sem);
323
324	/* Test compat mode once here, in case someone
325	   changes it via sysctl */
326	compat = (vdso_enabled == VDSO_COMPAT);
327
328	map_compat_vdso(compat);
329
330	if (compat)
331		addr = VDSO_HIGH_BASE;
332	else {
333		addr = get_unmapped_area(NULL, 0, PAGE_SIZE, 0, 0);
334		if (IS_ERR_VALUE(addr)) {
335			ret = addr;
336			goto up_fail;
337		}
338	}
339
 
 
340	current->mm->context.vdso = (void *)addr;
341
342	if (compat_uses_vma || !compat) {
343		/*
344		 * MAYWRITE to allow gdb to COW and set breakpoints
345		 */
346		ret = install_special_mapping(mm, addr, PAGE_SIZE,
347					      VM_READ|VM_EXEC|
348					      VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
349					      vdso32_pages);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
350
351		if (ret)
352			goto up_fail;
353	}
 
354
355	current_thread_info()->sysenter_return =
356		VDSO32_SYMBOL(addr, SYSENTER_RETURN);
357
358  up_fail:
359	if (ret)
360		current->mm->context.vdso = NULL;
361
362	up_write(&mm->mmap_sem);
363
364	return ret;
365}
366
367#ifdef CONFIG_X86_64
368
369subsys_initcall(sysenter_setup);
370
371#ifdef CONFIG_SYSCTL
372/* Register vsyscall32 into the ABI table */
373#include <linux/sysctl.h>
374
375static ctl_table abi_table2[] = {
376	{
377		.procname	= "vsyscall32",
378		.data		= &sysctl_vsyscall32,
379		.maxlen		= sizeof(int),
380		.mode		= 0644,
381		.proc_handler	= proc_dointvec
382	},
 
 
 
 
 
 
 
383	{}
384};
385
386static ctl_table abi_root_table2[] = {
387	{
388		.procname = "abi",
389		.mode = 0555,
390		.child = abi_table2
391	},
392	{}
393};
394
395static __init int ia32_binfmt_init(void)
396{
397	register_sysctl_table(abi_root_table2);
398	return 0;
399}
400__initcall(ia32_binfmt_init);
401#endif
402
403#else  /* CONFIG_X86_32 */
404
405const char *arch_vma_name(struct vm_area_struct *vma)
406{
407	if (vma->vm_mm && vma->vm_start == (long)vma->vm_mm->context.vdso)
408		return "[vdso]";
409	return NULL;
410}
411
412struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
413{
414	/*
415	 * Check to see if the corresponding task was created in compat vdso
416	 * mode.
417	 */
418	if (mm && mm->context.vdso == (void *)VDSO_HIGH_BASE)
419		return &gate_vma;
420	return NULL;
421}
422
423int in_gate_area(struct mm_struct *mm, unsigned long addr)
424{
425	const struct vm_area_struct *vma = get_gate_vma(mm);
426
427	return vma && addr >= vma->vm_start && addr < vma->vm_end;
428}
429
430int in_gate_area_no_mm(unsigned long addr)
431{
432	return 0;
433}
434
435#endif	/* CONFIG_X86_64 */
v3.15
  1/*
  2 * (C) Copyright 2002 Linus Torvalds
  3 * Portions based on the vdso-randomization code from exec-shield:
  4 * Copyright(C) 2005-2006, Red Hat, Inc., Ingo Molnar
  5 *
  6 * This file contains the needed initializations to support sysenter.
  7 */
  8
  9#include <linux/init.h>
 10#include <linux/smp.h>
 11#include <linux/thread_info.h>
 12#include <linux/sched.h>
 13#include <linux/gfp.h>
 14#include <linux/string.h>
 15#include <linux/elf.h>
 16#include <linux/mm.h>
 17#include <linux/err.h>
 18#include <linux/module.h>
 19#include <linux/slab.h>
 20
 21#include <asm/cpufeature.h>
 22#include <asm/msr.h>
 23#include <asm/pgtable.h>
 24#include <asm/unistd.h>
 25#include <asm/elf.h>
 26#include <asm/tlbflush.h>
 27#include <asm/vdso.h>
 28#include <asm/proto.h>
 29#include <asm/fixmap.h>
 30#include <asm/hpet.h>
 31#include <asm/vvar.h>
 
 
 
 32
 33#ifdef CONFIG_COMPAT_VDSO
 34#define VDSO_DEFAULT	0
 35#else
 36#define VDSO_DEFAULT	1
 37#endif
 38
 39#ifdef CONFIG_X86_64
 40#define vdso_enabled			sysctl_vsyscall32
 41#define arch_setup_additional_pages	syscall32_setup_pages
 42extern int sysctl_ldt16;
 43#endif
 44
 45/*
 
 
 
 
 
 
 
 46 * Should the kernel map a VDSO page into processes and pass its
 47 * address down to glibc upon exec()?
 48 */
 49unsigned int __read_mostly vdso_enabled = VDSO_DEFAULT;
 50
 51static int __init vdso_setup(char *s)
 52{
 53	vdso_enabled = simple_strtoul(s, NULL, 0);
 54
 55	if (vdso_enabled > 1)
 56		pr_warn("vdso32 values other than 0 and 1 are no longer allowed; vdso disabled\n");
 57
 58	return 1;
 59}
 60
 61/*
 62 * For consistency, the argument vdso32=[012] affects the 32-bit vDSO
 63 * behavior on both 64-bit and 32-bit kernels.
 64 * On 32-bit kernels, vdso=[012] means the same thing.
 65 */
 66__setup("vdso32=", vdso_setup);
 67
 68#ifdef CONFIG_X86_32
 69__setup_param("vdso=", vdso32_setup, vdso_setup, 0);
 70
 71EXPORT_SYMBOL_GPL(vdso_enabled);
 72#endif
 73
 74static struct page **vdso32_pages;
 75static unsigned vdso32_size;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 76
 77#ifdef CONFIG_X86_64
 78
 79#define	vdso32_sysenter()	(boot_cpu_has(X86_FEATURE_SYSENTER32))
 80#define	vdso32_syscall()	(boot_cpu_has(X86_FEATURE_SYSCALL32))
 81
 82/* May not be __init: called during resume */
 83void syscall32_cpu_init(void)
 84{
 85	/* Load these always in case some future AMD CPU supports
 86	   SYSENTER from compat mode too. */
 87	wrmsrl_safe(MSR_IA32_SYSENTER_CS, (u64)__KERNEL_CS);
 88	wrmsrl_safe(MSR_IA32_SYSENTER_ESP, 0ULL);
 89	wrmsrl_safe(MSR_IA32_SYSENTER_EIP, (u64)ia32_sysenter_target);
 90
 91	wrmsrl(MSR_CSTAR, ia32_cstar_target);
 92}
 93
 
 
 
 
 
 
 94#else  /* CONFIG_X86_32 */
 95
 96#define vdso32_sysenter()	(boot_cpu_has(X86_FEATURE_SEP))
 97#define vdso32_syscall()	(0)
 98
 99void enable_sep_cpu(void)
100{
101	int cpu = get_cpu();
102	struct tss_struct *tss = &per_cpu(init_tss, cpu);
103
104	if (!boot_cpu_has(X86_FEATURE_SEP)) {
105		put_cpu();
106		return;
107	}
108
109	tss->x86_tss.ss1 = __KERNEL_CS;
110	tss->x86_tss.sp1 = sizeof(struct tss_struct) + (unsigned long) tss;
111	wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0);
112	wrmsr(MSR_IA32_SYSENTER_ESP, tss->x86_tss.sp1, 0);
113	wrmsr(MSR_IA32_SYSENTER_EIP, (unsigned long) ia32_sysenter_target, 0);
114	put_cpu();	
115}
116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117#endif	/* CONFIG_X86_64 */
118
119int __init sysenter_setup(void)
120{
121	char *vdso32_start, *vdso32_end;
122	int npages, i;
 
 
 
 
 
 
 
123
124#ifdef CONFIG_COMPAT
125	if (vdso32_syscall()) {
126		vdso32_start = vdso32_syscall_start;
127		vdso32_end = vdso32_syscall_end;
128		vdso32_pages = vdso32_syscall_pages;
129	} else
130#endif
131	if (vdso32_sysenter()) {
132		vdso32_start = vdso32_sysenter_start;
133		vdso32_end = vdso32_sysenter_end;
134		vdso32_pages = vdso32_sysenter_pages;
135	} else {
136		vdso32_start = vdso32_int80_start;
137		vdso32_end = vdso32_int80_end;
138		vdso32_pages = vdso32_int80_pages;
139	}
140
141	npages = ((vdso32_end - vdso32_start) + PAGE_SIZE - 1) / PAGE_SIZE;
142	vdso32_size = npages << PAGE_SHIFT;
143	for (i = 0; i < npages; i++)
144		vdso32_pages[i] = virt_to_page(vdso32_start + i*PAGE_SIZE);
145
146	patch_vdso32(vdso32_start, vdso32_size);
147
148	return 0;
149}
150
151/* Setup a VMA at program startup for the vsyscall page */
152int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
153{
154	struct mm_struct *mm = current->mm;
155	unsigned long addr;
156	int ret = 0;
157	struct vm_area_struct *vma;
158	static struct page *no_pages[] = {NULL};
159
160#ifdef CONFIG_X86_X32_ABI
161	if (test_thread_flag(TIF_X32))
162		return x32_setup_additional_pages(bprm, uses_interp);
163#endif
164
165	if (vdso_enabled != 1)  /* Other values all mean "disabled" */
166		return 0;
167
168	down_write(&mm->mmap_sem);
169
170	addr = get_unmapped_area(NULL, 0, vdso32_size + VDSO_OFFSET(VDSO_PREV_PAGES), 0, 0);
171	if (IS_ERR_VALUE(addr)) {
172		ret = addr;
173		goto up_fail;
 
 
 
 
 
 
 
 
 
 
174	}
175
176	addr += VDSO_OFFSET(VDSO_PREV_PAGES);
177
178	current->mm->context.vdso = (void *)addr;
179
180	/*
181	 * MAYWRITE to allow gdb to COW and set breakpoints
182	 */
183	ret = install_special_mapping(mm,
184			addr,
185			vdso32_size,
186			VM_READ|VM_EXEC|
187			VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
188			vdso32_pages);
189
190	if (ret)
191		goto up_fail;
192
193	vma = _install_special_mapping(mm,
194			addr -  VDSO_OFFSET(VDSO_PREV_PAGES),
195			VDSO_OFFSET(VDSO_PREV_PAGES),
196			VM_READ,
197			no_pages);
198
199	if (IS_ERR(vma)) {
200		ret = PTR_ERR(vma);
201		goto up_fail;
202	}
203
204	ret = remap_pfn_range(vma,
205		addr - VDSO_OFFSET(VDSO_VVAR_PAGE),
206		__pa_symbol(&__vvar_page) >> PAGE_SHIFT,
207		PAGE_SIZE,
208		PAGE_READONLY);
209
210	if (ret)
211		goto up_fail;
212
213#ifdef CONFIG_HPET_TIMER
214	if (hpet_address) {
215		ret = io_remap_pfn_range(vma,
216			addr - VDSO_OFFSET(VDSO_HPET_PAGE),
217			hpet_address >> PAGE_SHIFT,
218			PAGE_SIZE,
219			pgprot_noncached(PAGE_READONLY));
220
221		if (ret)
222			goto up_fail;
223	}
224#endif
225
226	current_thread_info()->sysenter_return =
227		VDSO32_SYMBOL(addr, SYSENTER_RETURN);
228
229  up_fail:
230	if (ret)
231		current->mm->context.vdso = NULL;
232
233	up_write(&mm->mmap_sem);
234
235	return ret;
236}
237
238#ifdef CONFIG_X86_64
239
240subsys_initcall(sysenter_setup);
241
242#ifdef CONFIG_SYSCTL
243/* Register vsyscall32 into the ABI table */
244#include <linux/sysctl.h>
245
246static struct ctl_table abi_table2[] = {
247	{
248		.procname	= "vsyscall32",
249		.data		= &sysctl_vsyscall32,
250		.maxlen		= sizeof(int),
251		.mode		= 0644,
252		.proc_handler	= proc_dointvec
253	},
254	{
255		.procname	= "ldt16",
256		.data		= &sysctl_ldt16,
257		.maxlen		= sizeof(int),
258		.mode		= 0644,
259		.proc_handler	= proc_dointvec
260	},
261	{}
262};
263
264static struct ctl_table abi_root_table2[] = {
265	{
266		.procname = "abi",
267		.mode = 0555,
268		.child = abi_table2
269	},
270	{}
271};
272
273static __init int ia32_binfmt_init(void)
274{
275	register_sysctl_table(abi_root_table2);
276	return 0;
277}
278__initcall(ia32_binfmt_init);
279#endif
280
281#else  /* CONFIG_X86_32 */
282
283const char *arch_vma_name(struct vm_area_struct *vma)
284{
285	if (vma->vm_mm && vma->vm_start == (long)vma->vm_mm->context.vdso)
286		return "[vdso]";
287	return NULL;
288}
289
290struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
291{
 
 
 
 
 
 
292	return NULL;
293}
294
295int in_gate_area(struct mm_struct *mm, unsigned long addr)
296{
297	return 0;
 
 
298}
299
300int in_gate_area_no_mm(unsigned long addr)
301{
302	return 0;
303}
304
305#endif	/* CONFIG_X86_64 */