From nobody Sat Feb 7 12:44:26 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FE6B219E93 for ; Thu, 15 May 2025 15:58:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747324716; cv=none; b=HkVbAVu6Cnob1O4su1ZeDK9tYVoJnJQbYprpDc6NSJEeRIf9ZlcRV4+sg+74MKz1EAHux7f4gDswVAYsZVbqrIcbDiSZ1fn89Bq85l8zrFHZ9hiqfA/Wvw3wLf+LoQKGhU2EK/HnOOQ9kNz1gi1vpBQB5qAhdasFikd66jFRSew= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747324716; c=relaxed/simple; bh=S5g6mdPPiEjNLTg64c71ov/RAjI93cjjD5LZ25Od4KA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mtlSs1yx819mS/9TvsryGiuZTqNHO3pVTN9SvwcqZlOsZjvl/WiTTOcdf/Jyk5YJ3QySRN2fZR/HiT5RCdoFYhcso2/d/Pz/1MKCs9c++AuPL7OPz4uSjSnofjTuH9YAm5RWhg/BkbOZLWc+JdSTdAnLD+vcsJNqzUKLpOtbHBs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=tGb0Gmhg; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="tGb0Gmhg" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 54FCg1gG016398; Thu, 15 May 2025 15:58:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=cXG8eCF5r/sXPTCsv liDu8dy3K68BqnjQtx1eybwJTE=; b=tGb0GmhghVxT3dTgXMhDrg03uS2OyVV4J svwZBpmH1nMgS5SdRkywTso7Z2RqwEHiw8fcd99zJ5gKNx7p7RFGF0njFbkGSNtY lwu0WAoVkXCN/dvsrPJs2mjUAMUWsDBIasaQxEN406EhZOHqhV5w6la/CsI+QfGd b669Nh+6/c7HGPF9mP0T+waoTUTXIJ3U5vN5k0hFSWz0D52JVH8CcqT7b2IgIZks Qj9AHVYttnBgVVczyGYnMU+/eugD8yhFkEloqEYPy4Xa1DMdChlSdT+U9iAO6D1n 2/D9PPUhmcXIuJijyyhLAeEgEGIdIytMxl+37SKZlT36YNbL6tNnw== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 46nd4gt8t1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 May 2025 15:58:22 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 54FE7at0026947; Thu, 15 May 2025 15:58:21 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 46mbfpk2nr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 May 2025 15:58:21 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 54FFwIdl41222636 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 May 2025 15:58:18 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4006220071; Thu, 15 May 2025 15:58:18 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AA7842006A; Thu, 15 May 2025 15:58:17 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.111.40.6]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 May 2025 15:58:17 +0000 (GMT) From: Ilya Leoshkevich To: Jan Kiszka , Kieran Bingham , Andrew Morton Cc: linux-kernel@vger.kernel.org, Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Ilya Leoshkevich Subject: [PATCH 1/3] scripts/gdb/symbols: factor out get_vmlinux() Date: Thu, 15 May 2025 17:52:11 +0200 Message-ID: <20250515155811.114392-2-iii@linux.ibm.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250515155811.114392-1-iii@linux.ibm.com> References: <20250515155811.114392-1-iii@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: b0u8MmdQJrspvg4Y_OhhX0acYHw8IFn1 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNTE1MDE1NSBTYWx0ZWRfX9RFs29gjx2LM e0Tyu34RdUmm/jA07VBDewphbyhHIAT9RnAeva0vns6PFTkMdYey1/7OhTrUHhJ175RSxcqYr2I ffCFEwIbHGrui2j+DAqPS8m3i/2CkQ+5zDSRpeBI0Ru3pOy5niR8whZReDouAKfw6pgXapXp+P4 gEErFreRTXZ6BSZrSKQ/4qZ7IS5W9QRzzGzKHxRfoa7UqerlrTYTnkm1L6bMreCaw4oRApc8o0k WTim4p06H2XySOcGA0c6ulp5uKzBgcOkXeI+u2Vs9i/BJHRu0h8DH28/Jx7C/0C8EcSzS+GYqpW POPi8gS0meVclXTcKbPEVPqXeLCbvYhcNhDfr9uMCpZA/m97+ZSXvo9ZjfoZl5dknpSLVEp5Qcm 9HEmALASkRBEOFAx+yTfgatIyhokSLnxOs5I3oSRuOg8G7UTHdi4GO9Egha32V/2EpFt9n1Q X-Proofpoint-ORIG-GUID: b0u8MmdQJrspvg4Y_OhhX0acYHw8IFn1 X-Authority-Analysis: v=2.4 cv=OsNPyz/t c=1 sm=1 tr=0 ts=68260f1e cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=dt9VzEwgFbYA:10 a=VnNF1IyMAAAA:8 a=hEpxwc8ILFXnKlI9gXIA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-05-15_06,2025-05-15_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 malwarescore=0 spamscore=0 lowpriorityscore=0 clxscore=1011 impostorscore=0 mlxlogscore=898 mlxscore=0 adultscore=0 bulkscore=0 phishscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505070000 definitions=main-2505150155 Content-Type: text/plain; charset="utf-8" Move the code that determines the current vmlinux file into a separate function. It will be useful later in order to analyze the kernel image in physical memory during s390 early boot. Signed-off-by: Ilya Leoshkevich --- scripts/gdb/linux/symbols.py | 6 +----- scripts/gdb/linux/utils.py | 9 +++++++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/scripts/gdb/linux/symbols.py b/scripts/gdb/linux/symbols.py index b255177301e9..25c4627c60e5 100644 --- a/scripts/gdb/linux/symbols.py +++ b/scripts/gdb/linux/symbols.py @@ -178,11 +178,7 @@ lx-symbols command.""" saved_states.append({'breakpoint': bp, 'enabled': bp.enabl= ed}) =20 # drop all current symbols and reload vmlinux - orig_vmlinux =3D 'vmlinux' - for obj in gdb.objfiles(): - if (obj.filename.endswith('vmlinux') or - obj.filename.endswith('vmlinux.debug')): - orig_vmlinux =3D obj.filename + orig_vmlinux =3D utils.get_vmlinux() gdb.execute("symbol-file", to_string=3DTrue) kerneloffset =3D get_kerneloffset() if kerneloffset is None: diff --git a/scripts/gdb/linux/utils.py b/scripts/gdb/linux/utils.py index 03ebdccf5f69..fc94ff6a6d72 100644 --- a/scripts/gdb/linux/utils.py +++ b/scripts/gdb/linux/utils.py @@ -251,3 +251,12 @@ def parse_vmcore(s): else: kerneloffset =3D int(match.group(1), 16) return VmCore(kerneloffset=3Dkerneloffset) + + +def get_vmlinux(): + vmlinux =3D 'vmlinux' + for obj in gdb.objfiles(): + if (obj.filename.endswith('vmlinux') or + obj.filename.endswith('vmlinux.debug')): + vmlinux =3D obj.filename + return vmlinux --=20 2.49.0 From nobody Sat Feb 7 12:44:26 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94A1721B910 for ; Thu, 15 May 2025 15:58:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747324710; cv=none; b=eDEneR5khmD/av1eKY1g4H3ylAc2uWD8yHLQReDhGoU35emIrFIFoP+QvEMFzW13CE63MFNaEroKQny89rNOESQH9qkQXquwQKVvnAUBowD0bL2AhM0Fp8K4sVJezZp6PQagMpO5fzLdndWb1YyDKpqtpcrb3uFsn2/D2x4Se/M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747324710; c=relaxed/simple; bh=kSKMm/FXtlzTRSCHJVngzV2OL0Pc+dDJL7txRsufWog=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=reeoDgg2TF/24xjXp9JHA5Mi7tXbVagNfssiavt/ZGFds/aAnNjd5VsDeJCghXzH6NU5eJ1bzk6xph+QfFQE6Ox8MNNYIoE5XrUFl+Yp4tONceIVEZyEtO2O2PkQD3NE9m485zLZoanZZSzUO/+rOAAwYFtD+O6wp97WNJzA0/U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=oSm1j8ED; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="oSm1j8ED" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 54FDnB0g032364; Thu, 15 May 2025 15:58:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=5pmcKHTdpYl4PuFpd P3fj1feUngFXB25e/AW53SWL6I=; b=oSm1j8EDhZEHtGzNqYbjttKqnrqEqJM1x Vmd923fvECedo4cpviWDBHa0BRCqBgX5n0XocwvgH6SqykcDG1GEQoQ6GSjy62Mz p0wYOGWfoLF4q44vZPG9yCU/Hx9nQR/xkCmKPe6uXxGGb+3viEDwKEYygjMtfgwW +5FHq/6e0MaovdZGAw1pkuzGNOVueZZiI9CVmaTcyrarEM3TPCMNgxgp8yCppxFc MIscPa1DpCrqnrGUVGZFuT1JF4EUjOPN80GQPLkiwj+Volu2QjaqbSdw6fCdkcrm yxXM97A0efdmYHJHZ21VTIeEKzOD7hfGtcMxTLxj8HcegSDN2HI6g== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 46nhg30qdx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 May 2025 15:58:23 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 54FEKaE0015498; Thu, 15 May 2025 15:58:22 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 46mbfq326u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 May 2025 15:58:22 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 54FFwIP941222638 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 May 2025 15:58:19 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D203120073; Thu, 15 May 2025 15:58:18 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 574742006A; Thu, 15 May 2025 15:58:18 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.111.40.6]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 May 2025 15:58:18 +0000 (GMT) From: Ilya Leoshkevich To: Jan Kiszka , Kieran Bingham , Andrew Morton Cc: linux-kernel@vger.kernel.org, Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Ilya Leoshkevich Subject: [PATCH 2/3] scripts/gdb/symbols: factor out pagination_off() Date: Thu, 15 May 2025 17:52:12 +0200 Message-ID: <20250515155811.114392-3-iii@linux.ibm.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250515155811.114392-1-iii@linux.ibm.com> References: <20250515155811.114392-1-iii@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Authority-Analysis: v=2.4 cv=Cf0I5Krl c=1 sm=1 tr=0 ts=68260f1f cx=c_pps a=bLidbwmWQ0KltjZqbj+ezA==:117 a=bLidbwmWQ0KltjZqbj+ezA==:17 a=dt9VzEwgFbYA:10 a=VnNF1IyMAAAA:8 a=CQlH1tSRAcpKiUbNx1MA:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNTE1MDE1NSBTYWx0ZWRfX6KrQnU9flpzT Yc0voG6r8Oo0/Pxg9ULk/jIOucJ8QnpF+aPWQ6Mx55/NzwoBm0F2XJtl0o9rirl8WxNPAqX4m5s NW9PWyYK8A1oTwTtalWe/7/3gSRt4cPR8nM4GF6Hf17ZqQgu/YwhK3M5w5YjJU+7bd7mlAm/Jw/ /m8SrCrmYJuf64020gyi9seI5uc5e9rtjIzI8/45IVoswHkemNs9QuFCvR6OS2IZPsSkAN5nY8l AUEHUiCUSgU02qlSClvAzgCyOVcezbkMigoMfBes4+5RXBhrWl1U4sOWXMalk50LRhb0Ied2f9K zmERXeooOS9dx40tFCNJXdTlipVhm6njCWDS4O/dJn66rMpnINqQXKnfYvsqmG7KB5ml666BQDw bVLI8O1aikgCshEuSEpjcaVOV1OAt0jzp8701/odvjbTur9DzoN0lK5Sy01MqrLnRrDJcQ+3 X-Proofpoint-GUID: rhyJD-s3I1hpssDGwGvB5-lpWUxTpv0J X-Proofpoint-ORIG-GUID: rhyJD-s3I1hpssDGwGvB5-lpWUxTpv0J X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-05-15_06,2025-05-15_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 suspectscore=0 spamscore=0 malwarescore=0 lowpriorityscore=0 mlxlogscore=758 impostorscore=0 phishscore=0 priorityscore=1501 mlxscore=0 bulkscore=0 adultscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505070000 definitions=main-2505150155 Content-Type: text/plain; charset="utf-8" Move the code that turns off pagination into a separate function. It will be useful later in order to prevent hangs when loading symbols for kernel image in physical memory during s390 early boot. Signed-off-by: Ilya Leoshkevich --- scripts/gdb/linux/symbols.py | 20 +++++++------------- scripts/gdb/linux/utils.py | 11 +++++++++++ 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/scripts/gdb/linux/symbols.py b/scripts/gdb/linux/symbols.py index 25c4627c60e5..0c7af712c44c 100644 --- a/scripts/gdb/linux/symbols.py +++ b/scripts/gdb/linux/symbols.py @@ -38,19 +38,13 @@ if hasattr(gdb, 'Breakpoint'): # Disable pagination while reporting symbol (re-)loading. # The console input is blocked in this context so that we would # get stuck waiting for the user to acknowledge paged output. - show_pagination =3D gdb.execute("show pagination", to_string= =3DTrue) - pagination =3D show_pagination.endswith("on.\n") - gdb.execute("set pagination off") - - if module_name in cmd.loaded_modules: - gdb.write("refreshing all symbols to reload module " - "'{0}'\n".format(module_name)) - cmd.load_all_symbols() - else: - cmd.load_module_symbols(module) - - # restore pagination state - gdb.execute("set pagination %s" % ("on" if pagination else "of= f")) + with utils.pagination_off(): + if module_name in cmd.loaded_modules: + gdb.write("refreshing all symbols to reload module " + "'{0}'\n".format(module_name)) + cmd.load_all_symbols() + else: + cmd.load_module_symbols(module) =20 return False =20 diff --git a/scripts/gdb/linux/utils.py b/scripts/gdb/linux/utils.py index fc94ff6a6d72..dc379ab11af0 100644 --- a/scripts/gdb/linux/utils.py +++ b/scripts/gdb/linux/utils.py @@ -260,3 +260,14 @@ def get_vmlinux(): obj.filename.endswith('vmlinux.debug')): vmlinux =3D obj.filename return vmlinux + + +@contextlib.contextmanager +def pagination_off(): + show_pagination =3D gdb.execute("show pagination", to_string=3DTrue) + pagination =3D show_pagination.endswith("on.\n") + gdb.execute("set pagination off") + try: + yield + finally: + gdb.execute("set pagination %s" % ("on" if pagination else "off")) --=20 2.49.0 From nobody Sat Feb 7 12:44:26 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 18B57215198 for ; Thu, 15 May 2025 15:58:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747324726; cv=none; b=sRzoFu3Y1yovr1ncF02fLFVr20FAs7HNzdtyYmu0CBlLr8tJ0nzCDNDAf1Lw7EhDTKiXst1Pp86mAIvx9yzcYgYWhbUkOeRuuz4PweXlFb676OaW0yk8j+Jjx9z/3QG+vcDsys7F9PIYXiArnyckKoffdva+v+/rYq0DjqHFbis= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747324726; c=relaxed/simple; bh=5CHoizMumOdskfRaR8+rWOrOUJnCoJGJXmzAc9In1v8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VrKbBJzc0EBeJ+DkH117IKqstkyjp6ya+j3XqRDAbHt9eKMHji2ZNvQjmAlxMUSrBdsCeFbHaSKwj66nAyb/Q6Rc4RCauK/5iUONVZeWp9MEqIaiP6K2227i6AYf1BgT/w2sVRuBkcmOzJMiC3d4Z7Ag7/36+0OE/zVGbAl7udA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=q2hewEgT; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="q2hewEgT" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 54FCg08s016376; Thu, 15 May 2025 15:58:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=dNygolg3EASfG78a7 N6xl4X4pbzgFYRxyhCa8HZzzrM=; b=q2hewEgTk3NrfILYmINXSomjf34Ksn0mW FSet/6TJDiBw/SkjJT87NhCNQLl2FCz7ki6IDNnEl/C3gP7oe2VSW95aDso4ZQDE vfA3ttfn4Qzf8x9ENHZNa0Dw0j+NDuH9+GRGgrGxF4dqyMVZ1k5xBkQr6tIwIRYa hHKxO2vO3nIwPt7Q7JSN+cQhnSajPFHL5wIXvT5eFecxUOaVsz9qWOVd+YKgDUQ+ g5p91N9HD6FNOUsJzlm9YPfi1vpNDYENs2X6hP1nqY4fUtZxMmZQN1WlEnUEicPR G5m9Ynrw1BbkHhFXeOlSHasmp5nYfogZSgK6f//SiANuIkfz6TveQ== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 46nd4gt8t4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 May 2025 15:58:24 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 54FE0POe024288; Thu, 15 May 2025 15:58:23 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 46mbfsb34e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 May 2025 15:58:23 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 54FFwJk057934096 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 May 2025 15:58:19 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6E67720071; Thu, 15 May 2025 15:58:19 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E907E2006A; Thu, 15 May 2025 15:58:18 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.111.40.6]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 May 2025 15:58:18 +0000 (GMT) From: Ilya Leoshkevich To: Jan Kiszka , Kieran Bingham , Andrew Morton Cc: linux-kernel@vger.kernel.org, Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Ilya Leoshkevich Subject: [PATCH 3/3] scripts/gdb/symbols: determine KASLR offset on s390 during early boot Date: Thu, 15 May 2025 17:52:13 +0200 Message-ID: <20250515155811.114392-4-iii@linux.ibm.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250515155811.114392-1-iii@linux.ibm.com> References: <20250515155811.114392-1-iii@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: JxVtF6MuqiyAsiF86_jXQtSuV93jDlsl X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNTE1MDE1NSBTYWx0ZWRfXxQ3J+KpYAcBU e9aymZsSwaPXTxMC01Xw5QgC41POeHPPyAPKW8cvGaSRO45B4EDIQDbf86mOiTrUoiRH4Rj5jo8 HXofRsiGmN8hk9cWHb+ui/9XIpEZyVJjteCIEWRcPHoWffZCLUca+fzy1rLQX1IbEBR3Sfl3cFU Gee5i8/kQ7Mj2K0z+2Vl6gSGHPCYe7p81PfCq16EFfpJM763H9HFQqX6oEztIxlgiuY3mUE51TB mbldYS4W/diXW8TGTji5lUeuIlcB2IIDLIb9vHDqckek8JrLT7zMEGzmufwYrc/Bf2TSICEJyvV 5eTwVyhOevNL1oyWbHPG06cx5Ae/0yxKg5GdaJDj5OkG3VGmQ+zmSxME6mATGJTbqg1Y7iKNrwd 1ZRKqmLqiXbQJB3JpMVyft3ERhKNq09dtyeApBCPsGUt7gbrGtOlzzJlPJJO8YX1hRgl8sHR X-Proofpoint-ORIG-GUID: JxVtF6MuqiyAsiF86_jXQtSuV93jDlsl X-Authority-Analysis: v=2.4 cv=OsNPyz/t c=1 sm=1 tr=0 ts=68260f20 cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=dt9VzEwgFbYA:10 a=VnNF1IyMAAAA:8 a=Y1BJ8SPxlSKVlgg0ul0A:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-05-15_06,2025-05-15_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 malwarescore=0 spamscore=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 bulkscore=0 phishscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505070000 definitions=main-2505150155 Content-Type: text/plain; charset="utf-8" Using lx-symbols during s390 early boot fails with: Error occurred in Python: 'utf-8' codec can't decode byte 0xcb in posit= ion 0: invalid continuation byte The reason is that s390 decompressor's startup_kernel() does not create vmcoreinfo note, and sets vmcore_info to kernel's physical base. This confuses get_vmcore_s390(). Fix by handling this special case. Extract vm_layout.kaslr_offset from the kernel image in physical memory, which is placed there by the decompressor using the __bootdata_preserved mechanism, and generate a synthetic vmcoreinfo note from it. Signed-off-by: Ilya Leoshkevich --- scripts/gdb/linux/symbols.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/gdb/linux/symbols.py b/scripts/gdb/linux/symbols.py index 0c7af712c44c..2332bd8eddf1 100644 --- a/scripts/gdb/linux/symbols.py +++ b/scripts/gdb/linux/symbols.py @@ -54,6 +54,18 @@ def get_vmcore_s390(): vmcore_info =3D 0x0e0c paddr_vmcoreinfo_note =3D gdb.parse_and_eval("*(unsigned long long= *)" + hex(vmcore_info)) + if paddr_vmcoreinfo_note =3D=3D 0 or paddr_vmcoreinfo_note & 1: + # In the early boot case, extract vm_layout.kaslr_offset from = the + # vmlinux image in physical memory. + if paddr_vmcoreinfo_note =3D=3D 0: + kaslr_offset_phys =3D 0 + else: + kaslr_offset_phys =3D paddr_vmcoreinfo_note - 1 + with utils.pagination_off(): + gdb.execute("symbol-file {0} -o {1}".format( + utils.get_vmlinux(), hex(kaslr_offset_phys))) + kaslr_offset =3D gdb.parse_and_eval("vm_layout.kaslr_offset") + return "KERNELOFFSET=3D" + hex(kaslr_offset)[2:] inferior =3D gdb.selected_inferior() elf_note =3D inferior.read_memory(paddr_vmcoreinfo_note, 12) n_namesz, n_descsz, n_type =3D struct.unpack(">III", elf_note) --=20 2.49.0