mirror of https://github.com/torvalds/linux.git
Skirmisher reported on IRC that the 32-bit LE VDSO was hanging. This
turned out to be due to a branch to self in eg. __kernel_gettimeofday.
Looking at the disassembly with objdump -dR shows why:
00000528 <__kernel_gettimeofday>:
528: f0 ff 21 94 stwu r1,-16(r1)
52c: a6 02 08 7c mflr r0
530: f0 ff 21 94 stwu r1,-16(r1)
534: 14 00 01 90 stw r0,20(r1)
538: 05 00 9f 42 bcl 20,4*cr7+so,53c <__kernel_gettimeofday+0x14>
53c: a6 02 a8 7c mflr r5
540: ff ff a5 3c addis r5,r5,-1
544: c4 fa a5 38 addi r5,r5,-1340
548: f0 00 a5 38 addi r5,r5,240
54c: 01 00 00 48 bl 54c <__kernel_gettimeofday+0x24>
54c: R_PPC_REL24 .__c_kernel_gettimeofday
Because we don't process relocations for the VDSO, this branch remains
a branch from 0x54c to 0x54c.
With the preceding patch to prohibit R_PPC_REL24 relocations, we
instead get a build failure:
0000054c R_PPC_REL24 .__c_kernel_gettimeofday
00000598 R_PPC_REL24 .__c_kernel_clock_gettime
000005e4 R_PPC_REL24 .__c_kernel_clock_gettime64
00000630 R_PPC_REL24 .__c_kernel_clock_getres
0000067c R_PPC_REL24 .__c_kernel_time
arch/powerpc/kernel/vdso32/vdso32.so.dbg: dynamic relocations are not supported
The root cause is that we're branching to `.__c_kernel_gettimeofday`.
But this is 32-bit LE code, which doesn't use function descriptors, so
there are no dot symbols.
The reason we're trying to branch to a dot symbol is because we're
using the DOTSYM macro, but the ifdefs we use to define the DOTSYM
macro do not currently work for 32-bit LE.
So like previous commits we need to differentiate if the current
compilation unit is 64-bit, rather than the kernel as a whole. ie.
switch from CONFIG_PPC64 to __powerpc64__.
With that fixed 32-bit LE code gets the empty version of DOTSYM, which
just resolves to the original symbol name, leading to a direct branch
and no relocations:
000003f8 <__kernel_gettimeofday>:
3f8: f0 ff 21 94 stwu r1,-16(r1)
3fc: a6 02 08 7c mflr r0
400: f0 ff 21 94 stwu r1,-16(r1)
404: 14 00 01 90 stw r0,20(r1)
408: 05 00 9f 42 bcl 20,4*cr7+so,40c <__kernel_gettimeofday+0x14>
40c: a6 02 a8 7c mflr r5
410: ff ff a5 3c addis r5,r5,-1
414: f4 fb a5 38 addi r5,r5,-1036
418: f0 00 a5 38 addi r5,r5,240
41c: 85 06 00 48 bl aa0 <__c_kernel_gettimeofday>
Fixes:
|
||
|---|---|---|
| .. | ||
| book3s | ||
| nohash | ||
| vdso | ||
| 8xx_immap.h | ||
| Kbuild | ||
| accounting.h | ||
| agp.h | ||
| archrandom.h | ||
| asm-compat.h | ||
| asm-const.h | ||
| asm-offsets.h | ||
| asm-prototypes.h | ||
| async_tx.h | ||
| atomic.h | ||
| backlight.h | ||
| barrier.h | ||
| bitops.h | ||
| bootx.h | ||
| btext.h | ||
| bug.h | ||
| bugs.h | ||
| cache.h | ||
| cacheflush.h | ||
| cell-pmu.h | ||
| cell-regs.h | ||
| checksum.h | ||
| clocksource.h | ||
| cmpxchg.h | ||
| code-patching-asm.h | ||
| code-patching.h | ||
| compat.h | ||
| context_tracking.h | ||
| copro.h | ||
| cpm.h | ||
| cpm1.h | ||
| cpm2.h | ||
| cpu_has_feature.h | ||
| cpu_setup_power.h | ||
| cpufeature.h | ||
| cpuidle.h | ||
| cputable.h | ||
| cputhreads.h | ||
| cputime.h | ||
| crashdump-ppc64.h | ||
| current.h | ||
| dbdma.h | ||
| dbell.h | ||
| dcr-generic.h | ||
| dcr-mmio.h | ||
| dcr-native.h | ||
| dcr-regs.h | ||
| dcr.h | ||
| debug.h | ||
| debugfs.h | ||
| delay.h | ||
| device.h | ||
| disassemble.h | ||
| dma-direct.h | ||
| dma.h | ||
| drmem.h | ||
| dt_cpu_ftrs.h | ||
| dtl.h | ||
| edac.h | ||
| eeh.h | ||
| eeh_event.h | ||
| ehv_pic.h | ||
| elf.h | ||
| elfnote.h | ||
| emergency-restart.h | ||
| emulated_ops.h | ||
| epapr_hcalls.h | ||
| exception-64e.h | ||
| exception-64s.h | ||
| exec.h | ||
| extable.h | ||
| fadump-internal.h | ||
| fadump.h | ||
| fb.h | ||
| feature-fixups.h | ||
| firmware.h | ||
| fixmap.h | ||
| floppy.h | ||
| fs_pd.h | ||
| fsl_85xx_cache_sram.h | ||
| fsl_gtm.h | ||
| fsl_hcalls.h | ||
| fsl_lbc.h | ||
| fsl_pamu_stash.h | ||
| fsl_pm.h | ||
| ftrace.h | ||
| futex.h | ||
| grackle.h | ||
| hardirq.h | ||
| head-64.h | ||
| heathrow.h | ||
| highmem.h | ||
| hmi.h | ||
| hugetlb.h | ||
| hvcall.h | ||
| hvconsole.h | ||
| hvcserver.h | ||
| hvsi.h | ||
| hw_breakpoint.h | ||
| hw_irq.h | ||
| hydra.h | ||
| i8259.h | ||
| ibmebus.h | ||
| icswx.h | ||
| ide.h | ||
| idle.h | ||
| ima.h | ||
| imc-pmu.h | ||
| immap_cpm2.h | ||
| inst.h | ||
| io-defs.h | ||
| io-workarounds.h | ||
| io.h | ||
| io_event_irq.h | ||
| iommu.h | ||
| ipic.h | ||
| irq.h | ||
| irq_work.h | ||
| irqflags.h | ||
| isa-bridge.h | ||
| jump_label.h | ||
| kasan.h | ||
| kdebug.h | ||
| kdump.h | ||
| kexec.h | ||
| kexec_ranges.h | ||
| keylargo.h | ||
| kgdb.h | ||
| kprobes.h | ||
| kup.h | ||
| kvm_asm.h | ||
| kvm_book3s.h | ||
| kvm_book3s_32.h | ||
| kvm_book3s_64.h | ||
| kvm_book3s_asm.h | ||
| kvm_book3s_uvmem.h | ||
| kvm_booke.h | ||
| kvm_booke_hv_asm.h | ||
| kvm_fpu.h | ||
| kvm_guest.h | ||
| kvm_host.h | ||
| kvm_para.h | ||
| kvm_ppc.h | ||
| libata-portmap.h | ||
| linkage.h | ||
| livepatch.h | ||
| local.h | ||
| lppaca.h | ||
| lv1call.h | ||
| machdep.h | ||
| macio.h | ||
| mc146818rtc.h | ||
| mce.h | ||
| mediabay.h | ||
| mem_encrypt.h | ||
| membarrier.h | ||
| mman.h | ||
| mmiowb.h | ||
| mmu.h | ||
| mmu_context.h | ||
| mmzone.h | ||
| module.h | ||
| module.lds.h | ||
| mpc5xxx.h | ||
| mpc6xx.h | ||
| mpc52xx.h | ||
| mpc52xx_psc.h | ||
| mpc85xx.h | ||
| mpc5121.h | ||
| mpc8260.h | ||
| mpic.h | ||
| mpic_msgr.h | ||
| mpic_timer.h | ||
| msi_bitmap.h | ||
| nmi.h | ||
| nvram.h | ||
| ohare.h | ||
| opal-api.h | ||
| opal.h | ||
| oprofile_impl.h | ||
| paca.h | ||
| page.h | ||
| page_32.h | ||
| page_64.h | ||
| paravirt.h | ||
| parport.h | ||
| pasemi_dma.h | ||
| pci-bridge.h | ||
| pci.h | ||
| percpu.h | ||
| perf_event.h | ||
| perf_event_fsl_emb.h | ||
| perf_event_server.h | ||
| pgalloc.h | ||
| pgtable-be-types.h | ||
| pgtable-types.h | ||
| pgtable.h | ||
| pkeys.h | ||
| plpar_wrappers.h | ||
| pmac_feature.h | ||
| pmac_low_i2c.h | ||
| pmac_pfunc.h | ||
| pmc.h | ||
| pmi.h | ||
| pnv-ocxl.h | ||
| pnv-pci.h | ||
| powernv.h | ||
| ppc-opcode.h | ||
| ppc-pci.h | ||
| ppc4xx.h | ||
| ppc_asm.h | ||
| probes.h | ||
| processor.h | ||
| prom.h | ||
| ps3.h | ||
| ps3av.h | ||
| ps3gpu.h | ||
| ps3stor.h | ||
| pte-walk.h | ||
| ptrace.h | ||
| qspinlock.h | ||
| qspinlock_paravirt.h | ||
| reg.h | ||
| reg_8xx.h | ||
| reg_a2.h | ||
| reg_booke.h | ||
| reg_fsl_emb.h | ||
| rheap.h | ||
| rio.h | ||
| rtas-types.h | ||
| rtas.h | ||
| runlatch.h | ||
| seccomp.h | ||
| sections.h | ||
| secure_boot.h | ||
| security_features.h | ||
| secvar.h | ||
| serial.h | ||
| setjmp.h | ||
| setup.h | ||
| sfp-machine.h | ||
| shmparam.h | ||
| signal.h | ||
| simple_spinlock.h | ||
| simple_spinlock_types.h | ||
| slice.h | ||
| smp.h | ||
| smu.h | ||
| sparsemem.h | ||
| spinlock.h | ||
| spinlock_types.h | ||
| spu.h | ||
| spu_csa.h | ||
| spu_info.h | ||
| spu_priv1.h | ||
| sstep.h | ||
| stackprotector.h | ||
| stacktrace.h | ||
| string.h | ||
| svm.h | ||
| swab.h | ||
| swiotlb.h | ||
| switch_to.h | ||
| synch.h | ||
| syscall.h | ||
| syscalls.h | ||
| task_size_32.h | ||
| task_size_64.h | ||
| tce.h | ||
| termios.h | ||
| thread_info.h | ||
| time.h | ||
| timex.h | ||
| tlb.h | ||
| tlbflush.h | ||
| tm.h | ||
| topology.h | ||
| trace.h | ||
| trace_clock.h | ||
| tsi108.h | ||
| tsi108_irq.h | ||
| tsi108_pci.h | ||
| types.h | ||
| uaccess.h | ||
| udbg.h | ||
| uic.h | ||
| ultravisor-api.h | ||
| ultravisor.h | ||
| unaligned.h | ||
| uninorth.h | ||
| unistd.h | ||
| uprobes.h | ||
| user.h | ||
| vas.h | ||
| vdso.h | ||
| vdso_datapage.h | ||
| vermagic.h | ||
| vga.h | ||
| vio.h | ||
| vmalloc.h | ||
| word-at-a-time.h | ||
| xics.h | ||
| xive-regs.h | ||
| xive.h | ||
| xmon.h | ||
| xor.h | ||
| xor_altivec.h | ||