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 3CF27CA9EB9 for ; Sat, 26 Oct 2019 13:18:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 145EB21D81 for ; Sat, 26 Oct 2019 13:18:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572095939; bh=fHG4VJO66wlUSAKnGeqAtHvL36+QcQR9nSW3UCe84Uk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=FSNcN+Tbxa3XWYFmEUPvf9oBLyQt6pzBvt4IT0J/ztM6rfRdMg45EXOKiF18nUEPt RZ+dWUnNnpwaIAKOjfMmm8IWT6MxGvdlQVbO9slaakyhXSIhZI+J+QI5V9v0JwIhL2 fVSac+W547SZRxHFm1j/2AjeztpTMTj+B9PDJ8Ss= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728098AbfJZNS6 (ORCPT ); Sat, 26 Oct 2019 09:18:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:40824 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726686AbfJZNS4 (ORCPT ); Sat, 26 Oct 2019 09:18:56 -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 19E4521D7F; Sat, 26 Oct 2019 13:18:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572095936; bh=fHG4VJO66wlUSAKnGeqAtHvL36+QcQR9nSW3UCe84Uk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SD77hnl/PdxXJccN9D6pfzT3qfYMBT53TRjdLKSM0/rcodE7UHTF+OD9nwTe2jZaS M+CuN/+1unUKs+HsyipPAQSJB6YTjG32OLB9jS/DrTT3EikVy8i/VkTx8rHgNEZhin uT0Qkz+0aCXJjgaB27uLtl+4NLkV0wyuI/rSOdO4= 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 5.3 97/99] scripts/gdb: fix debugging modules on s390 Date: Sat, 26 Oct 2019 09:15:58 -0400 Message-Id: <20191026131600.2507-97-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191026131600.2507-1-sashal@kernel.org> References: <20191026131600.2507-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 2f5b95f09fa03..992adb30857c0 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