From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Ilya Leoshkevich <iii@linux.ibm.com>,
Jan Kiszka <jan.kiszka@siemens.com>,
Kieran Bingham <kbingham@kernel.org>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH AUTOSEL 4.9 21/21] scripts/gdb: fix debugging modules on s390
Date: Sat, 26 Oct 2019 09:22:17 -0400 [thread overview]
Message-ID: <20191026132217.4380-21-sashal@kernel.org> (raw)
In-Reply-To: <20191026132217.4380-1-sashal@kernel.org>
From: Ilya Leoshkevich <iii@linux.ibm.com>
[ Upstream commit 585d730d41120926e3f79a601edad3930fa28366 ]
Currently lx-symbols assumes that module text is always located at
module->core_layout->base, but s390 uses the following layout:
+------+ <- module->core_layout->base
| GOT |
+------+ <- module->core_layout->base + module->arch->plt_offset
| PLT |
+------+ <- module->core_layout->base + module->arch->plt_offset +
| TEXT | module->arch->plt_size
+------+
Therefore, when trying to debug modules on s390, all the symbol
addresses are skewed by plt_offset + plt_size.
Fix by adding plt_offset + plt_size to module_addr in
load_module_symbols().
Link: http://lkml.kernel.org/r/20191017085917.81791-1-iii@linux.ibm.com
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Kieran Bingham <kbingham@kernel.org>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
scripts/gdb/linux/symbols.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/scripts/gdb/linux/symbols.py b/scripts/gdb/linux/symbols.py
index 004b0ac7fa72d..d869e588f4ec4 100644
--- a/scripts/gdb/linux/symbols.py
+++ b/scripts/gdb/linux/symbols.py
@@ -15,7 +15,7 @@ import gdb
import os
import re
-from linux import modules
+from linux import modules, utils
if hasattr(gdb, 'Breakpoint'):
@@ -116,6 +116,12 @@ lx-symbols command."""
module_file = self._get_module_file(module_name)
if module_file:
+ if utils.is_target_arch('s390'):
+ # Module text is preceded by PLT stubs on s390.
+ module_arch = module['arch']
+ plt_offset = int(module_arch['plt_offset'])
+ plt_size = int(module_arch['plt_size'])
+ module_addr = hex(int(module_addr, 0) + plt_offset + plt_size)
gdb.write("loading @{addr}: {filename}\n".format(
addr=module_addr, filename=module_file))
cmdline = "add-symbol-file {filename} {addr}{sections}".format(
--
2.20.1
prev parent reply other threads:[~2019-10-26 13:23 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-26 13:21 [PATCH AUTOSEL 4.9 01/21] iommu/arm-smmu: Free context bitmap in the err path of arm_smmu_init_domain_context Sasha Levin
2019-10-26 13:21 ` [PATCH AUTOSEL 4.9 02/21] mac80211_hwsim: fix incorrect dev_alloc_name failure goto Sasha Levin
2019-10-26 13:21 ` [PATCH AUTOSEL 4.9 03/21] nvme: retain split access workaround for capability reads Sasha Levin
2019-10-26 13:22 ` [PATCH AUTOSEL 4.9 04/21] net: stmmac: gmac4+: Not all Unicast addresses may be available Sasha Levin
2019-10-26 13:22 ` [PATCH AUTOSEL 4.9 05/21] mac80211: accept deauth frames in IBSS mode Sasha Levin
2019-10-26 13:22 ` [PATCH AUTOSEL 4.9 06/21] llc: fix sk_buff leak in llc_sap_state_process() Sasha Levin
2019-10-26 13:22 ` [PATCH AUTOSEL 4.9 07/21] llc: fix sk_buff leak in llc_conn_service() Sasha Levin
2019-10-26 13:22 ` [PATCH AUTOSEL 4.9 08/21] llc: fix another potential sk_buff leak in llc_ui_sendmsg() Sasha Levin
2019-10-26 13:22 ` [PATCH AUTOSEL 4.9 09/21] llc: fix sk_buff refcounting in llc_conn_state_process() Sasha Levin
2019-10-26 13:22 ` [PATCH AUTOSEL 4.9 10/21] net: stmmac: fix length of PTP clock's name string Sasha Levin
2019-10-26 13:22 ` [PATCH AUTOSEL 4.9 11/21] bonding: fix potential NULL deref in bond_update_slave_arr Sasha Levin
2019-10-26 13:22 ` [PATCH AUTOSEL 4.9 12/21] act_mirred: Fix mirred_init_module error handling Sasha Levin
2019-10-26 13:22 ` [PATCH AUTOSEL 4.9 13/21] net: usb: qmi_wwan: add Telit 0x1050 composition Sasha Levin
2019-10-26 13:22 ` [PATCH AUTOSEL 4.9 14/21] drm/msm/dsi: Implement reset correctly Sasha Levin
2019-10-26 13:22 ` [PATCH AUTOSEL 4.9 15/21] hrtimer: Annotate lockless access to timer->base Sasha Levin
2019-10-26 13:22 ` [PATCH AUTOSEL 4.9 16/21] xtensa: fix {get,put}_user() for 64bit values Sasha Levin
2019-10-26 13:22 ` [PATCH AUTOSEL 4.9 17/21] net: bcmgenet: Fix RGMII_MODE_EN value for GENET v1/2/3 Sasha Levin
2019-10-26 13:22 ` [PATCH AUTOSEL 4.9 18/21] net: usb: sr9800: fix uninitialized local variable Sasha Levin
2019-10-26 13:22 ` [PATCH AUTOSEL 4.9 19/21] usb: hso: obey DMA rules in tiocmget Sasha Levin
2019-10-26 13:22 ` [PATCH AUTOSEL 4.9 20/21] ocfs2: fix error handling in ocfs2_setattr() Sasha Levin
2019-10-26 13:22 ` Sasha Levin [this message]
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=20191026132217.4380-21-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=gor@linux.ibm.com \
--cc=heiko.carstens@de.ibm.com \
--cc=iii@linux.ibm.com \
--cc=jan.kiszka@siemens.com \
--cc=kbingham@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=torvalds@linux-foundation.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
Powered by JetHome