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 7390BCA9EB9 for ; Sat, 26 Oct 2019 13:21:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4A08420867 for ; Sat, 26 Oct 2019 13:21:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572096081; bh=rXRtwToaCGuYjPFcWlslPVaS9rgJjmE4QAtIj0oVni0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=V1zPfq172NG5dss5u6rnDkkGymAeGafiHlimSDKWLjpMHxkKFAwavxgcRX3lvYQ2C c+iCdTOlUjB6ELvmG5JjqLiO3iJpPCH3aJds+ak/MOdN6UDJKrbc7UOPM4rN9Yxvnj ox3BhWz3W+O2/fg2tNGazVK1Y6ZcqDlGhcRWjCwk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728897AbfJZNVU (ORCPT ); Sat, 26 Oct 2019 09:21:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:42828 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728800AbfJZNVI (ORCPT ); Sat, 26 Oct 2019 09:21:08 -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 1A243222BE; Sat, 26 Oct 2019 13:21:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572096068; bh=rXRtwToaCGuYjPFcWlslPVaS9rgJjmE4QAtIj0oVni0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dnuer8fx1PJNtlTZqT6Tkq6xgnatK21pyhL+1lrVZs97MivtSa5KntPwIY/ozdj0z JxXCm0r1uAyzbV5IJH3oV8I9NMZlV8Ae5CsTuU8taAmO+F+yRgrtgSyuOZgKqo+x+X 7K6DIbVXAQYCb8JCOoatz5xPskiUztor8Z4Z/iD4= 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.19 59/59] scripts/gdb: fix debugging modules on s390 Date: Sat, 26 Oct 2019 09:19:10 -0400 Message-Id: <20191026131910.3435-59-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191026131910.3435-1-sashal@kernel.org> References: <20191026131910.3435-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