From patchwork Sun Jun 25 23:07:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nadav Amit X-Patchwork-Id: 13292207 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A801CC0015E for ; Sun, 25 Jun 2023 23:07:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229663AbjFYXHv (ORCPT ); Sun, 25 Jun 2023 19:07:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229447AbjFYXHu (ORCPT ); Sun, 25 Jun 2023 19:07:50 -0400 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFDC01BD for ; Sun, 25 Jun 2023 16:07:49 -0700 (PDT) Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-668711086f4so1664832b3a.1 for ; Sun, 25 Jun 2023 16:07:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687734469; x=1690326469; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vHqxeAotCnxkuVm3NE+mpH766uEaTTmXxUGQT2/zQXg=; b=i9FKP9QrAGjLwKNZZ0JjhCkf0OQyEDv1x5RoB0qkg01vXGEfopl3Pddg/0ZR7XvUAu nlUzlRpvzCu5obICyLJZvONDx9iY6BZ0s2/+5xurDlD7Ik02CCkPsMfRCrxKCLpyxcuT jfXlX0bd4+50EW1NEwUUP9y6ZrFDgwDJTzQzul3vON/QSiaVDzVMcmQefZn1P+VltW86 TIN3lu718abHeVvJ8TIxYYeKB0dfr6TXIIhnhl/2lsJgnSwXVz/4Ch8Oz87KMKr8jB83 Pqlutht00f3Nrfr3oFyYtklEqpDK8Rm8TdV3ryis7oio3m2Kvls9pjCi4Jepvhw79tBf Gv3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687734469; x=1690326469; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vHqxeAotCnxkuVm3NE+mpH766uEaTTmXxUGQT2/zQXg=; b=Vi+i1Oy70VOvIgNPj6XlVUxjZtlHBX+WKLRTMffoS9T7oMCromw+iLuEgj+C1ORBen qPtgA4Gc82GeYbyH5puN/8b1jy6lqF3RQDEiQ1Z/HdTwK52+Qnrwu7S6ogVUa1oAfhHQ 45ngZV0PHqXq/IHsmMfQHlursjr9PCgXfvq7V9asVjt8iCKbvQu3RvftwRuCQ1MPohtp RrDumrNtK1MyLTnXcjY3q8cs35CSGMcCo7ctnv+Ol/jedd1ozOU/r3LYkUoM150kn4Nu DvkOgeH1jPCj/fxuCvISTe3+SoaGYazR+ZRJjfdV7SgDGb/ZZmt9VPJQ63NtuF1fL+vt 2esA== X-Gm-Message-State: AC+VfDwM+3iGt+G0oWUPFkBpXZ3W/OhB1BTOmLSBMtImRycTzzCatWxg GSsJpb7owTYcSfnt7SKApRM= X-Google-Smtp-Source: ACHHUZ6LiPxrHGKgvRwbrsWtmWQj0OpsUWu9zZW9lZ/7lWInjAzmncaflAQwfnGrIxaGPDnKxNv5Mg== X-Received: by 2002:a05:6a21:32a2:b0:110:b7fb:2c92 with SMTP id yt34-20020a056a2132a200b00110b7fb2c92mr35741019pzb.11.1687734469017; Sun, 25 Jun 2023 16:07:49 -0700 (PDT) Received: from sc9-mailhost1.vmware.com (c-24-6-216-183.hsd1.ca.comcast.net. [24.6.216.183]) by smtp.gmail.com with ESMTPSA id x20-20020aa79194000000b006668f004420sm2716397pfa.148.2023.06.25.16.07.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Jun 2023 16:07:48 -0700 (PDT) From: Nadav Amit X-Google-Original-From: Nadav Amit To: Andrew Jones Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org, Nikos Nikoleris , Paolo Bonzini , Nadav Amit Subject: [kvm-unit-tests PATCH v2 1/6] efi: keep efi debug information in a separate file Date: Sun, 25 Jun 2023 23:07:11 +0000 Message-Id: <20230625230716.2922-2-namit@vmware.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230625230716.2922-1-namit@vmware.com> References: <20230625230716.2922-1-namit@vmware.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Nadav Amit Debugging tests that run on EFI is hard because the debug information is not included in the EFI file. Dump it into a separeate .debug file to allow the use of gdb or pretty_print_stacks script. Signed-off-by: Nadav Amit --- v1->v2: * Making clean should remove .debug [Andrew] * x86 EFI support [Andrew] --- arm/Makefile.common | 5 ++++- x86/Makefile.common | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/arm/Makefile.common b/arm/Makefile.common index d60cf8c..9b45a8f 100644 --- a/arm/Makefile.common +++ b/arm/Makefile.common @@ -78,6 +78,9 @@ ifeq ($(CONFIG_EFI),y) %.efi: %.so $(call arch_elf_check, $^) + $(OBJCOPY) --only-keep-debug $^ $@.debug + $(OBJCOPY) --strip-debug $^ + $(OBJCOPY) --add-gnu-debuglink=$@.debug $^ $(OBJCOPY) \ -j .text -j .sdata -j .data -j .dynamic -j .dynsym \ -j .rel -j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* \ @@ -103,7 +106,7 @@ $(libeabi): $(eabiobjs) $(AR) rcs $@ $^ arm_clean: asm_offsets_clean - $(RM) $(TEST_DIR)/*.{o,flat,elf,so,efi} $(libeabi) $(eabiobjs) \ + $(RM) $(TEST_DIR)/*.{o,flat,elf,so,efi,debug} $(libeabi) $(eabiobjs) \ $(TEST_DIR)/.*.d $(TEST_DIR)/efi/.*.d lib/arm/.*.d generated-files = $(asm-offsets) diff --git a/x86/Makefile.common b/x86/Makefile.common index 9f2bc93..c42c3e4 100644 --- a/x86/Makefile.common +++ b/x86/Makefile.common @@ -54,6 +54,9 @@ ifeq ($(CONFIG_EFI),y) @chmod a-x $@ %.efi: %.so + $(OBJCOPY) --only-keep-debug $^ $@.debug + $(OBJCOPY) --strip-debug $^ + $(OBJCOPY) --add-gnu-debuglink=$@.debug $^ $(OBJCOPY) \ -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \ -j .rela -j .reloc -S --target=$(FORMAT) $< $@ @@ -124,4 +127,4 @@ arch_clean: $(RM) $(TEST_DIR)/*.o $(TEST_DIR)/*.flat $(TEST_DIR)/*.elf \ $(TEST_DIR)/.*.d lib/x86/.*.d \ $(TEST_DIR)/efi/*.o $(TEST_DIR)/efi/.*.d \ - $(TEST_DIR)/*.so $(TEST_DIR)/*.efi + $(TEST_DIR)/*.so $(TEST_DIR)/*.efi $(TEST_DIR)/*.debug From patchwork Sun Jun 25 23:07:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nadav Amit X-Patchwork-Id: 13292208 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC040EB64DC for ; Sun, 25 Jun 2023 23:07:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229724AbjFYXHy (ORCPT ); Sun, 25 Jun 2023 19:07:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229447AbjFYXHw (ORCPT ); Sun, 25 Jun 2023 19:07:52 -0400 Received: from mail-oa1-x2e.google.com (mail-oa1-x2e.google.com [IPv6:2001:4860:4864:20::2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56EA111A for ; Sun, 25 Jun 2023 16:07:51 -0700 (PDT) Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-1a998a2e7a6so2861151fac.1 for ; Sun, 25 Jun 2023 16:07:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687734470; x=1690326470; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=h7oWc9wSs7s043FQcLimHSRTeXEF/XHk5/+kEWBjS/c=; b=pqvibM9Ffgkw4ZAQyk1xHojANTwVtiIS5hRfZMFg52S8Cg0wwSe9XF0waWvOzUZ3uH +A4MGphX3vZX6zIK150E+uNRBcxpaZhVJezkqQBi3N4ac9p3LUlbYV2B2Fxp+uvrp0lP BvKQh2YbpRUqVtN69W7HbsMqNvuuqffL3MWT0WeLNoKGbI7dgy00IjtQ1bHmggIPSKYU y6eEVr9b6qMWTKR2DBwoikf2tmbvBdxK/PVhIfyvfQJ0zJogEnZ6LvOto3tFlel6qsk3 qRChWV7fbWA4uSBP7anYY924zkvKjQwNgjor+ykR3ndO6FBWl/LrW8PIuu3HnvDB9vSy 5tJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687734470; x=1690326470; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=h7oWc9wSs7s043FQcLimHSRTeXEF/XHk5/+kEWBjS/c=; b=ZwzMggjeIWRKJ5WmoPANC0dVK6Y3fazmCdlsC291jjQ3XrDcYQSH4SFok7ZHI8wbnP wJM/NcWaIwSYHgcFO8EPLLD0tF8Eg2TZqhJ4b3BuESlfeieFuRollani2px0eyhJONJI jOjpbSVCci+lIPW9hbjRdnLaKkw6EX2D8CZCjpW1khPeUJZx1ah1ABMM6q36hrIS7dGd PpTVPX/r05JBbPi0nb9YjQHAlpmEfSoruufKTwE2T+U47N0LlxqH+KX5o2mD4qFxLqrx 3KD53NILil56QL6+gDJlVjJQj8/3gw/dRJf/DTyfrALYU1nQpZ+hXDF+4WM+X6mpfF/h r0Wg== X-Gm-Message-State: AC+VfDzSCOXxWVf7oEjUaoeBaqMWul5NbLfp9zt36k5maDQrKaPIThOe pywYMU4mb9qaBr7MyhhXXo4= X-Google-Smtp-Source: ACHHUZ5dqO0X8bwSvx9fSgWCyvTPMYV1XorM/j0fmfwzYYbEorfh1Fp3o54fEXtpwtHf66B12UfBkg== X-Received: by 2002:a05:6808:285:b0:3a1:b638:9c2c with SMTP id z5-20020a056808028500b003a1b6389c2cmr7607809oic.55.1687734470386; Sun, 25 Jun 2023 16:07:50 -0700 (PDT) Received: from sc9-mailhost1.vmware.com (c-24-6-216-183.hsd1.ca.comcast.net. [24.6.216.183]) by smtp.gmail.com with ESMTPSA id x20-20020aa79194000000b006668f004420sm2716397pfa.148.2023.06.25.16.07.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Jun 2023 16:07:49 -0700 (PDT) From: Nadav Amit X-Google-Original-From: Nadav Amit To: Andrew Jones Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org, Nikos Nikoleris , Paolo Bonzini , Nadav Amit Subject: [kvm-unit-tests PATCH v2 2/6] lib/stack: print base addresses on efi Date: Sun, 25 Jun 2023 23:07:12 +0000 Message-Id: <20230625230716.2922-3-namit@vmware.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230625230716.2922-1-namit@vmware.com> References: <20230625230716.2922-1-namit@vmware.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Nadav Amit Making sense from dumped stacks when running EFI tests is very hard due to the relocation. Fix it by adjusting the address back to the original address. Introduce CONFIG_RELOC, which would be set on arm64 and on EFI configs. Signed-off-by: Nadav Amit --- v1->v2: Introduce CONFIG_RELOC to support ARM64 [Andrew] --- configure | 3 +++ lib/stack.c | 31 +++++++++++++++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/configure b/configure index b665f7d..8a3c8fe 100755 --- a/configure +++ b/configure @@ -416,6 +416,9 @@ EOF if [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then echo "TARGET=$target" >> config.mak fi +if [ "$efi" = "y" ] || [ "$arch" = "arm64" ]; then + echo "CONFIG_RELOC=y" >> config.mak +fi cat < lib/config.h #ifndef _CONFIG_H_ diff --git a/lib/stack.c b/lib/stack.c index bdb23fd..dd6bfa8 100644 --- a/lib/stack.c +++ b/lib/stack.c @@ -6,13 +6,38 @@ */ #include +#include #include #define MAX_DEPTH 20 +#ifdef CONFIG_RELOC +extern char _text, _etext; + +static bool base_address(const void *rebased_addr, unsigned long *addr) +{ + unsigned long ra = (unsigned long)rebased_addr; + unsigned long start = (unsigned long)&_text; + unsigned long end = (unsigned long)&_etext; + + if (ra < start || ra >= end) + return false; + + *addr = ra - start; + return true; +} +#else +static bool base_address(const void *rebased_addr, unsigned long *addr) +{ + *addr = (unsigned long)rebased_addr; + return true; +} +#endif + static void print_stack(const void **return_addrs, int depth, bool top_is_return_address) { + unsigned long addr; int i = 0; printf("\tSTACK:"); @@ -20,12 +45,14 @@ static void print_stack(const void **return_addrs, int depth, /* @addr indicates a non-return address, as expected by the stack * pretty printer script. */ if (depth > 0 && !top_is_return_address) { - printf(" @%lx", (unsigned long) return_addrs[0]); + if (base_address(return_addrs[0], &addr)) + printf(" @%lx", addr); i++; } for (; i < depth; i++) { - printf(" %lx", (unsigned long) return_addrs[i]); + if (base_address(return_addrs[i], &addr)) + printf(" %lx", addr); } printf("\n"); } From patchwork Sun Jun 25 23:07:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nadav Amit X-Patchwork-Id: 13292209 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0EE38C0015E for ; Sun, 25 Jun 2023 23:07:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229728AbjFYXHz (ORCPT ); Sun, 25 Jun 2023 19:07:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229698AbjFYXHx (ORCPT ); Sun, 25 Jun 2023 19:07:53 -0400 Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F0721BE for ; Sun, 25 Jun 2023 16:07:52 -0700 (PDT) Received: by mail-pg1-x531.google.com with SMTP id 41be03b00d2f7-557790487feso1911344a12.0 for ; Sun, 25 Jun 2023 16:07:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687734472; x=1690326472; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=21SpjF+xBmEu7QPQNtztE4cG4YYUJTEjHrp9rj09zZA=; b=mYKRtXtslrTwwqDTD/ejgHiqY78Bg3f0Ow86sGs6aIrEeLpYfPezvuDIh78Jlg8dbb dpGgzXCTTictLDtnIsHyiSWMfFM+/RoLRRIvrYNCulZ6FJnVbg+tsHpuaxPkMjbsjVcx ob74xAx+pweCRjtsPaF/4dQlHbjlZCIDJP+rUSeVBy1V+zM7maAED2cQtj2ToZnitM6x qr8ToXU/jiSmQGv6eyCbzXzlkfPbb0wqNg2PTjVKm+SEq8DPJ7lQ5ns++UOonYtp4eA1 vd9dOx2U6CPxTc5K6QcasCO2Ote5f30zpJ1Nl0OW5jv+rfJnoOIjgQC6tL6NSW1mnhxz 5vLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687734472; x=1690326472; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=21SpjF+xBmEu7QPQNtztE4cG4YYUJTEjHrp9rj09zZA=; b=bJeNhH+UIoHJm56hT3kXGjgYt2NJkjb+oToDwvDA+A0abP320GXmhHJLLZRb5Fp0PK 1cbnCbYTCc0nyBuuLngzwcCQcSSgGABIm5VlMm9Vr0bXv94RKubw/EgA5v2b5UTZw5DE OdG0iE3CFsIvQf7qlHf9FUn81IblxFPkxgqlDQJ0iMQ0LdOllAQwMWBGjHmuaqWpHowJ Myv7+icsCOzMxHtUBG7qBPfsVQSEkrvYhG8xtnu+sNsxH66b4BHH2mhRGX4vKo75PERL OTcl6isp1RWF6jVF00MUTfvw2pchrEPy4dvfJG3V1hob40QyiPtG61axJFmhWHrkGgm8 PHsw== X-Gm-Message-State: AC+VfDwsivXNf19n4ooHmzcW0DvieN9+VW8zjrOHMrWvRR5FZSgAR9Eh I9H1xHs8NKUfcEodrTJYPr8= X-Google-Smtp-Source: ACHHUZ4g4Mp3PlNC3YacyCrfQUvV+O+hcyfuZIxxGIcHCdWEgNp471z0bfFiNEcrbg19bvWen6IgdA== X-Received: by 2002:a05:6a20:3d81:b0:107:35ed:28a7 with SMTP id s1-20020a056a203d8100b0010735ed28a7mr36176837pzi.8.1687734471696; Sun, 25 Jun 2023 16:07:51 -0700 (PDT) Received: from sc9-mailhost1.vmware.com (c-24-6-216-183.hsd1.ca.comcast.net. [24.6.216.183]) by smtp.gmail.com with ESMTPSA id x20-20020aa79194000000b006668f004420sm2716397pfa.148.2023.06.25.16.07.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Jun 2023 16:07:51 -0700 (PDT) From: Nadav Amit X-Google-Original-From: Nadav Amit To: Andrew Jones Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org, Nikos Nikoleris , Paolo Bonzini , Nadav Amit Subject: [kvm-unit-tests PATCH v2 3/6] arm64: enable frame pointer and support stack unwinding Date: Sun, 25 Jun 2023 23:07:13 +0000 Message-Id: <20230625230716.2922-4-namit@vmware.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230625230716.2922-1-namit@vmware.com> References: <20230625230716.2922-1-namit@vmware.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Nadav Amit Enable frame pointers for arm64 and perform stack unwinding based on arm64 convention. Signed-off-by: Nadav Amit --- v1->v2: * Adding SPDX [checkpatch] * Moving some unused declarations to next patch [Andrew] * Adding recursion prevention --- arm/Makefile.arm | 3 --- arm/Makefile.arm64 | 1 + arm/Makefile.common | 3 +++ lib/arm64/asm/stack.h | 3 +++ lib/arm64/stack.c | 44 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 lib/arm64/stack.c diff --git a/arm/Makefile.arm b/arm/Makefile.arm index 2ce00f5..7fd39f3 100644 --- a/arm/Makefile.arm +++ b/arm/Makefile.arm @@ -11,9 +11,6 @@ ifeq ($(CONFIG_EFI),y) $(error Cannot build arm32 tests as EFI apps) endif -# stack.o relies on frame pointers. -KEEP_FRAME_POINTER := y - CFLAGS += $(machine) CFLAGS += -mcpu=$(PROCESSOR) CFLAGS += -mno-unaligned-access diff --git a/arm/Makefile.arm64 b/arm/Makefile.arm64 index eada7f9..60385e2 100644 --- a/arm/Makefile.arm64 +++ b/arm/Makefile.arm64 @@ -21,6 +21,7 @@ define arch_elf_check = endef cstart.o = $(TEST_DIR)/cstart64.o +cflatobjs += lib/arm64/stack.o cflatobjs += lib/arm64/processor.o cflatobjs += lib/arm64/spinlock.o cflatobjs += lib/arm64/gic-v3-its.o lib/arm64/gic-v3-its-cmd.o diff --git a/arm/Makefile.common b/arm/Makefile.common index 9b45a8f..bc86e44 100644 --- a/arm/Makefile.common +++ b/arm/Makefile.common @@ -22,6 +22,9 @@ $(TEST_DIR)/sieve.elf: AUXFLAGS = 0x1 ################################################################## AUXFLAGS ?= 0x0 +# stack.o relies on frame pointers. +KEEP_FRAME_POINTER := y + CFLAGS += -std=gnu99 CFLAGS += -ffreestanding CFLAGS += -O2 diff --git a/lib/arm64/asm/stack.h b/lib/arm64/asm/stack.h index d000624..be486cf 100644 --- a/lib/arm64/asm/stack.h +++ b/lib/arm64/asm/stack.h @@ -5,4 +5,7 @@ #error Do not directly include . Just use . #endif +#define HAVE_ARCH_BACKTRACE_FRAME +#define HAVE_ARCH_BACKTRACE + #endif diff --git a/lib/arm64/stack.c b/lib/arm64/stack.c new file mode 100644 index 0000000..a2024e8 --- /dev/null +++ b/lib/arm64/stack.c @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Backtrace support. + */ +#include +#include +#include + +int backtrace_frame(const void *frame, const void **return_addrs, int max_depth) +{ + const void *fp = frame; + static bool walking; + void *lr; + int depth; + + if (walking) { + printf("RECURSIVE STACK WALK!!!\n"); + return 0; + } + walking = true; + + /* + * ARM64 stack grows down. fp points to the previous fp on the stack, + * and lr is just above it + */ + for (depth = 0; fp && depth < max_depth; ++depth) { + + asm volatile ("ldp %0, %1, [%2]" + : "=r" (fp), "=r" (lr) + : "r" (fp) + : ); + + return_addrs[depth] = lr; + } + + walking = false; + return depth; +} + +int backtrace(const void **return_addrs, int max_depth) +{ + return backtrace_frame(__builtin_frame_address(0), + return_addrs, max_depth); +} From patchwork Sun Jun 25 23:07:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nadav Amit X-Patchwork-Id: 13292210 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3AA00C001B1 for ; Sun, 25 Jun 2023 23:07:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229698AbjFYXH4 (ORCPT ); Sun, 25 Jun 2023 19:07:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229536AbjFYXHy (ORCPT ); Sun, 25 Jun 2023 19:07:54 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4AB911A for ; Sun, 25 Jun 2023 16:07:53 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-666ecf9a081so2533965b3a.2 for ; Sun, 25 Jun 2023 16:07:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687734473; x=1690326473; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZBy1+s5+1bIZxGdZDUFvFfxmlLpG2meXbQVky29avoY=; b=G/FpgPODODp9mcQcSfDie54CU2ZqB6gIZ3CSo/h7Fv69axSgfZuNvgVUd7/7FgCjfU hfWMQpS0uVcv0U3IG0odySZ9l0urUV2kGFd41tZtxI+DWHK47DPHLavDaWIPGl8fy7fv ck6ndoWc26joVkr3hx3MLvMggCDPv1AH7NHbUX4nVRo7cw1xTef5Hl9PwpC4WENrXMsJ 7WtNpbEiAPZSDyiLV+x44i+v24CqJcsEFYAa97ocfMMuN2QBCtFRSs/fw410/OHpvhlp 9jJSBj6iq6PpLp/g1DkUhDlp2SarcflfuOt+SNNFE8zP7QcnlMvcOVEkpOIN9UXPbcB3 5HpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687734473; x=1690326473; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZBy1+s5+1bIZxGdZDUFvFfxmlLpG2meXbQVky29avoY=; b=E0qjm5v+2IMPereeTFmatKvOSm6ozmOPFsPK3lPDaFU8d9MyiPiyrOqveLdXH5huKp xFpZMysZgAb3K8Kj9YFrdNRwfj0uP1HyAbFvrc6g9aLd8JRsyPqcydAvypKC8aNVymRe 79mGtzw+AMryrvff/PdjmRYNkbpw9Y4AzMMcSAIHY1JJww93XoAJfB6thuj7EcDt2Bar j7DkbVvk+vxEkWOkRycicFMBx2xguz/gPxPBp+ddMrXxLeE++30y2DdQ9CQ7NIj/tvgv NFWMgJecw7NdyN5jjPDPkMDv3dH2qlNoT/VapdAzqm0gFRMRGVOJjzqGKekHiU4T0IWO d3Cw== X-Gm-Message-State: AC+VfDwhRBxrgSbnEirukpFggTJtsc4Iu1bWdy6x+cRfagzH8ilxLC8f Np2JGZxaic7agh6gwm6WsITG9/SZMn4= X-Google-Smtp-Source: ACHHUZ4x2qSpG9IBvl8L3NEad+JX+3ufu1ezTQHpdRotTSivpeCHXX1ZaOBT3uFQ1NKhHAc16/WAAQ== X-Received: by 2002:a05:6a00:1595:b0:666:e8e1:bc8d with SMTP id u21-20020a056a00159500b00666e8e1bc8dmr36877858pfk.11.1687734473111; Sun, 25 Jun 2023 16:07:53 -0700 (PDT) Received: from sc9-mailhost1.vmware.com (c-24-6-216-183.hsd1.ca.comcast.net. [24.6.216.183]) by smtp.gmail.com with ESMTPSA id x20-20020aa79194000000b006668f004420sm2716397pfa.148.2023.06.25.16.07.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Jun 2023 16:07:52 -0700 (PDT) From: Nadav Amit X-Google-Original-From: Nadav Amit To: Andrew Jones Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org, Nikos Nikoleris , Paolo Bonzini , Nadav Amit Subject: [kvm-unit-tests PATCH v2 4/6] arm64: stack: update trace stack on exception Date: Sun, 25 Jun 2023 23:07:14 +0000 Message-Id: <20230625230716.2922-5-namit@vmware.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230625230716.2922-1-namit@vmware.com> References: <20230625230716.2922-1-namit@vmware.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Nadav Amit Using gdb for backtracing or dumping the stack following an exception is not very helpful as the exact location of the exception is not saved. Add an additional frame to save the location of the exception. One delicate point is dealing with the pretty_print_stacks script. When the stack is dumped, the script would not print the right address for the exception address: for every return address it deducts "1" before looking for the instruction location in the code (using addr2line). As a somewhat hacky solution add "1" for the exception address when dumping the stack. Signed-off-by: Nadav Amit --- v1->v2: * .globl before label [Andrew] * Some comments [Andrew] --- arm/cstart64.S | 13 +++++++++++++ lib/arm64/asm-offsets.c | 6 +++++- lib/arm64/stack.c | 18 ++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/arm/cstart64.S b/arm/cstart64.S index cbd6b51..865a96d 100644 --- a/arm/cstart64.S +++ b/arm/cstart64.S @@ -314,6 +314,13 @@ exceptions_init: mrs x2, spsr_el1 stp x1, x2, [sp, #S_PC] + /* + * Save a frame pointer using the link to allow unwinding of + * exceptions. + */ + stp x29, x1, [sp, #S_FP] + add x29, sp, #S_FP + mov x0, \vec mov x1, sp mrs x2, esr_el1 @@ -349,6 +356,9 @@ exceptions_init: eret .endm +.globl vector_stub_start +vector_stub_start: + vector_stub el1t_sync, 0 vector_stub el1t_irq, 1 vector_stub el1t_fiq, 2 @@ -369,6 +379,9 @@ vector_stub el0_irq_32, 13 vector_stub el0_fiq_32, 14 vector_stub el0_error_32, 15 +.globl vector_stub_end +vector_stub_end: + .section .text.ex .macro ventry, label diff --git a/lib/arm64/asm-offsets.c b/lib/arm64/asm-offsets.c index 53a1277..80de023 100644 --- a/lib/arm64/asm-offsets.c +++ b/lib/arm64/asm-offsets.c @@ -25,6 +25,10 @@ int main(void) OFFSET(S_PSTATE, pt_regs, pstate); OFFSET(S_ORIG_X0, pt_regs, orig_x0); OFFSET(S_SYSCALLNO, pt_regs, syscallno); - DEFINE(S_FRAME_SIZE, sizeof(struct pt_regs)); + + /* FP and LR (16 bytes) go on the frame above pt_regs */ + DEFINE(S_FP, sizeof(struct pt_regs)); + DEFINE(S_FRAME_SIZE, (sizeof(struct pt_regs) + 16)); + return 0; } diff --git a/lib/arm64/stack.c b/lib/arm64/stack.c index a2024e8..82611f4 100644 --- a/lib/arm64/stack.c +++ b/lib/arm64/stack.c @@ -6,12 +6,16 @@ #include #include +extern char vector_stub_start, vector_stub_end; + int backtrace_frame(const void *frame, const void **return_addrs, int max_depth) { const void *fp = frame; static bool walking; void *lr; int depth; + bool is_exception = false; + unsigned long addr; if (walking) { printf("RECURSIVE STACK WALK!!!\n"); @@ -31,6 +35,20 @@ int backtrace_frame(const void *frame, const void **return_addrs, int max_depth) : ); return_addrs[depth] = lr; + + /* + * If this is an exception, add 1 to the pointer so when the + * pretty_print_stacks script is run it would get the right + * address (it deducts 1 to find the call address, but we want + * the actual address). + */ + if (is_exception) + return_addrs[depth] += 1; + + /* Check if we are in the exception handlers for the next entry */ + addr = (unsigned long)lr; + is_exception = (addr >= (unsigned long)&vector_stub_start && + addr < (unsigned long)&vector_stub_end); } walking = false; From patchwork Sun Jun 25 23:07:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nadav Amit X-Patchwork-Id: 13292211 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6BC0EB64DC for ; Sun, 25 Jun 2023 23:07:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229753AbjFYXH5 (ORCPT ); Sun, 25 Jun 2023 19:07:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229754AbjFYXH4 (ORCPT ); Sun, 25 Jun 2023 19:07:56 -0400 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EF37E46 for ; Sun, 25 Jun 2023 16:07:55 -0700 (PDT) Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-666e916b880so1203656b3a.2 for ; Sun, 25 Jun 2023 16:07:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687734475; x=1690326475; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1zfLc8s8ukm6B8uTEBNuw3gp/VvXLK+Q2HtLxCf87RA=; b=AynI/fZMfTDQaf+uit3KBv2q/DJ9daWnRBz76NzDxTFBam4mj9rsWeOM1TwnMy+mdN ziXPVeb9KYV5pHMUL8bdcpq4qsWMJr95dKpz+LOP5Jbex2hnflc+lSHY+PdGj7sK4i5D nsFBHOASa9caRVyrAtp1ZZmHDj7x+bkkg1j64ePu+xNpfX7//dja9qtd9yLknR9rSG/K NKUtJ/4ZDik9XNgCp9/ClIyBiPO+nSxKki06oJKV54kGbMdwTqV+Lme7P1PucGT00oK/ hVOIQuVOuQgGl3CmUnuEXLxyPXn+eIkNPlTXpCLd4wPWx9a9+A2/Y6kJYucUiBdAdWVu rMfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687734475; x=1690326475; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1zfLc8s8ukm6B8uTEBNuw3gp/VvXLK+Q2HtLxCf87RA=; b=E8qn/8U7Z0yZkoFLPjlGSI4+INLgLROPaN1awFpvBbWgv9BHa0Tzx+fpbXR08wgO+G 3P2fNOefV4CB4gWodVYNl0M3HgDfeP0oVHV3HL/XIZWq/nieA+Vu5Hi5ynI1ihX4ZP3Y v4K4bYrOdowWyPAauv1+P/bAIlCAkhoPSm6hdE57aV7RF1FqqQVGThHkt/bsUa9wfI4S 05Fto2ApIrRDEJwzB0HTUY+bYdFn0qEqCi1DDtzQli34kr/rvfYADNF49j2J0cvhI/yG 7VzUE22eJFXToMTBdqWCahNMq3DscYSWXB3L4crcI8SK6CQuz4CuPqwc26eMXr3n9LL+ yKRA== X-Gm-Message-State: AC+VfDwGMh8Z/0lzwRVchtIa+Ntph9WPoWH/Qe1DhDwAXotQjnRxs7vw +nTygn67f/cxYIctas6lbmE= X-Google-Smtp-Source: ACHHUZ51li6kaeUchqHwWbbjtLqSUUE2pFgSQxSkwB36acZS+Cdmp79EVQgN2I58zJnvMK3amYaQaA== X-Received: by 2002:a05:6a00:194d:b0:666:2889:32bd with SMTP id s13-20020a056a00194d00b00666288932bdmr16655032pfk.9.1687734474490; Sun, 25 Jun 2023 16:07:54 -0700 (PDT) Received: from sc9-mailhost1.vmware.com (c-24-6-216-183.hsd1.ca.comcast.net. [24.6.216.183]) by smtp.gmail.com with ESMTPSA id x20-20020aa79194000000b006668f004420sm2716397pfa.148.2023.06.25.16.07.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Jun 2023 16:07:53 -0700 (PDT) From: Nadav Amit X-Google-Original-From: Nadav Amit To: Andrew Jones Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org, Nikos Nikoleris , Paolo Bonzini , Nadav Amit Subject: [kvm-unit-tests PATCH v2 5/6] efi: print address of image Date: Sun, 25 Jun 2023 23:07:15 +0000 Message-Id: <20230625230716.2922-6-namit@vmware.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230625230716.2922-1-namit@vmware.com> References: <20230625230716.2922-1-namit@vmware.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Nadav Amit Using gdb to debug tests that are run from efi is very hard without knowing the base address in which the image was loaded. Print the address so it can be used while debugging. Signed-off-by: Nadav Amit --- lib/efi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/efi.c b/lib/efi.c index 2e127a4..2091771 100644 --- a/lib/efi.c +++ b/lib/efi.c @@ -19,6 +19,8 @@ extern int __argc, __envc; extern char *__argv[100]; extern char *__environ[200]; +extern char _text; + extern int main(int argc, char **argv, char **envp); efi_system_table_t *efi_system_table = NULL; @@ -363,6 +365,8 @@ efi_status_t efi_main(efi_handle_t handle, efi_system_table_t *sys_tab) goto efi_main_error; } + printf("Address of image is: 0x%lx\n", (unsigned long)&_text); + /* Run the test case */ ret = main(__argc, __argv, __environ); From patchwork Sun Jun 25 23:07:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nadav Amit X-Patchwork-Id: 13292212 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0CC1EB64DD for ; Sun, 25 Jun 2023 23:07:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229767AbjFYXH7 (ORCPT ); Sun, 25 Jun 2023 19:07:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229754AbjFYXH5 (ORCPT ); Sun, 25 Jun 2023 19:07:57 -0400 Received: from mail-oi1-x229.google.com (mail-oi1-x229.google.com [IPv6:2607:f8b0:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5AF211A for ; Sun, 25 Jun 2023 16:07:56 -0700 (PDT) Received: by mail-oi1-x229.google.com with SMTP id 5614622812f47-38c35975545so2540591b6e.1 for ; Sun, 25 Jun 2023 16:07:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687734476; x=1690326476; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Bl2xS0hpaMhLNXGaRDLAye8tC/jIz9OZNyY0aYdzy3U=; b=KbMaFmSofqmick+plETX0T+mF+UV+45vO49VyJ7JA6kAtF+qJwHiCKXRLip4J88uGr Igti9yUpic3Ls6GY/9Wha/3gaYHrnG0Vxf5eLjXHL2OBTYPXyySoTPm2MXH7nuyXL0zU nbMWVHtWgtx2khr7nFXLRQQ0Si1b2nK8iKK5ux5dix7U+Av1DAG0gxqpg3bvLu2vjNRH cY5Rfh6Ydbm7PeimaHCmBjEwAROiXJBBi8gYYHMhnc+vDRaXgpPoGCvSxKCqxtHElfxu +iL7UjdJ6KTTDR9xGg5mXl5jSq58WqIZyVbupMgxcQcFva87aSVNt4dDoCsITFwlVVGE cFtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687734476; x=1690326476; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Bl2xS0hpaMhLNXGaRDLAye8tC/jIz9OZNyY0aYdzy3U=; b=UF/Twng9aCYc2dGCtfbGY0juuk5dRk7slCWtMIom11f28NdcFGE5oPuksg6Qxv7+Pr e6FTNMB4/1XoZNVR5VHqPPUHWIpIhzfuySpSbl2BvYmbTpQxE0GpH4Sl9j3PRkR59f5j B2qcLtKGkAia0RIEgPK1YDf23L8HmHgPB5VLV9AFHtu9HIdtaRFVT92+rg2qoL17zrId DrWxBE0jI/oR207iAb8QIjTdTFWPhpw+7B9/sl3pPCqZvahu8eOTUGr7hOKIG5LX2NSS ZBMr71oNOHrvI43DMHHkJjClW+7WdRDSRAuL37F4i7wt027n0VP6iiCsOylOY2yorEZ8 ECvA== X-Gm-Message-State: AC+VfDxmMUIgnoIk+k3Wm+J9JEcghkut7beFT+dXLySUvGrrHgRsDqTB iBHxMpIV7j7h7ZQMhx6CVZY= X-Google-Smtp-Source: ACHHUZ5+5W+RcZMMKDb8pS61tgrv8Ela1lzVu99tUh2smk0denIO+W1dQYrHPE6NAvbWasv4+kzOUg== X-Received: by 2002:a05:6808:14c5:b0:39f:393f:688c with SMTP id f5-20020a05680814c500b0039f393f688cmr27624441oiw.22.1687734475810; Sun, 25 Jun 2023 16:07:55 -0700 (PDT) Received: from sc9-mailhost1.vmware.com (c-24-6-216-183.hsd1.ca.comcast.net. [24.6.216.183]) by smtp.gmail.com with ESMTPSA id x20-20020aa79194000000b006668f004420sm2716397pfa.148.2023.06.25.16.07.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Jun 2023 16:07:55 -0700 (PDT) From: Nadav Amit X-Google-Original-From: Nadav Amit To: Andrew Jones Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org, Nikos Nikoleris , Paolo Bonzini , Nadav Amit Subject: [kvm-unit-tests PATCH v2 6/6] arm64: dump stack on bad exception Date: Sun, 25 Jun 2023 23:07:16 +0000 Message-Id: <20230625230716.2922-7-namit@vmware.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230625230716.2922-1-namit@vmware.com> References: <20230625230716.2922-1-namit@vmware.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Nadav Amit Upon a bad exception, the stack is rather useful for debugging, splat it out. Signed-off-by: Nadav Amit --- lib/arm64/processor.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/arm64/processor.c b/lib/arm64/processor.c index 831207c..5bcad67 100644 --- a/lib/arm64/processor.c +++ b/lib/arm64/processor.c @@ -130,6 +130,7 @@ static void bad_exception(enum vector v, struct pt_regs *regs, printf("Vector: %d (%s)\n", v, vector_names[v]); printf("ESR_EL1: %8s%08x, ec=%#x (%s)\n", "", esr, ec, ec_names[ec]); printf("FAR_EL1: %016lx (%svalid)\n", far, far_valid ? "" : "not "); + dump_stack(); printf("Exception frame registers:\n"); show_regs(regs); abort();