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=ham 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 D4CF0CA9EB9 for ; Sat, 26 Oct 2019 13:23:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A7623214DA for ; Sat, 26 Oct 2019 13:23:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572096225; bh=Yiod/UmnCXiAMYtJgu8iKS91LjH3bhMLvi22Vb4kw7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=gbtXNrUq30+uu6AqI/NvCaeGu3mh+EGagJfoXrzBaUuzDGm7WVHdzDy3n9OhcKOpj YuUq16NIjW6sLjsO1ynzfMLAH+n6+I9wzIbie0ZYNgrqUmgfBoViKqjIZdHc595d/y PPiNlXco1C3BJmtxTqXBDklJXMaIvAIgBWhPIvaY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729978AbfJZNXo (ORCPT ); Sat, 26 Oct 2019 09:23:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:45472 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729948AbfJZNXl (ORCPT ); Sat, 26 Oct 2019 09:23:41 -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 3C3B0214DA; Sat, 26 Oct 2019 13:23:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572096220; bh=Yiod/UmnCXiAMYtJgu8iKS91LjH3bhMLvi22Vb4kw7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pdav4dBGAgdY50ngutUYtIkn5cgZA9uBcF3RocrZ8m4fYRj2Fnnv4w9YfNBoklGsu 3OLs2fktfn6VA6//9CI6atIlrelF6r86SYc+AiC26W8qBSwmv/4K5UHqtv6Ko9lxb8 0XOtWTnuY0J8h3OCOErZwv0c4UnIxN7HLNDZpORM= 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.4 17/17] scripts/gdb: fix debugging modules on s390 Date: Sat, 26 Oct 2019 09:23:01 -0400 Message-Id: <20191026132302.4622-17-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191026132302.4622-1-sashal@kernel.org> References: <20191026132302.4622-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 627750cb420d0..54deae59869b5 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