Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+46 -3
+2 -1
arch/powerpc/kernel/Makefile
··· 33 33 signal.o sysfs.o cacheinfo.o time.o \ 34 34 prom.o traps.o setup-common.o \ 35 35 udbg.o misc.o io.o dma.o \ 36 - misc_$(CONFIG_WORD_SIZE).o vdso32/ \ 36 + misc_$(CONFIG_WORD_SIZE).o \ 37 37 of_platform.o prom_parse.o 38 38 obj-$(CONFIG_PPC64) += setup_64.o sys_ppc32.o \ 39 39 signal_64.o ptrace32.o \ 40 40 paca.o nvram_64.o firmware.o 41 + obj-$(CONFIG_VDSO32) += vdso32/ 41 42 obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o 42 43 obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_ppc970.o cpu_setup_pa6t.o 43 44 obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_power.o
+34 -2
arch/powerpc/kernel/vdso.c
··· 49 49 /* The alignment of the vDSO */ 50 50 #define VDSO_ALIGNMENT (1 << 16) 51 51 52 - extern char vdso32_start, vdso32_end; 53 - static void *vdso32_kbase = &vdso32_start; 54 52 static unsigned int vdso32_pages; 53 + static void *vdso32_kbase; 55 54 static struct page **vdso32_pagelist; 56 55 unsigned long vdso32_sigtramp; 57 56 unsigned long vdso32_rt_sigtramp; 57 + 58 + #ifdef CONFIG_VDSO32 59 + extern char vdso32_start, vdso32_end; 60 + #endif 58 61 59 62 #ifdef CONFIG_PPC64 60 63 extern char vdso64_start, vdso64_end; ··· 251 248 252 249 253 250 251 + #ifdef CONFIG_VDSO32 254 252 static void * __init find_section32(Elf32_Ehdr *ehdr, const char *secname, 255 253 unsigned long *size) 256 254 { ··· 339 335 340 336 return 0; 341 337 } 338 + #else /* !CONFIG_VDSO32 */ 339 + static unsigned long __init find_function32(struct lib32_elfinfo *lib, 340 + const char *symname) 341 + { 342 + return 0; 343 + } 344 + 345 + static int __init vdso_do_func_patch32(struct lib32_elfinfo *v32, 346 + struct lib64_elfinfo *v64, 347 + const char *orig, const char *fix) 348 + { 349 + return 0; 350 + } 351 + #endif /* CONFIG_VDSO32 */ 342 352 343 353 344 354 #ifdef CONFIG_PPC64 ··· 463 445 * Locate symbol tables & text section 464 446 */ 465 447 448 + #ifdef CONFIG_VDSO32 466 449 v32->dynsym = find_section32(v32->hdr, ".dynsym", &v32->dynsymsize); 467 450 v32->dynstr = find_section32(v32->hdr, ".dynstr", NULL); 468 451 if (v32->dynsym == NULL || v32->dynstr == NULL) { ··· 476 457 return -1; 477 458 } 478 459 v32->text = sect - vdso32_kbase; 460 + #endif 479 461 480 462 #ifdef CONFIG_PPC64 481 463 v64->dynsym = find_section64(v64->hdr, ".dynsym", &v64->dynsymsize); ··· 513 493 static __init int vdso_fixup_datapage(struct lib32_elfinfo *v32, 514 494 struct lib64_elfinfo *v64) 515 495 { 496 + #ifdef CONFIG_VDSO32 516 497 Elf32_Sym *sym32; 498 + #endif 517 499 #ifdef CONFIG_PPC64 518 500 Elf64_Sym *sym64; 519 501 ··· 530 508 (sym64->st_value - VDSO64_LBASE); 531 509 #endif /* CONFIG_PPC64 */ 532 510 511 + #ifdef CONFIG_VDSO32 533 512 sym32 = find_symbol32(v32, "__kernel_datapage_offset"); 534 513 if (sym32 == NULL) { 535 514 printk(KERN_ERR "vDSO32: Can't find symbol " ··· 540 517 *((int *)(vdso32_kbase + (sym32->st_value - VDSO32_LBASE))) = 541 518 (vdso32_pages << PAGE_SHIFT) - 542 519 (sym32->st_value - VDSO32_LBASE); 520 + #endif 543 521 544 522 return 0; 545 523 } ··· 574 550 start, start + size); 575 551 #endif /* CONFIG_PPC64 */ 576 552 553 + #ifdef CONFIG_VDSO32 577 554 start = find_section32(v32->hdr, "__ftr_fixup", &size); 578 555 if (start) 579 556 do_feature_fixups(cur_cpu_spec->cpu_features, ··· 596 571 if (start) 597 572 do_lwsync_fixups(cur_cpu_spec->cpu_features, 598 573 start, start + size); 574 + #endif 599 575 600 576 return 0; 601 577 } ··· 758 732 #endif /* CONFIG_PPC64 */ 759 733 760 734 735 + #ifdef CONFIG_VDSO32 736 + vdso32_kbase = &vdso32_start; 737 + 761 738 /* 762 739 * Calculate the size of the 32 bits vDSO 763 740 */ 764 741 vdso32_pages = (&vdso32_end - &vdso32_start) >> PAGE_SHIFT; 765 742 DBG("vdso32_kbase: %p, 0x%x pages\n", vdso32_kbase, vdso32_pages); 743 + #endif 766 744 767 745 768 746 /* ··· 787 757 return 0; 788 758 } 789 759 760 + #ifdef CONFIG_VDSO32 790 761 /* Make sure pages are in the correct state */ 791 762 vdso32_pagelist = kzalloc(sizeof(struct page *) * (vdso32_pages + 2), 792 763 GFP_KERNEL); ··· 800 769 } 801 770 vdso32_pagelist[i++] = virt_to_page(vdso_data); 802 771 vdso32_pagelist[i] = NULL; 772 + #endif 803 773 804 774 #ifdef CONFIG_PPC64 805 775 vdso64_pagelist = kzalloc(sizeof(struct page *) * (vdso64_pages + 2),
+10
arch/powerpc/platforms/Kconfig.cputype
··· 405 405 406 406 endmenu 407 407 408 + config VDSO32 409 + def_bool y 410 + depends on PPC32 || CPU_BIG_ENDIAN 411 + help 412 + This symbol controls whether we build the 32-bit VDSO. We obviously 413 + want to do that if we're building a 32-bit kernel. If we're building 414 + a 64-bit kernel then we only want a 32-bit VDSO if we're building for 415 + big endian. That is because the only little endian configuration we 416 + support is ppc64le which is 64-bit only. 417 + 408 418 choice 409 419 prompt "Endianness selection" 410 420 default CPU_BIG_ENDIAN