diff options
author | Michael Ellerman <mpe@ellerman.id.au> | 2015-05-11 06:01:02 -0400 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2015-05-11 06:01:02 -0400 |
commit | e0d0059169945c8ee16790d2e7244cea397dfd56 (patch) | |
tree | db50205e4996c17264c9279b1bc7370fdbaf9802 /arch/powerpc/kernel/vdso.c | |
parent | 6e5c077519f2661c56647fc21b2ec2ba0a50bb75 (diff) |
powerpc/vdso: Disable building the 32-bit VDSO on little endian
The only little endian configuration we support is ppc64le. As such if
we're building little endian we don't need a 32-bit VDSO, because there
is no 32-bit userspace.
This patch is a fairly ugly mess of #ifdefs, but is the minimal logic
required to disable the 32-bit VDSO. We can hopefully clean up the
result in future with some further refactoring.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/kernel/vdso.c')
-rw-r--r-- | arch/powerpc/kernel/vdso.c | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c index 8331d0bef0fb..b457bfa28436 100644 --- a/arch/powerpc/kernel/vdso.c +++ b/arch/powerpc/kernel/vdso.c | |||
@@ -49,13 +49,16 @@ | |||
49 | /* The alignment of the vDSO */ | 49 | /* The alignment of the vDSO */ |
50 | #define VDSO_ALIGNMENT (1 << 16) | 50 | #define VDSO_ALIGNMENT (1 << 16) |
51 | 51 | ||
52 | extern char vdso32_start, vdso32_end; | ||
53 | static void *vdso32_kbase = &vdso32_start; | ||
54 | static unsigned int vdso32_pages; | 52 | static unsigned int vdso32_pages; |
53 | static void *vdso32_kbase; | ||
55 | static struct page **vdso32_pagelist; | 54 | static struct page **vdso32_pagelist; |
56 | unsigned long vdso32_sigtramp; | 55 | unsigned long vdso32_sigtramp; |
57 | unsigned long vdso32_rt_sigtramp; | 56 | unsigned long vdso32_rt_sigtramp; |
58 | 57 | ||
58 | #ifdef CONFIG_VDSO32 | ||
59 | extern char vdso32_start, vdso32_end; | ||
60 | #endif | ||
61 | |||
59 | #ifdef CONFIG_PPC64 | 62 | #ifdef CONFIG_PPC64 |
60 | extern char vdso64_start, vdso64_end; | 63 | extern char vdso64_start, vdso64_end; |
61 | static void *vdso64_kbase = &vdso64_start; | 64 | static void *vdso64_kbase = &vdso64_start; |
@@ -248,6 +251,7 @@ const char *arch_vma_name(struct vm_area_struct *vma) | |||
248 | 251 | ||
249 | 252 | ||
250 | 253 | ||
254 | #ifdef CONFIG_VDSO32 | ||
251 | static void * __init find_section32(Elf32_Ehdr *ehdr, const char *secname, | 255 | static void * __init find_section32(Elf32_Ehdr *ehdr, const char *secname, |
252 | unsigned long *size) | 256 | unsigned long *size) |
253 | { | 257 | { |
@@ -335,6 +339,20 @@ static int __init vdso_do_func_patch32(struct lib32_elfinfo *v32, | |||
335 | 339 | ||
336 | return 0; | 340 | return 0; |
337 | } | 341 | } |
342 | #else /* !CONFIG_VDSO32 */ | ||
343 | static unsigned long __init find_function32(struct lib32_elfinfo *lib, | ||
344 | const char *symname) | ||
345 | { | ||
346 | return 0; | ||
347 | } | ||
348 | |||
349 | static int __init vdso_do_func_patch32(struct lib32_elfinfo *v32, | ||
350 | struct lib64_elfinfo *v64, | ||
351 | const char *orig, const char *fix) | ||
352 | { | ||
353 | return 0; | ||
354 | } | ||
355 | #endif /* CONFIG_VDSO32 */ | ||
338 | 356 | ||
339 | 357 | ||
340 | #ifdef CONFIG_PPC64 | 358 | #ifdef CONFIG_PPC64 |
@@ -445,6 +463,7 @@ static __init int vdso_do_find_sections(struct lib32_elfinfo *v32, | |||
445 | * Locate symbol tables & text section | 463 | * Locate symbol tables & text section |
446 | */ | 464 | */ |
447 | 465 | ||
466 | #ifdef CONFIG_VDSO32 | ||
448 | v32->dynsym = find_section32(v32->hdr, ".dynsym", &v32->dynsymsize); | 467 | v32->dynsym = find_section32(v32->hdr, ".dynsym", &v32->dynsymsize); |
449 | v32->dynstr = find_section32(v32->hdr, ".dynstr", NULL); | 468 | v32->dynstr = find_section32(v32->hdr, ".dynstr", NULL); |
450 | if (v32->dynsym == NULL || v32->dynstr == NULL) { | 469 | if (v32->dynsym == NULL || v32->dynstr == NULL) { |
@@ -457,6 +476,7 @@ static __init int vdso_do_find_sections(struct lib32_elfinfo *v32, | |||
457 | return -1; | 476 | return -1; |
458 | } | 477 | } |
459 | v32->text = sect - vdso32_kbase; | 478 | v32->text = sect - vdso32_kbase; |
479 | #endif | ||
460 | 480 | ||
461 | #ifdef CONFIG_PPC64 | 481 | #ifdef CONFIG_PPC64 |
462 | v64->dynsym = find_section64(v64->hdr, ".dynsym", &v64->dynsymsize); | 482 | v64->dynsym = find_section64(v64->hdr, ".dynsym", &v64->dynsymsize); |
@@ -493,7 +513,9 @@ static __init void vdso_setup_trampolines(struct lib32_elfinfo *v32, | |||
493 | static __init int vdso_fixup_datapage(struct lib32_elfinfo *v32, | 513 | static __init int vdso_fixup_datapage(struct lib32_elfinfo *v32, |
494 | struct lib64_elfinfo *v64) | 514 | struct lib64_elfinfo *v64) |
495 | { | 515 | { |
516 | #ifdef CONFIG_VDSO32 | ||
496 | Elf32_Sym *sym32; | 517 | Elf32_Sym *sym32; |
518 | #endif | ||
497 | #ifdef CONFIG_PPC64 | 519 | #ifdef CONFIG_PPC64 |
498 | Elf64_Sym *sym64; | 520 | Elf64_Sym *sym64; |
499 | 521 | ||
@@ -508,6 +530,7 @@ static __init int vdso_fixup_datapage(struct lib32_elfinfo *v32, | |||
508 | (sym64->st_value - VDSO64_LBASE); | 530 | (sym64->st_value - VDSO64_LBASE); |
509 | #endif /* CONFIG_PPC64 */ | 531 | #endif /* CONFIG_PPC64 */ |
510 | 532 | ||
533 | #ifdef CONFIG_VDSO32 | ||
511 | sym32 = find_symbol32(v32, "__kernel_datapage_offset"); | 534 | sym32 = find_symbol32(v32, "__kernel_datapage_offset"); |
512 | if (sym32 == NULL) { | 535 | if (sym32 == NULL) { |
513 | printk(KERN_ERR "vDSO32: Can't find symbol " | 536 | printk(KERN_ERR "vDSO32: Can't find symbol " |
@@ -517,6 +540,7 @@ static __init int vdso_fixup_datapage(struct lib32_elfinfo *v32, | |||
517 | *((int *)(vdso32_kbase + (sym32->st_value - VDSO32_LBASE))) = | 540 | *((int *)(vdso32_kbase + (sym32->st_value - VDSO32_LBASE))) = |
518 | (vdso32_pages << PAGE_SHIFT) - | 541 | (vdso32_pages << PAGE_SHIFT) - |
519 | (sym32->st_value - VDSO32_LBASE); | 542 | (sym32->st_value - VDSO32_LBASE); |
543 | #endif | ||
520 | 544 | ||
521 | return 0; | 545 | return 0; |
522 | } | 546 | } |
@@ -550,6 +574,7 @@ static __init int vdso_fixup_features(struct lib32_elfinfo *v32, | |||
550 | start, start + size); | 574 | start, start + size); |
551 | #endif /* CONFIG_PPC64 */ | 575 | #endif /* CONFIG_PPC64 */ |
552 | 576 | ||
577 | #ifdef CONFIG_VDSO32 | ||
553 | start = find_section32(v32->hdr, "__ftr_fixup", &size); | 578 | start = find_section32(v32->hdr, "__ftr_fixup", &size); |
554 | if (start) | 579 | if (start) |
555 | do_feature_fixups(cur_cpu_spec->cpu_features, | 580 | do_feature_fixups(cur_cpu_spec->cpu_features, |
@@ -571,6 +596,7 @@ static __init int vdso_fixup_features(struct lib32_elfinfo *v32, | |||
571 | if (start) | 596 | if (start) |
572 | do_lwsync_fixups(cur_cpu_spec->cpu_features, | 597 | do_lwsync_fixups(cur_cpu_spec->cpu_features, |
573 | start, start + size); | 598 | start, start + size); |
599 | #endif | ||
574 | 600 | ||
575 | return 0; | 601 | return 0; |
576 | } | 602 | } |
@@ -732,11 +758,15 @@ static int __init vdso_init(void) | |||
732 | #endif /* CONFIG_PPC64 */ | 758 | #endif /* CONFIG_PPC64 */ |
733 | 759 | ||
734 | 760 | ||
761 | #ifdef CONFIG_VDSO32 | ||
762 | vdso32_kbase = &vdso32_start; | ||
763 | |||
735 | /* | 764 | /* |
736 | * Calculate the size of the 32 bits vDSO | 765 | * Calculate the size of the 32 bits vDSO |
737 | */ | 766 | */ |
738 | vdso32_pages = (&vdso32_end - &vdso32_start) >> PAGE_SHIFT; | 767 | vdso32_pages = (&vdso32_end - &vdso32_start) >> PAGE_SHIFT; |
739 | DBG("vdso32_kbase: %p, 0x%x pages\n", vdso32_kbase, vdso32_pages); | 768 | DBG("vdso32_kbase: %p, 0x%x pages\n", vdso32_kbase, vdso32_pages); |
769 | #endif | ||
740 | 770 | ||
741 | 771 | ||
742 | /* | 772 | /* |
@@ -757,6 +787,7 @@ static int __init vdso_init(void) | |||
757 | return 0; | 787 | return 0; |
758 | } | 788 | } |
759 | 789 | ||
790 | #ifdef CONFIG_VDSO32 | ||
760 | /* Make sure pages are in the correct state */ | 791 | /* Make sure pages are in the correct state */ |
761 | vdso32_pagelist = kzalloc(sizeof(struct page *) * (vdso32_pages + 2), | 792 | vdso32_pagelist = kzalloc(sizeof(struct page *) * (vdso32_pages + 2), |
762 | GFP_KERNEL); | 793 | GFP_KERNEL); |
@@ -769,6 +800,7 @@ static int __init vdso_init(void) | |||
769 | } | 800 | } |
770 | vdso32_pagelist[i++] = virt_to_page(vdso_data); | 801 | vdso32_pagelist[i++] = virt_to_page(vdso_data); |
771 | vdso32_pagelist[i] = NULL; | 802 | vdso32_pagelist[i] = NULL; |
803 | #endif | ||
772 | 804 | ||
773 | #ifdef CONFIG_PPC64 | 805 | #ifdef CONFIG_PPC64 |
774 | vdso64_pagelist = kzalloc(sizeof(struct page *) * (vdso64_pages + 2), | 806 | vdso64_pagelist = kzalloc(sizeof(struct page *) * (vdso64_pages + 2), |