linux/arch/powerpc/kernel
Fangrui Song 90ceddcb49 bpf: Support llvm-objcopy for vmlinux BTF
Simplify gen_btf logic to make it work with llvm-objcopy. The existing
'file format' and 'architecture' parsing logic is brittle and does not
work with llvm-objcopy/llvm-objdump.

'file format' output of llvm-objdump>=11 will match GNU objdump, but
'architecture' (bfdarch) may not.

.BTF in .tmp_vmlinux.btf is non-SHF_ALLOC. Add the SHF_ALLOC flag
because it is part of vmlinux image used for introspection. C code
can reference the section via linker script defined __start_BTF and
__stop_BTF. This fixes a small problem that previous .BTF had the
SHF_WRITE flag (objcopy -I binary -O elf* synthesized .data).

Additionally, `objcopy -I binary` synthesized symbols
_binary__btf_vmlinux_bin_start and _binary__btf_vmlinux_bin_stop (not
used elsewhere) are replaced with more commonplace __start_BTF and
__stop_BTF.

Add 2>/dev/null because GNU objcopy (but not llvm-objcopy) warns
"empty loadable segment detected at vaddr=0xffffffff81000000, is this intentional?"

We use a dd command to change the e_type field in the ELF header from
ET_EXEC to ET_REL so that lld will accept .btf.vmlinux.bin.o.  Accepting
ET_EXEC as an input file is an extremely rare GNU ld feature that lld
does not intend to support, because this is error-prone.

The output section description .BTF in include/asm-generic/vmlinux.lds.h
avoids potential subtle orphan section placement issues and suppresses
--orphan-handling=warn warnings.

Fixes: df786c9b94 ("bpf: Force .BTF section start to zero when dumping from vmlinux")
Fixes: cb0cc635c7 ("powerpc: Include .BTF section")
Reported-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Fangrui Song <maskray@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Tested-by: Stanislav Fomichev <sdf@google.com>
Tested-by: Andrii Nakryiko <andriin@fb.com>
Reviewed-by: Stanislav Fomichev <sdf@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Link: https://github.com/ClangBuiltLinux/linux/issues/871
Link: https://lore.kernel.org/bpf/20200318222746.173648-1-maskray@google.com
2020-03-19 12:32:38 +01:00
..
syscalls threads-v5.6 2020-01-29 19:38:34 -08:00
trace powerpc/ftrace: Enable HAVE_FUNCTION_GRAPH_RET_ADDR_PTR 2019-09-18 12:24:55 +10:00
vdso32 powerpc/vdso32: miscellaneous optimisations 2020-01-23 21:31:16 +11:00
vdso64 powerpc: Fix vDSO clock_getres() 2019-12-05 00:13:55 +11:00
.gitignore powerpc: improve prom_init_check rule 2019-09-14 00:04:41 +10:00
align.c powerpc/spe: Mark expected switch fall-throughs 2019-07-31 00:19:34 +10:00
asm-offsets.c powerpc/32s: Fix DSI and ISI exceptions for CONFIG_VMAP_STACK 2020-02-18 21:31:11 +11:00
audit.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
btext.c powerpc: Rework btext_find_display to use of_stdout and device_type helpers 2018-11-26 22:33:37 +11:00
cacheinfo.c powerpc updates for 5.3 2019-07-13 16:08:36 -07:00
cacheinfo.h powerpc/cacheinfo: add cacheinfo_teardown, cacheinfo_rebuild 2019-06-15 16:52:06 +10:00
compat_audit.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cpu_setup_6xx.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
cpu_setup_44x.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
cpu_setup_fsl_booke.S powerpc/booke: Spelling s/date/data/ 2019-11-17 01:56:31 -06:00
cpu_setup_pa6t.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 333 2019-06-05 17:37:06 +02:00
cpu_setup_power.S powerpc/64s: Set reserved PCR bits 2019-09-21 08:36:53 +10:00
cpu_setup_ppc970.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
cputable.c powerpc: fix hardware PMU exception bug on PowerVM compatibility mode systems 2020-02-28 10:09:33 +11:00
crash_dump.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 230 2019-06-19 17:09:06 +02:00
dawr.c powerpc/watchpoint: Fix length calculation for unaligned target 2019-11-13 16:58:03 +11:00
dbell.c KVM: PPC: Book3S HV: use smp_mb() when setting/clearing host_ipi flag 2019-09-24 12:46:26 +10:00
dma-iommu.c powerpc updates for 5.4 2019-09-20 11:48:06 -07:00
dma-mask.c dma-mapping, powerpc: simplify the arch dma_set_mask override 2019-02-18 22:41:03 +11:00
dma-swiotlb.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
dt_cpu_ftrs.c powerpc/mm: Remove kvm radix prefetch workaround for Power9 DD2.2 2020-01-26 00:11:37 +11:00
early_32.c powerpc/fsl_booke/32: implement KASLR infrastructure 2019-11-13 19:27:40 +11:00
eeh_cache.c powerpc/eeh_cache: Don't use pci_dn when inserting new ranges 2020-01-23 21:31:18 +11:00
eeh_dev.c powerpc/eeh: Add bdfn field to eeh_dev 2019-08-22 23:12:46 +10:00
eeh_driver.c powerpc/eeh: Fix deadlock handling dead PHB 2020-02-17 12:47:05 +11:00
eeh_event.c powerpc/eeh: Fix build with STACKTRACE=n 2019-09-14 00:01:14 +10:00
eeh_pe.c powerpc/eeh: Clean up EEH PEs after recovery finishes 2019-09-05 14:22:37 +10:00
eeh_sysfs.c powerpc/eeh_sysfs: Make clearing EEH_DEV_SYSFS saner 2020-01-23 21:31:19 +11:00
eeh.c powerpc/eeh: Only dump stack once if an MMIO loop is detected 2020-01-23 21:31:20 +11:00
entry_32.S powerpc/entry: Fix an #if which should be an #ifdef in entry_32.S 2020-02-19 10:35:22 +11:00
entry_64.S powerpc updates for 5.6 2020-02-04 13:06:46 +00:00
epapr_hcalls.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
epapr_paravirt.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
exceptions-64e.S powerpc: unify definition of M_IF_NEEDED 2019-11-13 19:27:24 +11:00
exceptions-64s.S powerpc: Provide initial documentation for PAPR hcalls 2020-01-29 21:30:50 +11:00
fadump.c powerpc/fadump: when fadump is supported register the fadump sysfs files. 2019-11-13 16:58:11 +11:00
firmware.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
fpu.S powerpc/32s: Enable CONFIG_VMAP_STACK 2020-01-27 22:37:24 +11:00
fsl_booke_entry_mapping.S powerpc/fsl_booke/32: implement KASLR infrastructure 2019-11-13 19:27:40 +11:00
head_8xx.S powerpc/8xx: Fix clearing of bits 20-23 in ITLB miss 2020-02-17 12:47:06 +11:00
head_32.h powerpc/32s: Fix DSI and ISI exceptions for CONFIG_VMAP_STACK 2020-02-18 21:31:11 +11:00
head_32.S powerpc/32s: Fix DSI and ISI exceptions for CONFIG_VMAP_STACK 2020-02-18 21:31:11 +11:00
head_40x.S powerpc/32: save DEAR/DAR before calling handle_page_fault 2020-01-26 22:15:09 +11:00
head_44x.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
head_64.S powerpc/prom: convert PROM_BUG() to standard trap 2019-08-28 11:31:18 +10:00
head_booke.h powerpc/32: save DEAR/DAR before calling handle_page_fault 2020-01-26 22:15:09 +11:00
head_fsl_booke.S powerpc/32: save DEAR/DAR before calling handle_page_fault 2020-01-26 22:15:09 +11:00
hw_breakpoint.c powerpc/watchpoint: Don't call dar_within_range() for Book3S 2020-02-24 11:19:35 +11:00
idle_6xx.S powerpc/6xx: Fix power_save_ppc32_restore() with CONFIG_VMAP_STACK 2020-02-18 21:31:12 +11:00
idle_book3e.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
idle_book3s.S powerpc/64s: Reimplement power4_idle code in C 2020-01-16 14:59:37 +10:00
idle_e500.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
idle.c powerpc/64s: Reimplement power4_idle code in C 2020-01-16 14:59:37 +10:00
ima_arch.c powerpc/ima: Indicate kernel modules appended signatures are enforced 2019-11-12 12:25:50 +11:00
io-workarounds.c powerpc/mm: rework io-workaround invocation. 2019-08-27 13:03:34 +10:00
io.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
iomap.c powerpc: iomap.c: introduce io{read|write}64_{lo_hi|hi_lo} 2018-04-05 14:59:26 +10:00
iommu.c Merge branch 'topic/ppc-kvm' into next 2019-08-30 09:52:57 +10:00
irq.c powerpc/32: Use vmapped stacks for interrupts 2020-01-27 22:36:15 +11:00
isa-bridge.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
jump_label.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
kgdb.c powerpc: Activate CONFIG_THREAD_INFO_IN_TASK 2019-02-23 22:31:40 +11:00
kprobes-ftrace.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
kprobes.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
kvm_emul.S powerpc/kvm: Add ifdefs around template code 2019-09-14 00:04:40 +10:00
kvm.c powerpc/kvm: Explicitly mark kvm guest code as __init 2019-09-14 00:04:40 +10:00
l2cr_6xx.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61 2019-05-24 17:36:45 +02:00
legacy_serial.c tty/serial: Migrate 8250_fsl to use has_sysrq 2019-12-18 15:04:42 +01:00
Makefile powerpc/64s: Reimplement power4_idle code in C 2020-01-16 14:59:37 +10:00
mce_power.c powerpc/mm/mce: Keep irqs disabled during lockless page table walk 2019-09-19 21:24:59 +10:00
mce.c powerpc/64s/pseries: machine check convert to use common event code 2019-08-30 10:32:35 +10:00
misc_32.S powerpc/32: Split kexec low level code out of misc_32.S 2019-11-21 15:41:34 +11:00
misc_64.S Merge branch 'topic/kaslr-book3e32' into next 2019-11-14 19:23:33 +11:00
misc.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
module_32.c powerpc updates for 5.3 2019-07-13 16:08:36 -07:00
module_64.c powerpc updates for 5.3 2019-07-13 16:08:36 -07:00
module.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
module.lds powerpc/modules: Fix alignment of .toc section in kernel modules 2017-12-11 13:03:35 +11:00
msi.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
note.S powerpc: Add PowerPC Capabilities ELF note 2019-08-30 09:40:15 +10:00
nvram_64.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
of_platform.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
optprobes_head.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
optprobes.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
paca.c powerpc/pseries/svm: Use shared memory for LPPACA structures 2019-08-30 09:55:40 +10:00
pci_32.c powerpc/64: Adjust order in pcibios_init() 2019-08-22 23:11:48 +10:00
pci_64.c powerpc/64: Adjust order in pcibios_init() 2019-08-22 23:11:48 +10:00
pci_dn.c powerpc/pcidn: Warn when sriov pci_dn management is used incorrectly 2020-01-23 21:31:19 +11:00
pci_of_scan.c powerpc/pci: Remove pcibios_setup_bus_devices() 2020-01-06 16:25:29 +11:00
pci-common.c powerpc/pci: Fold pcibios_setup_device() into pcibios_bus_add_device() 2020-01-23 21:31:21 +11:00
pci-hotplug.c powerpc/pci: Remove pcibios_setup_bus_devices() 2020-01-06 16:25:29 +11:00
pmc.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
ppc32.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
ppc_save_regs.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
proc_powerpc.c proc: convert everything to "struct proc_ops" 2020-02-04 03:05:26 +00:00
process.c powerpc: use probe_user_read() and probe_user_write() 2020-01-26 00:11:35 +11:00
prom_init_check.sh powerpc/prom_init: Undo relocation before entering secure mode 2019-10-29 15:12:17 +11:00
prom_init.c powerpc/pseries: Enable support for ibm,drc-info property 2019-11-13 16:58:00 +11:00
prom_parse.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
prom.c powerpc/fadump: add support to preserve crash data on FADUMP disabled kernel 2019-09-14 00:04:45 +10:00
ptrace32.c
ptrace.c powerpc/watchpoint: Fix ptrace code that muck around with address/len 2019-11-13 16:58:03 +11:00
reloc_32.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
reloc_64.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
rtas_flash.c proc: convert everything to "struct proc_ops" 2020-02-04 03:05:26 +00:00
rtas_pci.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
rtas-proc.c proc: convert everything to "struct proc_ops" 2020-02-04 03:05:26 +00:00
rtas-rtc.c powerpc: use time64_t in read_persistent_clock 2018-06-03 20:43:33 +10:00
rtas.c powerpc/rtas: allow rescheduling while changing cpu states 2019-08-20 21:22:27 +10:00
rtasd.c proc: convert everything to "struct proc_ops" 2020-02-04 03:05:26 +00:00
secure_boot.c powerpc: Detect the trusted boot state of the system 2019-11-12 12:25:49 +11:00
security.c powerpc updates for 5.5 2019-11-30 14:35:43 -08:00
secvar-ops.c powerpc/powernv: Add OPAL API interface to access secure variable 2019-11-13 00:33:22 +11:00
secvar-sysfs.c powerpc: expose secure variables to userspace via sysfs 2019-11-13 00:33:22 +11:00
setup_32.c powerpc/32: Use vmapped stacks for interrupts 2020-01-27 22:36:15 +11:00
setup_64.c powerpc: align stack to 2 * THREAD_SIZE with VMAP_STACK 2020-01-26 22:15:09 +11:00
setup-common.c arch/powerpc/setup: Drop dummy_con initialization 2020-01-14 15:29:17 +01:00
setup.h powerpc/32: Add early stack overflow detection with VMAP stack. 2020-01-27 22:35:49 +11:00
signal_32.c powerpc/tm: Fix clearing MSR[TS] in current when reclaiming on signal delivery 2020-02-18 21:30:42 +11:00
signal_64.c powerpc/tm: Fix clearing MSR[TS] in current when reclaiming on signal delivery 2020-02-18 21:30:42 +11:00
signal.c powerpc/tm: Fix clearing MSR[TS] in current when reclaiming on signal delivery 2020-02-18 21:30:42 +11:00
signal.h powerpc/syscalls: signal_{32, 64} - switch to SYSCALL_DEFINE 2018-05-10 23:25:13 +10:00
smp-tbsync.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
smp.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
stacktrace.c powerpc/ftrace: Enable HAVE_FUNCTION_GRAPH_RET_ADDR_PTR 2019-09-18 12:24:55 +10:00
suspend.c PM: hibernate: powerpc: Expose pfn_is_nosave() prototype 2019-06-14 10:48:56 +02:00
swsusp_32.S powerpc/32s: fix suspend/resume when IBATs 4-7 are used 2019-06-19 20:05:07 +10:00
swsusp_64.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 505 2019-06-19 17:11:22 +02:00
swsusp_asm64.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 505 2019-06-19 17:11:22 +02:00
swsusp_booke.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
swsusp.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
sys_ppc32.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
syscalls.c y2038: syscalls: change remaining timeval to __kernel_old_timeval 2019-11-15 14:38:29 +01:00
sysfs.c powerpc/pseries/svm: Export guest SVM status to user space via sysfs 2019-08-30 09:55:41 +10:00
systbl_chk.sh treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
systbl.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
tau_6xx.c powerpc/tau: Make some function static 2018-05-25 12:04:44 +10:00
time.c powerpc: Fix vDSO clock_getres() 2019-12-05 00:13:55 +11:00
tm.S powerpc/tm: update comment about interrupt re-entrancy 2019-07-02 21:39:49 +10:00
traps.c powerpc/32: Add early stack overflow detection with VMAP stack. 2020-01-27 22:35:49 +11:00
ucall.S powerpc/kernel: Add ucall_norets() ultravisor call handler 2019-08-30 09:40:15 +10:00
udbg_16550.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
udbg.c powerpc/udbg: Make it safe to call udbg_printf() always 2019-10-11 19:33:25 +11:00
uprobes.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
vdso.c powerpc/vdso32: Don't read cache line size from the datapage on PPC32. 2020-01-23 21:31:15 +11:00
vecemu.c powerpc: Add a missing include header 2018-05-25 12:04:46 +10:00
vector.S powerpc/32s: Enable CONFIG_VMAP_STACK 2020-01-27 22:37:24 +11:00
vmlinux.lds.S bpf: Support llvm-objcopy for vmlinux BTF 2020-03-19 12:32:38 +01:00
watchdog.c powerpc/watchdog: Use hrtimers for per-CPU heartbeat 2019-04-30 11:31:02 +10:00