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, Masami Hiramatsu <mhiramat@kernel.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Will Deacon <will@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Marc Zyngier <maz@kernel.org>, Sasha Levin <sashal@kernel.org>
Subject: [PATCH 4.19 51/79] kallsyms: Dont let kallsyms_lookup_size_offset() fail on retrieving the first symbol
Date: Fri, 20 Sep 2019 00:03:36 +0200	[thread overview]
Message-ID: <20190919214811.975668286@linuxfoundation.org> (raw)
In-Reply-To: <20190919214807.612593061@linuxfoundation.org>

From: Marc Zyngier <maz@kernel.org>

[ Upstream commit 2a1a3fa0f29270583f0e6e3100d609e09697add1 ]

An arm64 kernel configured with

  CONFIG_KPROBES=y
  CONFIG_KALLSYMS=y
  # CONFIG_KALLSYMS_ALL is not set
  CONFIG_KALLSYMS_BASE_RELATIVE=y

reports the following kprobe failure:

  [    0.032677] kprobes: failed to populate blacklist: -22
  [    0.033376] Please take care of using kprobes.

It appears that kprobe fails to retrieve the symbol at address
0xffff000010081000, despite this symbol being in System.map:

  ffff000010081000 T __exception_text_start

This symbol is part of the first group of aliases in the
kallsyms_offsets array (symbol names generated using ugly hacks in
scripts/kallsyms.c):

  kallsyms_offsets:
          .long   0x1000 // do_undefinstr
          .long   0x1000 // efi_header_end
          .long   0x1000 // _stext
          .long   0x1000 // __exception_text_start
          .long   0x12b0 // do_cp15instr

Looking at the implementation of get_symbol_pos(), it returns the
lowest index for aliasing symbols. In this case, it return 0.

But kallsyms_lookup_size_offset() considers 0 as a failure, which
is obviously wrong (there is definitely a valid symbol living there).
In turn, the kprobe blacklisting stops abruptly, hence the original
error.

A CONFIG_KALLSYMS_ALL kernel wouldn't fail as there is always
some random symbols at the beginning of this array, which are never
looked up via kallsyms_lookup_size_offset.

Fix it by considering that get_symbol_pos() is always successful
(which is consistent with the other uses of this function).

Fixes: ffc5089196446 ("[PATCH] Create kallsyms_lookup_size_offset()")
Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Will Deacon <will@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 kernel/kallsyms.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
index 02a0b01380d8e..ed87dac8378cc 100644
--- a/kernel/kallsyms.c
+++ b/kernel/kallsyms.c
@@ -262,8 +262,10 @@ int kallsyms_lookup_size_offset(unsigned long addr, unsigned long *symbolsize,
 {
 	char namebuf[KSYM_NAME_LEN];
 
-	if (is_ksym_addr(addr))
-		return !!get_symbol_pos(addr, symbolsize, offset);
+	if (is_ksym_addr(addr)) {
+		get_symbol_pos(addr, symbolsize, offset);
+		return 1;
+	}
 	return !!module_address_lookup(addr, symbolsize, offset, NULL, namebuf) ||
 	       !!__bpf_address_lookup(addr, symbolsize, offset, namebuf);
 }
-- 
2.20.1




  parent reply	other threads:[~2019-09-19 22:13 UTC|newest]

Thread overview: 92+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-19 22:02 [PATCH 4.19 00/79] 4.19.75-stable review Greg Kroah-Hartman
2019-09-19 22:02 ` [PATCH 4.19 01/79] netfilter: nf_flow_table: set default timeout after successful insertion Greg Kroah-Hartman
2019-09-19 22:02 ` [PATCH 4.19 02/79] HID: wacom: generic: read HID_DG_CONTACTMAX from any feature report Greg Kroah-Hartman
2019-09-19 22:02 ` [PATCH 4.19 03/79] RDMA/restrack: Release task struct which was hold by CM_ID object Greg Kroah-Hartman
2019-09-21 20:22   ` Pavel Machek
2019-09-22  8:30     ` Greg Kroah-Hartman
2019-09-19 22:02 ` [PATCH 4.19 04/79] Input: elan_i2c - remove Lenovo Legion Y7000 PnpID Greg Kroah-Hartman
2019-09-19 22:02 ` [PATCH 4.19 05/79] powerpc/mm/radix: Use the right page size for vmemmap mapping Greg Kroah-Hartman
2019-09-19 22:02 ` [PATCH 4.19 06/79] USB: usbcore: Fix slab-out-of-bounds bug during device reset Greg Kroah-Hartman
2019-09-19 22:02 ` [PATCH 4.19 07/79] media: tm6000: double free if usb disconnect while streaming Greg Kroah-Hartman
2019-09-19 22:02 ` [PATCH 4.19 08/79] phy: renesas: rcar-gen3-usb2: Disable clearing VBUS in over-current Greg Kroah-Hartman
2019-09-19 22:02 ` [PATCH 4.19 09/79] ip6_gre: fix a dst leak in ip6erspan_tunnel_xmit Greg Kroah-Hartman
2019-09-19 22:02 ` [PATCH 4.19 10/79] udp: correct reuseport selection with connected sockets Greg Kroah-Hartman
2019-09-21 20:32   ` Pavel Machek
2019-09-19 22:02 ` [PATCH 4.19 11/79] xen-netfront: do not assume sk_buff_head list is empty in error handling Greg Kroah-Hartman
2019-09-19 22:02 ` [PATCH 4.19 12/79] net_sched: let qdisc_put() accept NULL pointer Greg Kroah-Hartman
2019-09-19 22:02 ` [PATCH 4.19 13/79] KVM: coalesced_mmio: add bounds checking Greg Kroah-Hartman
2019-09-19 22:02 ` [PATCH 4.19 14/79] firmware: google: check if size is valid when decoding VPD data Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 15/79] serial: sprd: correct the wrong sequence of arguments Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 16/79] tty/serial: atmel: reschedule TX after RX was started Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 17/79] mwifiex: Fix three heap overflow at parsing element in cfg80211_ap_settings Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 18/79] nl80211: Fix possible Spectre-v1 for CQM RSSI thresholds Greg Kroah-Hartman
2019-09-20 11:28   ` Pavel Machek
2019-09-19 22:03 ` [PATCH 4.19 19/79] ieee802154: hwsim: Fix error handle path in hwsim_init_module Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 20/79] ieee802154: hwsim: unregister hw while hwsim_subscribe_all_others fails Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 21/79] ARM: dts: am57xx: Disable voltage switching for SD card Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 22/79] ARM: OMAP2+: Fix missing SYSC_HAS_RESET_STATUS for dra7 epwmss Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 23/79] bus: ti-sysc: Fix using configured sysc mask value Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 24/79] s390/bpf: fix lcgr instruction encoding Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 25/79] ARM: OMAP2+: Fix omap4 errata warning on other SoCs Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 26/79] ARM: dts: dra74x: Fix iodelay configuration for mmc3 Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 27/79] ARM: OMAP1: ams-delta-fiq: Fix missing irq_ack Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 28/79] bus: ti-sysc: Simplify cleanup upon failures in sysc_probe() Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 29/79] s390/bpf: use 32-bit index for tail calls Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 30/79] selftests/bpf: fix "bind{4, 6} deny specific IP & port" on s390 Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 31/79] tools: bpftool: close prog FD before exit on showing a single program Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 32/79] fpga: altera-ps-spi: Fix getting of optional confd gpio Greg Kroah-Hartman
2019-09-21 20:46   ` Pavel Machek
2019-09-23  1:33     ` Phil Reid
2019-09-19 22:03 ` [PATCH 4.19 33/79] netfilter: ebtables: Fix argument order to ADD_COUNTER Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 34/79] netfilter: nft_flow_offload: missing netlink attribute policy Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 35/79] netfilter: xt_nfacct: Fix alignment mismatch in xt_nfacct_match_info Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 36/79] NFSv4: Fix return values for nfs4_file_open() Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 37/79] NFSv4: Fix return value in nfs_finish_open() Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 38/79] NFS: Fix initialisation of I/O result struct in nfs_pgio_rpcsetup Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 39/79] Kconfig: Fix the reference to the IDT77105 Phy driver in the description of ATM_NICSTAR_USE_IDT77105 Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 40/79] xdp: unpin xdp umem pages in error path Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 41/79] qed: Add cleanup in qed_slowpath_start() Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 42/79] ARM: 8874/1: mm: only adjust sections of valid mm structures Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 43/79] batman-adv: Only read OGM2 tvlv_len after buffer len check Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 44/79] bpf: allow narrow loads of some sk_reuseport_md fields with offset > 0 Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 45/79] r8152: Set memory to all 0xFFs on failed reg reads Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 46/79] x86/apic: Fix arch_dynirq_lower_bound() bug for DT enabled machines Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 47/79] netfilter: xt_physdev: Fix spurious error message in physdev_mt_check Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 48/79] netfilter: nf_conntrack_ftp: Fix debug output Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 49/79] NFSv2: Fix eof handling Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 50/79] NFSv2: Fix write regression Greg Kroah-Hartman
2019-09-19 22:03 ` Greg Kroah-Hartman [this message]
2019-09-19 22:03 ` [PATCH 4.19 52/79] cifs: set domainName when a domain-key is used in multiuser Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 53/79] cifs: Use kzfree() to zero out the password Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 54/79] usb: host: xhci-tegra: Set DMA mask correctly Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 55/79] ARM: 8901/1: add a criteria for pfn_valid of arm Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 56/79] ibmvnic: Do not process reset during or after device removal Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 57/79] sky2: Disable MSI on yet another ASUS boards (P6Xxxx) Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 58/79] i2c: designware: Synchronize IRQs when unregistering slave client Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 59/79] perf/x86/intel: Restrict period on Nehalem Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 60/79] perf/x86/amd/ibs: Fix sample bias for dispatched micro-ops Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 61/79] amd-xgbe: Fix error path in xgbe_mod_init() Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 62/79] tools/power x86_energy_perf_policy: Fix "uninitialized variable" warnings at -O2 Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 63/79] tools/power x86_energy_perf_policy: Fix argument parsing Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 64/79] tools/power turbostat: fix buffer overrun Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 65/79] net: aquantia: fix out of memory condition on rx side Greg Kroah-Hartman
2019-09-20 11:20   ` Pavel Machek
2019-09-19 22:03 ` [PATCH 4.19 66/79] net: seeq: Fix the function used to release some memory in an error handling path Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 67/79] dmaengine: ti: dma-crossbar: Fix a memory leak bug Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 68/79] dmaengine: ti: omap-dma: Add cleanup in omap_dma_probe() Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 69/79] x86/uaccess: Dont leak the AC flags into __get_user() argument evaluation Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 70/79] x86/hyper-v: Fix overflow bug in fill_gva_list() Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 71/79] keys: Fix missing null pointer check in request_key_auth_describe() Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 72/79] iommu/amd: Flush old domains in kdump kernel Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 73/79] iommu/amd: Fix race in increase_address_space() Greg Kroah-Hartman
2019-09-19 22:03 ` [PATCH 4.19 74/79] PCI: kirin: Fix section mismatch warning Greg Kroah-Hartman
2019-09-19 22:04 ` [PATCH 4.19 75/79] ovl: fix regression caused by overlapping layers detection Greg Kroah-Hartman
2019-09-19 22:04 ` [PATCH 4.19 76/79] floppy: fix usercopy direction Greg Kroah-Hartman
2019-09-19 22:04 ` [PATCH 4.19 77/79] binfmt_elf: move brk out of mmap when doing direct loader exec Greg Kroah-Hartman
2019-09-19 22:04 ` [PATCH 4.19 78/79] arm64: kpti: Whitelist Cortex-A CPUs that dont implement the CSV3 field Greg Kroah-Hartman
2019-09-19 22:04 ` [PATCH 4.19 79/79] media: technisat-usb2: break out of loop at end of buffer Greg Kroah-Hartman
2019-09-20  3:39 ` [PATCH 4.19 00/79] 4.19.75-stable review kernelci.org bot
2019-09-20  8:51 ` Naresh Kamboju
2019-09-20 13:48 ` Jon Hunter
2019-09-20 18:37 ` Guenter Roeck
2019-09-20 21:21 ` shuah

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=20190919214811.975668286@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=acme@redhat.com \
    --cc=catalin.marinas@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=peterz@infradead.org \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=will@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).