linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Josh Poimboeuf <jpoimboe@redhat.com>,
	Borislav Petkov <bp@suse.de>, Miroslav Benes <mbenes@suse.cz>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.6 081/106] objtool: Support Clang non-section symbols in ORC dump
Date: Fri,  1 May 2020 15:23:54 +0200	[thread overview]
Message-ID: <20200501131553.487022224@linuxfoundation.org> (raw)
In-Reply-To: <20200501131543.421333643@linuxfoundation.org>

From: Josh Poimboeuf <jpoimboe@redhat.com>

[ Upstream commit 8782e7cab51b6bf01a5a86471dd82228af1ac185 ]

Historically, the relocation symbols for ORC entries have only been
section symbols:

  .text+0: sp:sp+8 bp:(und) type:call end:0

However, the Clang assembler is aggressive about stripping section
symbols.  In that case we will need to use function symbols:

  freezing_slow_path+0: sp:sp+8 bp:(und) type:call end:0

In preparation for the generation of such entries in "objtool orc
generate", add support for reading them in "objtool orc dump".

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Miroslav Benes <mbenes@suse.cz>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/b811b5eb1a42602c3b523576dc5efab9ad1c174d.1585761021.git.jpoimboe@redhat.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 tools/objtool/orc_dump.c | 44 ++++++++++++++++++++++++----------------
 1 file changed, 27 insertions(+), 17 deletions(-)

diff --git a/tools/objtool/orc_dump.c b/tools/objtool/orc_dump.c
index 13ccf775a83a4..ba4cbb1cdd632 100644
--- a/tools/objtool/orc_dump.c
+++ b/tools/objtool/orc_dump.c
@@ -66,7 +66,7 @@ int orc_dump(const char *_objname)
 	char *name;
 	size_t nr_sections;
 	Elf64_Addr orc_ip_addr = 0;
-	size_t shstrtab_idx;
+	size_t shstrtab_idx, strtab_idx = 0;
 	Elf *elf;
 	Elf_Scn *scn;
 	GElf_Shdr sh;
@@ -127,6 +127,8 @@ int orc_dump(const char *_objname)
 
 		if (!strcmp(name, ".symtab")) {
 			symtab = data;
+		} else if (!strcmp(name, ".strtab")) {
+			strtab_idx = i;
 		} else if (!strcmp(name, ".orc_unwind")) {
 			orc = data->d_buf;
 			orc_size = sh.sh_size;
@@ -138,7 +140,7 @@ int orc_dump(const char *_objname)
 		}
 	}
 
-	if (!symtab || !orc || !orc_ip)
+	if (!symtab || !strtab_idx || !orc || !orc_ip)
 		return 0;
 
 	if (orc_size % sizeof(*orc) != 0) {
@@ -159,21 +161,29 @@ int orc_dump(const char *_objname)
 				return -1;
 			}
 
-			scn = elf_getscn(elf, sym.st_shndx);
-			if (!scn) {
-				WARN_ELF("elf_getscn");
-				return -1;
-			}
-
-			if (!gelf_getshdr(scn, &sh)) {
-				WARN_ELF("gelf_getshdr");
-				return -1;
-			}
-
-			name = elf_strptr(elf, shstrtab_idx, sh.sh_name);
-			if (!name || !*name) {
-				WARN_ELF("elf_strptr");
-				return -1;
+			if (GELF_ST_TYPE(sym.st_info) == STT_SECTION) {
+				scn = elf_getscn(elf, sym.st_shndx);
+				if (!scn) {
+					WARN_ELF("elf_getscn");
+					return -1;
+				}
+
+				if (!gelf_getshdr(scn, &sh)) {
+					WARN_ELF("gelf_getshdr");
+					return -1;
+				}
+
+				name = elf_strptr(elf, shstrtab_idx, sh.sh_name);
+				if (!name) {
+					WARN_ELF("elf_strptr");
+					return -1;
+				}
+			} else {
+				name = elf_strptr(elf, strtab_idx, sym.st_name);
+				if (!name) {
+					WARN_ELF("elf_strptr");
+					return -1;
+				}
 			}
 
 			printf("%s+%llx:", name, (unsigned long long)rela.r_addend);
-- 
2.20.1




  parent reply	other threads:[~2020-05-01 13:47 UTC|newest]

Thread overview: 115+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-01 13:22 [PATCH 5.6 000/106] 5.6.9-rc1 review Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.6 001/106] ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans() Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.6 002/106] printk: queue wake_up_klogd irq_work only if per-CPU areas are ready Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.6 003/106] ASoC: stm32: sai: fix sai probe Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.6 004/106] usb: dwc3: gadget: Do link recovery for SS and SSP Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.6 005/106] ARM: dts: bcm283x: Add cells encoding format to firmware bus Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.6 006/106] kbuild: fix DT binding schema rule again to avoid needless rebuilds Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.6 007/106] usb: gadget: udc: bdc: Remove unnecessary NULL checks in bdc_req_complete Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.6 008/106] usb: gadget: udc: atmel: Fix vbus disconnect handling Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.6 009/106] afs: Make record checking use TASK_UNINTERRUPTIBLE when appropriate Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.6 010/106] afs: Fix to actually set AFS_SERVER_FL_HAVE_EPOCH Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.6 011/106] iio:ad7797: Use correct attribute_group Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.6 012/106] iio: imu: st_lsm6dsx: fix read misalignment on untagged FIFO Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.6 013/106] iio: imu: st_lsm6dsx: specify slave odr in slv_odr Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.6 014/106] propagate_one(): mnt_set_mountpoint() needs mount_lock Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.6 015/106] counter: 104-quad-8: Add lock guards - generic interface Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.6 016/106] s390/ftrace: fix potential crashes when switching tracers Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.6 017/106] ASoC: q6dsp6: q6afe-dai: add missing channels to MI2S DAIs Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.6 018/106] iwlwifi: actually check allocated conf_tlv pointer Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.6 019/106] ASoC: samsung: s3c24xx-i2s: Fix build after removal of DAI suspend/resume Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.6 020/106] ASoC: tas571x: disable regulators on failed probe Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.6 021/106] ASoC: meson: axg-card: fix codec-to-codec link setup Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.6 022/106] ASoC: wm8960: Fix wrong clock after suspend & resume Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.6 023/106] drivers: soc: xilinx: fix firmware driver Kconfig dependency Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.6 024/106] nfsd: memory corruption in nfsd4_lock() Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.6 025/106] ARM: dts: OMAP3: disable RNG on N950/N9 Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.6 026/106] bpf: Forbid XADD on spilled pointers for unprivileged users Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 027/106] brcmfmac: add stub for monitor interface xmit Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 028/106] i2c: altera: use proper variable to hold errno Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 029/106] hwmon: (drivetemp) Use drivetemps true module name in Kconfig section Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 030/106] clk: asm9260: fix __clk_hw_register_fixed_rate_with_accuracy typo Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 031/106] rtw88: avoid unused function warnings Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 032/106] hwmon: (drivetemp) Return -ENODATA for invalid temperatures Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 033/106] rxrpc: Fix DATA Tx to disable nofrag for UDP on AF_INET6 socket Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 034/106] netfilter: nf_tables: reintroduce the NFT_SET_CONCAT flag Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 035/106] efi/x86: Dont remap text<->rodata gap read-only for mixed mode Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 036/106] net/cxgb4: Check the return from t4_query_params properly Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 037/106] tipc: fix incorrect increasing of link window Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 038/106] xfs: acquire superblock freeze protection on eofblocks scans Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 039/106] svcrdma: Fix trace point use-after-free race Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 040/106] svcrdma: Fix leak of svc_rdma_recv_ctxt objects Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 041/106] net/mlx5e: Dont trigger IRQ multiple times on XSK wakeup to avoid WQ overruns Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 042/106] net/mlx5e: Get the latest values from counters in switchdev mode Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 043/106] PCI: Avoid ASMedia XHCI USB PME# from D0 defect Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 044/106] PCI: Add Zhaoxin Vendor ID Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 045/106] PCI: Add ACS quirk for Zhaoxin multi-function devices Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 046/106] PCI: Add ACS quirk for Zhaoxin Root/Downstream Ports Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 047/106] PCI: Move Apex Edge TPU class quirk to fix BAR assignment Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 048/106] ARM: dts: bcm283x: Disable dsi0 node Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 049/106] cpumap: Avoid warning when CONFIG_DEBUG_PER_CPU_MAPS is enabled Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 050/106] s390/pci: do not set affinity for floating irqs Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 051/106] remoteproc: mtk_scp: use dma_addr_t for DMA API Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 052/106] net/mlx5: Fix failing fw tracer allocation on s390 Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 053/106] sched/core: Fix reset-on-fork from RT with uclamp Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 054/106] perf/core: fix parent pid/tid in task exit events Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 055/106] netfilter: nat: fix error handling upon registering inet hook Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 056/106] PM: sleep: core: Switch back to async_schedule_dev() Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 057/106] blk-iocost: Fix error on iocost_ioc_vrate_adj Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 058/106] um: ensure `make ARCH=um mrproper` removes arch/$(SUBARCH)/include/generated/ Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 059/106] bpf: Fix handling of XADD on BTF memory Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 060/106] bpf, x86: Fix encoding for lower 8-bit registers in BPF_STX BPF_B Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 061/106] bpf, x86_32: Fix incorrect encoding in BPF_LDX zero-extension Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 062/106] bpf, x86_32: Fix clobbering of dst for BPF_JSET Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 063/106] bpf, x86_32: Fix logic error in BPF_LDX zero-extension Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 064/106] bpf: Propagate expected_attach_type when verifying freplace programs Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 065/106] selftests/bpf: Fix a couple of broken test_btf cases Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 066/106] mm: shmem: disable interrupt when acquiring info->lock in userfaultfd_copy path Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 067/106] xfs: clear PF_MEMALLOC before exiting xfsaild thread Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 068/106] libbpf: Initialize *nl_pid so gcc 10 is happy Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 069/106] net: fec: set GPR bit on suspend by DT configuration Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 070/106] x86: hyperv: report value of misc_features Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 071/106] signal: check sig before setting info in kill_pid_usb_asyncio Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 072/106] afs: Fix length of dump of bad YFSFetchStatus record Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 073/106] xfs: fix partially uninitialized structure in xfs_reflink_remap_extent Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 074/106] ALSA: hda: Release resources at error in delayed probe Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 075/106] ALSA: hda: Keep the controller initialization even if no codecs found Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 076/106] ALSA: hda: Explicitly permit using autosuspend if runtime PM is supported Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 077/106] drm/amdgpu: fix wrong vram lost counter increment V2 Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 078/106] scsi: target: fix PR IN / READ FULL STATUS for FC Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 079/106] scsi: target: tcmu: reset_ring should reset TCMU_DEV_BIT_BROKEN Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 080/106] objtool: Fix CONFIG_UBSAN_TRAP unreachable warnings Greg Kroah-Hartman
2020-05-01 13:23 ` Greg Kroah-Hartman [this message]
2020-05-01 13:23 ` [PATCH 5.6 082/106] xen/xenbus: ensure xenbus_map_ring_valloc() returns proper grant status Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 083/106] ALSA: hda: call runtime_allow() for all hda controllers Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 084/106] net: stmmac: socfpga: Allow all RGMII modes Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 085/106] mac80211: fix channel switch trigger from unknown mesh peer Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.6 086/106] sched/isolation: Allow "isolcpus=" to skip unknown sub-parameters Greg Kroah-Hartman
2020-05-01 13:24 ` [PATCH 5.6 087/106] sched/vtime: Work around an unitialized variable warning Greg Kroah-Hartman
2020-05-01 13:24 ` [PATCH 5.6 088/106] arm64: Delete the space separator in __emit_inst Greg Kroah-Hartman
2020-05-01 13:24 ` [PATCH 5.6 089/106] ext4: use matching invalidatepage in ext4_writepage Greg Kroah-Hartman
2020-05-01 13:24 ` [PATCH 5.6 090/106] ext4: increase wait time needed before reuse of deleted inode numbers Greg Kroah-Hartman
2020-05-01 13:24 ` [PATCH 5.6 091/106] ext4: convert BUG_ONs to WARN_ONs in mballoc.c Greg Kroah-Hartman
2020-05-01 13:24 ` [PATCH 5.6 092/106] irqchip/gic-v4.1: Add support for VPENDBASERs Dirty+Valid signaling Greg Kroah-Hartman
2020-05-01 13:24 ` [PATCH 5.6 093/106] blk-mq: Put driver tag in blk_mq_dispatch_rq_list() when no budget Greg Kroah-Hartman
2020-05-01 13:24 ` [PATCH 5.6 094/106] irqchip/meson-gpio: Fix HARDIRQ-safe -> HARDIRQ-unsafe lock order Greg Kroah-Hartman
2020-05-01 13:24 ` [PATCH 5.6 095/106] hwmon: (jc42) Fix name to have no illegal characters Greg Kroah-Hartman
2020-05-01 13:24 ` [PATCH 5.6 096/106] sfc: fix XDP-redirect in this driver Greg Kroah-Hartman
2020-05-01 13:24 ` [PATCH 5.6 097/106] taprio: do not use BIT() in TCA_TAPRIO_ATTR_FLAG_* definitions Greg Kroah-Hartman
2020-05-01 13:24 ` [PATCH 5.6 098/106] tipc: Add a missing case of TIPC_DIRECT_MSG type Greg Kroah-Hartman
2020-05-01 13:24 ` [PATCH 5.6 099/106] qed: Fix race condition between scheduling and destroying the slowpath workqueue Greg Kroah-Hartman
2020-05-01 13:24 ` [PATCH 5.6 100/106] Crypto: chelsio - Fixes a hang issue during driver registration Greg Kroah-Hartman
2020-05-01 13:24 ` [PATCH 5.6 101/106] net: use indirect call wrappers for skb_copy_datagram_iter() Greg Kroah-Hartman
2020-05-01 13:24 ` [PATCH 5.6 102/106] qed: Fix use after free in qed_chain_free Greg Kroah-Hartman
2020-05-01 13:24 ` [PATCH 5.6 103/106] ext4: check for non-zero journal inum in ext4_calculate_overhead Greg Kroah-Hartman
2020-05-01 13:24 ` [PATCH 5.6 104/106] ASoC: soc-pcm: fix regression in soc_new_pcm() Greg Kroah-Hartman
2020-05-01 13:24 ` [PATCH 5.6 105/106] ASoC: soc-core: disable route checks for legacy devices Greg Kroah-Hartman
2020-05-01 13:24 ` [PATCH 5.6 106/106] ASoC: stm32: spdifrx: fix regmap status check Greg Kroah-Hartman
2020-05-01 15:17 ` [PATCH 5.6 000/106] 5.6.9-rc1 review Jon Hunter
2020-05-02  5:58   ` Greg Kroah-Hartman
2020-05-01 21:57 ` Naresh Kamboju
2020-05-01 22:18 ` Guenter Roeck
2020-05-02  6:17   ` Greg Kroah-Hartman
2020-05-02  7:15 ` Greg Kroah-Hartman
2020-05-02 23:14 ` shuah
2020-05-03  7:14   ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200501131553.487022224@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=bp@suse.de \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=peterz@infradead.org \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).