[PATCH] drivers/scsi/dpt_i2o.c: fix a NULL pointer dereference
[linux-2.6-block.git] / arch / powerpc / kernel / vdso.c
CommitLineData
a7f290da
BH
1/*
2 * linux/arch/ppc64/kernel/vdso.c
3 *
4 * Copyright (C) 2004 Benjamin Herrenschmidt, IBM Corp.
5 * <benh@kernel.crashing.org>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#include <linux/config.h>
14#include <linux/module.h>
15#include <linux/errno.h>
16#include <linux/sched.h>
17#include <linux/kernel.h>
18#include <linux/mm.h>
19#include <linux/smp.h>
20#include <linux/smp_lock.h>
21#include <linux/stddef.h>
22#include <linux/unistd.h>
23#include <linux/slab.h>
24#include <linux/user.h>
25#include <linux/elf.h>
26#include <linux/security.h>
27#include <linux/bootmem.h>
28
29#include <asm/pgtable.h>
30#include <asm/system.h>
31#include <asm/processor.h>
32#include <asm/mmu.h>
33#include <asm/mmu_context.h>
34#include <asm/lmb.h>
35#include <asm/machdep.h>
36#include <asm/cputable.h>
37#include <asm/sections.h>
38#include <asm/vdso.h>
39#include <asm/vdso_datapage.h>
40
41#undef DEBUG
42
43#ifdef DEBUG
44#define DBG(fmt...) printk(fmt)
45#else
46#define DBG(fmt...)
47#endif
48
49/* Max supported size for symbol names */
50#define MAX_SYMNAME 64
51
52extern char vdso32_start, vdso32_end;
53static void *vdso32_kbase = &vdso32_start;
54unsigned int vdso32_pages;
55unsigned long vdso32_sigtramp;
56unsigned long vdso32_rt_sigtramp;
57
58#ifdef CONFIG_PPC64
59extern char vdso64_start, vdso64_end;
60static void *vdso64_kbase = &vdso64_start;
61unsigned int vdso64_pages;
62unsigned long vdso64_rt_sigtramp;
63#endif /* CONFIG_PPC64 */
64
65/*
66 * The vdso data page (aka. systemcfg for old ppc64 fans) is here.
67 * Once the early boot kernel code no longer needs to muck around
68 * with it, it will become dynamically allocated
69 */
70static union {
71 struct vdso_data data;
72 u8 page[PAGE_SIZE];
73} vdso_data_store __attribute__((__section__(".data.page_aligned")));
74struct vdso_data *vdso_data = &vdso_data_store.data;
75
76/* Format of the patch table */
77struct vdso_patch_def
78{
79 unsigned long ftr_mask, ftr_value;
80 const char *gen_name;
81 const char *fix_name;
82};
83
84/* Table of functions to patch based on the CPU type/revision
85 *
86 * Currently, we only change sync_dicache to do nothing on processors
87 * with a coherent icache
88 */
89static struct vdso_patch_def vdso_patches[] = {
90 {
91 CPU_FTR_COHERENT_ICACHE, CPU_FTR_COHERENT_ICACHE,
92 "__kernel_sync_dicache", "__kernel_sync_dicache_p5"
93 },
94 {
95 CPU_FTR_USE_TB, 0,
96 "__kernel_gettimeofday", NULL
97 },
98};
99
100/*
101 * Some infos carried around for each of them during parsing at
102 * boot time.
103 */
104struct lib32_elfinfo
105{
106 Elf32_Ehdr *hdr; /* ptr to ELF */
107 Elf32_Sym *dynsym; /* ptr to .dynsym section */
108 unsigned long dynsymsize; /* size of .dynsym section */
109 char *dynstr; /* ptr to .dynstr section */
110 unsigned long text; /* offset of .text section in .so */
111};
112
113struct lib64_elfinfo
114{
115 Elf64_Ehdr *hdr;
116 Elf64_Sym *dynsym;
117 unsigned long dynsymsize;
118 char *dynstr;
119 unsigned long text;
120};
121
122
123#ifdef __DEBUG
124static void dump_one_vdso_page(struct page *pg, struct page *upg)
125{
126 printk("kpg: %p (c:%d,f:%08lx)", __va(page_to_pfn(pg) << PAGE_SHIFT),
127 page_count(pg),
128 pg->flags);
129 if (upg/* && pg != upg*/) {
130 printk(" upg: %p (c:%d,f:%08lx)", __va(page_to_pfn(upg)
131 << PAGE_SHIFT),
132 page_count(upg),
133 upg->flags);
134 }
135 printk("\n");
136}
137
138static void dump_vdso_pages(struct vm_area_struct * vma)
139{
140 int i;
141
142 if (!vma || test_thread_flag(TIF_32BIT)) {
143 printk("vDSO32 @ %016lx:\n", (unsigned long)vdso32_kbase);
144 for (i=0; i<vdso32_pages; i++) {
145 struct page *pg = virt_to_page(vdso32_kbase +
146 i*PAGE_SIZE);
147 struct page *upg = (vma && vma->vm_mm) ?
148 follow_page(vma->vm_mm, vma->vm_start +
149 i*PAGE_SIZE, 0)
150 : NULL;
151 dump_one_vdso_page(pg, upg);
152 }
153 }
154 if (!vma || !test_thread_flag(TIF_32BIT)) {
155 printk("vDSO64 @ %016lx:\n", (unsigned long)vdso64_kbase);
156 for (i=0; i<vdso64_pages; i++) {
157 struct page *pg = virt_to_page(vdso64_kbase +
158 i*PAGE_SIZE);
159 struct page *upg = (vma && vma->vm_mm) ?
160 follow_page(vma->vm_mm, vma->vm_start +
161 i*PAGE_SIZE, 0)
162 : NULL;
163 dump_one_vdso_page(pg, upg);
164 }
165 }
166}
167#endif /* DEBUG */
168
169/*
170 * Keep a dummy vma_close for now, it will prevent VMA merging.
171 */
172static void vdso_vma_close(struct vm_area_struct * vma)
173{
174}
175
176/*
177 * Our nopage() function, maps in the actual vDSO kernel pages, they will
178 * be mapped read-only by do_no_page(), and eventually COW'ed, either
179 * right away for an initial write access, or by do_wp_page().
180 */
181static struct page * vdso_vma_nopage(struct vm_area_struct * vma,
182 unsigned long address, int *type)
183{
184 unsigned long offset = address - vma->vm_start;
185 struct page *pg;
186#ifdef CONFIG_PPC64
187 void *vbase = test_thread_flag(TIF_32BIT) ?
188 vdso32_kbase : vdso64_kbase;
189#else
190 void *vbase = vdso32_kbase;
191#endif
192
193 DBG("vdso_vma_nopage(current: %s, address: %016lx, off: %lx)\n",
194 current->comm, address, offset);
195
196 if (address < vma->vm_start || address > vma->vm_end)
197 return NOPAGE_SIGBUS;
198
199 /*
200 * Last page is systemcfg.
201 */
202 if ((vma->vm_end - address) <= PAGE_SIZE)
203 pg = virt_to_page(vdso_data);
204 else
205 pg = virt_to_page(vbase + offset);
206
207 get_page(pg);
208 DBG(" ->page count: %d\n", page_count(pg));
209
210 return pg;
211}
212
213static struct vm_operations_struct vdso_vmops = {
214 .close = vdso_vma_close,
215 .nopage = vdso_vma_nopage,
216};
217
218/*
219 * This is called from binfmt_elf, we create the special vma for the
220 * vDSO and insert it into the mm struct tree
221 */
222int arch_setup_additional_pages(struct linux_binprm *bprm,
223 int executable_stack)
224{
225 struct mm_struct *mm = current->mm;
226 struct vm_area_struct *vma;
227 unsigned long vdso_pages;
228 unsigned long vdso_base;
229
230#ifdef CONFIG_PPC64
231 if (test_thread_flag(TIF_32BIT)) {
232 vdso_pages = vdso32_pages;
233 vdso_base = VDSO32_MBASE;
234 } else {
235 vdso_pages = vdso64_pages;
236 vdso_base = VDSO64_MBASE;
237 }
238#else
239 vdso_pages = vdso32_pages;
240 vdso_base = VDSO32_MBASE;
241#endif
242
243 current->thread.vdso_base = 0;
244
245 /* vDSO has a problem and was disabled, just don't "enable" it for the
246 * process
247 */
248 if (vdso_pages == 0)
249 return 0;
250
251 vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
252 if (vma == NULL)
253 return -ENOMEM;
254
255 memset(vma, 0, sizeof(*vma));
256
257 /* Add a page to the vdso size for the data page */
258 vdso_pages ++;
259
260 /*
261 * pick a base address for the vDSO in process space. We try to put it
262 * at vdso_base which is the "natural" base for it, but we might fail
263 * and end up putting it elsewhere.
264 */
265 vdso_base = get_unmapped_area(NULL, vdso_base,
266 vdso_pages << PAGE_SHIFT, 0, 0);
267 if (vdso_base & ~PAGE_MASK) {
268 kmem_cache_free(vm_area_cachep, vma);
269 return (int)vdso_base;
270 }
271
272 current->thread.vdso_base = vdso_base;
273
274 vma->vm_mm = mm;
275 vma->vm_start = current->thread.vdso_base;
276 vma->vm_end = vma->vm_start + (vdso_pages << PAGE_SHIFT);
277
278 /*
279 * our vma flags don't have VM_WRITE so by default, the process isn't
280 * allowed to write those pages.
281 * gdb can break that with ptrace interface, and thus trigger COW on
282 * those pages but it's then your responsibility to never do that on
283 * the "data" page of the vDSO or you'll stop getting kernel updates
284 * and your nice userland gettimeofday will be totally dead.
285 * It's fine to use that for setting breakpoints in the vDSO code
286 * pages though
287 */
0b14c179 288 vma->vm_flags = VM_READ | VM_EXEC | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC;
a7f290da
BH
289 vma->vm_flags |= mm->def_flags;
290 vma->vm_page_prot = protection_map[vma->vm_flags & 0x7];
291 vma->vm_ops = &vdso_vmops;
292
293 down_write(&mm->mmap_sem);
294 if (insert_vm_struct(mm, vma)) {
295 up_write(&mm->mmap_sem);
296 kmem_cache_free(vm_area_cachep, vma);
297 return -ENOMEM;
298 }
299 mm->total_vm += (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
300 up_write(&mm->mmap_sem);
301
302 return 0;
303}
304
305static void * __init find_section32(Elf32_Ehdr *ehdr, const char *secname,
306 unsigned long *size)
307{
308 Elf32_Shdr *sechdrs;
309 unsigned int i;
310 char *secnames;
311
312 /* Grab section headers and strings so we can tell who is who */
313 sechdrs = (void *)ehdr + ehdr->e_shoff;
314 secnames = (void *)ehdr + sechdrs[ehdr->e_shstrndx].sh_offset;
315
316 /* Find the section they want */
317 for (i = 1; i < ehdr->e_shnum; i++) {
318 if (strcmp(secnames+sechdrs[i].sh_name, secname) == 0) {
319 if (size)
320 *size = sechdrs[i].sh_size;
321 return (void *)ehdr + sechdrs[i].sh_offset;
322 }
323 }
324 *size = 0;
325 return NULL;
326}
327
328static Elf32_Sym * __init find_symbol32(struct lib32_elfinfo *lib,
329 const char *symname)
330{
331 unsigned int i;
332 char name[MAX_SYMNAME], *c;
333
334 for (i = 0; i < (lib->dynsymsize / sizeof(Elf32_Sym)); i++) {
335 if (lib->dynsym[i].st_name == 0)
336 continue;
337 strlcpy(name, lib->dynstr + lib->dynsym[i].st_name,
338 MAX_SYMNAME);
339 c = strchr(name, '@');
340 if (c)
341 *c = 0;
342 if (strcmp(symname, name) == 0)
343 return &lib->dynsym[i];
344 }
345 return NULL;
346}
347
348/* Note that we assume the section is .text and the symbol is relative to
349 * the library base
350 */
351static unsigned long __init find_function32(struct lib32_elfinfo *lib,
352 const char *symname)
353{
354 Elf32_Sym *sym = find_symbol32(lib, symname);
355
356 if (sym == NULL) {
357 printk(KERN_WARNING "vDSO32: function %s not found !\n",
358 symname);
359 return 0;
360 }
361 return sym->st_value - VDSO32_LBASE;
362}
363
364static int vdso_do_func_patch32(struct lib32_elfinfo *v32,
365 struct lib64_elfinfo *v64,
366 const char *orig, const char *fix)
367{
368 Elf32_Sym *sym32_gen, *sym32_fix;
369
370 sym32_gen = find_symbol32(v32, orig);
371 if (sym32_gen == NULL) {
372 printk(KERN_ERR "vDSO32: Can't find symbol %s !\n", orig);
373 return -1;
374 }
375 if (fix == NULL) {
376 sym32_gen->st_name = 0;
377 return 0;
378 }
379 sym32_fix = find_symbol32(v32, fix);
380 if (sym32_fix == NULL) {
381 printk(KERN_ERR "vDSO32: Can't find symbol %s !\n", fix);
382 return -1;
383 }
384 sym32_gen->st_value = sym32_fix->st_value;
385 sym32_gen->st_size = sym32_fix->st_size;
386 sym32_gen->st_info = sym32_fix->st_info;
387 sym32_gen->st_other = sym32_fix->st_other;
388 sym32_gen->st_shndx = sym32_fix->st_shndx;
389
390 return 0;
391}
392
393
394#ifdef CONFIG_PPC64
395
396static void * __init find_section64(Elf64_Ehdr *ehdr, const char *secname,
397 unsigned long *size)
398{
399 Elf64_Shdr *sechdrs;
400 unsigned int i;
401 char *secnames;
402
403 /* Grab section headers and strings so we can tell who is who */
404 sechdrs = (void *)ehdr + ehdr->e_shoff;
405 secnames = (void *)ehdr + sechdrs[ehdr->e_shstrndx].sh_offset;
406
407 /* Find the section they want */
408 for (i = 1; i < ehdr->e_shnum; i++) {
409 if (strcmp(secnames+sechdrs[i].sh_name, secname) == 0) {
410 if (size)
411 *size = sechdrs[i].sh_size;
412 return (void *)ehdr + sechdrs[i].sh_offset;
413 }
414 }
415 if (size)
416 *size = 0;
417 return NULL;
418}
419
420static Elf64_Sym * __init find_symbol64(struct lib64_elfinfo *lib,
421 const char *symname)
422{
423 unsigned int i;
424 char name[MAX_SYMNAME], *c;
425
426 for (i = 0; i < (lib->dynsymsize / sizeof(Elf64_Sym)); i++) {
427 if (lib->dynsym[i].st_name == 0)
428 continue;
429 strlcpy(name, lib->dynstr + lib->dynsym[i].st_name,
430 MAX_SYMNAME);
431 c = strchr(name, '@');
432 if (c)
433 *c = 0;
434 if (strcmp(symname, name) == 0)
435 return &lib->dynsym[i];
436 }
437 return NULL;
438}
439
440/* Note that we assume the section is .text and the symbol is relative to
441 * the library base
442 */
443static unsigned long __init find_function64(struct lib64_elfinfo *lib,
444 const char *symname)
445{
446 Elf64_Sym *sym = find_symbol64(lib, symname);
447
448 if (sym == NULL) {
449 printk(KERN_WARNING "vDSO64: function %s not found !\n",
450 symname);
451 return 0;
452 }
453#ifdef VDS64_HAS_DESCRIPTORS
454 return *((u64 *)(vdso64_kbase + sym->st_value - VDSO64_LBASE)) -
455 VDSO64_LBASE;
456#else
457 return sym->st_value - VDSO64_LBASE;
458#endif
459}
460
461static int vdso_do_func_patch64(struct lib32_elfinfo *v32,
462 struct lib64_elfinfo *v64,
463 const char *orig, const char *fix)
464{
465 Elf64_Sym *sym64_gen, *sym64_fix;
466
467 sym64_gen = find_symbol64(v64, orig);
468 if (sym64_gen == NULL) {
469 printk(KERN_ERR "vDSO64: Can't find symbol %s !\n", orig);
470 return -1;
471 }
472 if (fix == NULL) {
473 sym64_gen->st_name = 0;
474 return 0;
475 }
476 sym64_fix = find_symbol64(v64, fix);
477 if (sym64_fix == NULL) {
478 printk(KERN_ERR "vDSO64: Can't find symbol %s !\n", fix);
479 return -1;
480 }
481 sym64_gen->st_value = sym64_fix->st_value;
482 sym64_gen->st_size = sym64_fix->st_size;
483 sym64_gen->st_info = sym64_fix->st_info;
484 sym64_gen->st_other = sym64_fix->st_other;
485 sym64_gen->st_shndx = sym64_fix->st_shndx;
486
487 return 0;
488}
489
490#endif /* CONFIG_PPC64 */
491
492
493static __init int vdso_do_find_sections(struct lib32_elfinfo *v32,
494 struct lib64_elfinfo *v64)
495{
496 void *sect;
497
498 /*
499 * Locate symbol tables & text section
500 */
501
502 v32->dynsym = find_section32(v32->hdr, ".dynsym", &v32->dynsymsize);
503 v32->dynstr = find_section32(v32->hdr, ".dynstr", NULL);
504 if (v32->dynsym == NULL || v32->dynstr == NULL) {
505 printk(KERN_ERR "vDSO32: required symbol section not found\n");
506 return -1;
507 }
508 sect = find_section32(v32->hdr, ".text", NULL);
509 if (sect == NULL) {
510 printk(KERN_ERR "vDSO32: the .text section was not found\n");
511 return -1;
512 }
513 v32->text = sect - vdso32_kbase;
514
515#ifdef CONFIG_PPC64
516 v64->dynsym = find_section64(v64->hdr, ".dynsym", &v64->dynsymsize);
517 v64->dynstr = find_section64(v64->hdr, ".dynstr", NULL);
518 if (v64->dynsym == NULL || v64->dynstr == NULL) {
519 printk(KERN_ERR "vDSO64: required symbol section not found\n");
520 return -1;
521 }
522 sect = find_section64(v64->hdr, ".text", NULL);
523 if (sect == NULL) {
524 printk(KERN_ERR "vDSO64: the .text section was not found\n");
525 return -1;
526 }
527 v64->text = sect - vdso64_kbase;
528#endif /* CONFIG_PPC64 */
529
530 return 0;
531}
532
533static __init void vdso_setup_trampolines(struct lib32_elfinfo *v32,
534 struct lib64_elfinfo *v64)
535{
536 /*
537 * Find signal trampolines
538 */
539
540#ifdef CONFIG_PPC64
541 vdso64_rt_sigtramp = find_function64(v64, "__kernel_sigtramp_rt64");
542#endif
543 vdso32_sigtramp = find_function32(v32, "__kernel_sigtramp32");
544 vdso32_rt_sigtramp = find_function32(v32, "__kernel_sigtramp_rt32");
545}
546
547static __init int vdso_fixup_datapage(struct lib32_elfinfo *v32,
548 struct lib64_elfinfo *v64)
549{
550 Elf32_Sym *sym32;
551#ifdef CONFIG_PPC64
552 Elf64_Sym *sym64;
553
554 sym64 = find_symbol64(v64, "__kernel_datapage_offset");
555 if (sym64 == NULL) {
556 printk(KERN_ERR "vDSO64: Can't find symbol "
557 "__kernel_datapage_offset !\n");
558 return -1;
559 }
560 *((int *)(vdso64_kbase + sym64->st_value - VDSO64_LBASE)) =
561 (vdso64_pages << PAGE_SHIFT) -
562 (sym64->st_value - VDSO64_LBASE);
563#endif /* CONFIG_PPC64 */
564
565 sym32 = find_symbol32(v32, "__kernel_datapage_offset");
566 if (sym32 == NULL) {
567 printk(KERN_ERR "vDSO32: Can't find symbol "
568 "__kernel_datapage_offset !\n");
569 return -1;
570 }
571 *((int *)(vdso32_kbase + (sym32->st_value - VDSO32_LBASE))) =
572 (vdso32_pages << PAGE_SHIFT) -
573 (sym32->st_value - VDSO32_LBASE);
574
575 return 0;
576}
577
578static __init int vdso_fixup_alt_funcs(struct lib32_elfinfo *v32,
579 struct lib64_elfinfo *v64)
580{
581 int i;
582
583 for (i = 0; i < ARRAY_SIZE(vdso_patches); i++) {
584 struct vdso_patch_def *patch = &vdso_patches[i];
585 int match = (cur_cpu_spec->cpu_features & patch->ftr_mask)
586 == patch->ftr_value;
587 if (!match)
588 continue;
589
590 DBG("replacing %s with %s...\n", patch->gen_name,
591 patch->fix_name ? "NONE" : patch->fix_name);
592
593 /*
594 * Patch the 32 bits and 64 bits symbols. Note that we do not
595 * patch the "." symbol on 64 bits.
596 * It would be easy to do, but doesn't seem to be necessary,
597 * patching the OPD symbol is enough.
598 */
599 vdso_do_func_patch32(v32, v64, patch->gen_name,
600 patch->fix_name);
601#ifdef CONFIG_PPC64
602 vdso_do_func_patch64(v32, v64, patch->gen_name,
603 patch->fix_name);
604#endif /* CONFIG_PPC64 */
605 }
606
607 return 0;
608}
609
610
611static __init int vdso_setup(void)
612{
613 struct lib32_elfinfo v32;
614 struct lib64_elfinfo v64;
615
616 v32.hdr = vdso32_kbase;
617#ifdef CONFIG_PPC64
618 v64.hdr = vdso64_kbase;
619#endif
620 if (vdso_do_find_sections(&v32, &v64))
621 return -1;
622
623 if (vdso_fixup_datapage(&v32, &v64))
624 return -1;
625
626 if (vdso_fixup_alt_funcs(&v32, &v64))
627 return -1;
628
629 vdso_setup_trampolines(&v32, &v64);
630
631 return 0;
632}
633
634/*
635 * Called from setup_arch to initialize the bitmap of available
636 * syscalls in the systemcfg page
637 */
638static void __init vdso_setup_syscall_map(void)
639{
640 unsigned int i;
641 extern unsigned long *sys_call_table;
642 extern unsigned long sys_ni_syscall;
643
644
645 for (i = 0; i < __NR_syscalls; i++) {
646#ifdef CONFIG_PPC64
647 if (sys_call_table[i*2] != sys_ni_syscall)
648 vdso_data->syscall_map_64[i >> 5] |=
649 0x80000000UL >> (i & 0x1f);
650 if (sys_call_table[i*2+1] != sys_ni_syscall)
651 vdso_data->syscall_map_32[i >> 5] |=
652 0x80000000UL >> (i & 0x1f);
653#else /* CONFIG_PPC64 */
654 if (sys_call_table[i] != sys_ni_syscall)
655 vdso_data->syscall_map_32[i >> 5] |=
656 0x80000000UL >> (i & 0x1f);
657#endif /* CONFIG_PPC64 */
658 }
659}
660
661
662void __init vdso_init(void)
663{
664 int i;
665
666#ifdef CONFIG_PPC64
667 /*
668 * Fill up the "systemcfg" stuff for backward compatiblity
669 */
670 strcpy(vdso_data->eye_catcher, "SYSTEMCFG:PPC64");
671 vdso_data->version.major = SYSTEMCFG_MAJOR;
672 vdso_data->version.minor = SYSTEMCFG_MINOR;
673 vdso_data->processor = mfspr(SPRN_PVR);
674 vdso_data->platform = _machine;
675 vdso_data->physicalMemorySize = lmb_phys_mem_size();
676 vdso_data->dcache_size = ppc64_caches.dsize;
677 vdso_data->dcache_line_size = ppc64_caches.dline_size;
678 vdso_data->icache_size = ppc64_caches.isize;
679 vdso_data->icache_line_size = ppc64_caches.iline_size;
680
681 /*
682 * Calculate the size of the 64 bits vDSO
683 */
684 vdso64_pages = (&vdso64_end - &vdso64_start) >> PAGE_SHIFT;
685 DBG("vdso64_kbase: %p, 0x%x pages\n", vdso64_kbase, vdso64_pages);
686#endif /* CONFIG_PPC64 */
687
688
689 /*
690 * Calculate the size of the 32 bits vDSO
691 */
692 vdso32_pages = (&vdso32_end - &vdso32_start) >> PAGE_SHIFT;
693 DBG("vdso32_kbase: %p, 0x%x pages\n", vdso32_kbase, vdso32_pages);
694
695
696 /*
697 * Setup the syscall map in the vDOS
698 */
699 vdso_setup_syscall_map();
700 /*
701 * Initialize the vDSO images in memory, that is do necessary
702 * fixups of vDSO symbols, locate trampolines, etc...
703 */
704 if (vdso_setup()) {
705 printk(KERN_ERR "vDSO setup failure, not enabled !\n");
706 vdso32_pages = 0;
707#ifdef CONFIG_PPC64
708 vdso64_pages = 0;
709#endif
710 return;
711 }
712
713 /* Make sure pages are in the correct state */
714 for (i = 0; i < vdso32_pages; i++) {
715 struct page *pg = virt_to_page(vdso32_kbase + i*PAGE_SIZE);
716 ClearPageReserved(pg);
717 get_page(pg);
718
719 }
720#ifdef CONFIG_PPC64
721 for (i = 0; i < vdso64_pages; i++) {
722 struct page *pg = virt_to_page(vdso64_kbase + i*PAGE_SIZE);
723 ClearPageReserved(pg);
724 get_page(pg);
725 }
726#endif /* CONFIG_PPC64 */
727
728 get_page(virt_to_page(vdso_data));
729}
730
731int in_gate_area_no_task(unsigned long addr)
732{
733 return 0;
734}
735
736int in_gate_area(struct task_struct *task, unsigned long addr)
737{
738 return 0;
739}
740
741struct vm_area_struct *get_gate_vma(struct task_struct *tsk)
742{
743 return NULL;
744}
745