From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8564CCA9EB9 for ; Sat, 26 Oct 2019 13:22:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5D599214DA for ; Sat, 26 Oct 2019 13:22:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572096145; bh=rXRtwToaCGuYjPFcWlslPVaS9rgJjmE4QAtIj0oVni0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=WiTewzD2lSPBXP+7DfqGwKp2GSvRUmDSaYRKoAxuKo0M/6anVU74QXGB4+dIYkyot ruDmyrzRyd5f3O1XH/HXz2B5NkoAHtizYOXr1dupb1Yc43lMLyOlSb7OSEZDwtkauj Mc3iz6LI55Cei1FC61PKBaLfv2QapbbthY5cTrFs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728301AbfJZNWX (ORCPT ); Sat, 26 Oct 2019 09:22:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:44012 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728105AbfJZNWR (ORCPT ); Sat, 26 Oct 2019 09:22:17 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 77C0121E6F; Sat, 26 Oct 2019 13:22:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572096136; bh=rXRtwToaCGuYjPFcWlslPVaS9rgJjmE4QAtIj0oVni0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hACumDE9ZmHq5/EsEYAFwnjbrl9H+xbYDDagIEtqNYFkI0f71S5C2/jCBXs/n2ZAp lhA/Zl3G6Lbew2+elmjxLi5EZKOcXu4VXkTlth+RPJxa6LF+27h/KYJaP+LVnLevXt zGMPk8ZgMNL8TcJy4YtMigUUTGMfLFTHNLaRurNM= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ilya Leoshkevich , Jan Kiszka , Kieran Bingham , Heiko Carstens , Vasily Gorbik , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH AUTOSEL 4.14 33/33] scripts/gdb: fix debugging modules on s390 Date: Sat, 26 Oct 2019 09:21:10 -0400 Message-Id: <20191026132110.4026-33-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191026132110.4026-1-sashal@kernel.org> References: <20191026132110.4026-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ilya Leoshkevich [ 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 Reviewed-by: Jan Kiszka Cc: Kieran Bingham Cc: Heiko Carstens Cc: Vasily Gorbik Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- 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