From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::444; helo=mail-wr1-x444.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 263D22119378C for ; Tue, 11 Dec 2018 05:25:16 -0800 (PST) Received: by mail-wr1-x444.google.com with SMTP id j10so14065950wru.4 for ; Tue, 11 Dec 2018 05:25:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=8rhSQt4SVfdSQfDYa/PpvmhjqFcDFwCK7aLn3s0JxTg=; b=d2xj53Jk+YEaxHzWmQ3jWOFGbmQGxdhZeP7zyRzEM58yyi2AkQhRqboWav5Lj3K4GS kRfVQBpOEAwrZqVKcrSyZoK5qgLceNRMkeinoK2rqY7k95y208goj4YvbhpHANyHkPza 8mH1U/yNGN8d8HGukQlAMfirvkme8yixpMIv4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=8rhSQt4SVfdSQfDYa/PpvmhjqFcDFwCK7aLn3s0JxTg=; b=mAzDOI4vxcVSMyRbzzIWWBSJTt4Sg9RPIUf7MtCNAe/Q7j0Vo4QZKvbN3ju/UTVqBd qz5smpmP1j4GdsrA3EZdTW2hw26Xih6JMJyowful8QfRlCqb35/yoGQpTQ97GGANrDrI ktHdC+FPa0Qr0CxP8x4fWVuS7YJw7f1+q8AQPvRj3/lwn9gMm7CKJofl1tLOJIhTIxp+ r910QFcFSGFocWpNifonlFjtU0FfV6m+nZGLO4ZL0xmuVHZox+VOoVB8LENxdqCGC8JR 6cxXQHvmQNrsbDf09eRhYuQ4y1SidU+5iMlpidtCmIh8RKJ3J1RkLjvi7eJ0TXxdXZsq 2ZDA== X-Gm-Message-State: AA+aEWaetw3/+04RrSzSbczysBdPssZkV6EpkuDYlUx/NDi3grKEsJO2 HGQAOZP6xJpAvCcwOTdDFre6Za051f/6kQ== X-Google-Smtp-Source: AFSGD/W63uA7k2Qel0qjFTvmPQTzIQ+blt+IMCrzEXB3C1lYHWV8FlCGqrsLNCs/8fiXeXLUhWvJxw== X-Received: by 2002:a5d:63c3:: with SMTP id c3mr13153170wrw.215.1544534714265; Tue, 11 Dec 2018 05:25:14 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:8c3:6b9d:cbc9:58c6]) by smtp.gmail.com with ESMTPSA id n17sm25945wmc.5.2018.12.11.05.25.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Dec 2018 05:25:12 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Tue, 11 Dec 2018 14:25:10 +0100 Message-Id: <20181211132510.21359-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Subject: [PATCH] ArmPkg/DefaultExceptionHandlerLib ARM: avoid endless loop in RELEASE builds X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Dec 2018 13:25:17 -0000 Content-Transfer-Encoding: 8bit Ensure that we prevent the CPU from proceeding after having taken an unhandled exception on a RELEASE build, which does not contain the ASSERT() which ensures this on DEBUG and NOOPT builds. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c b/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c index 0b9da031b47d..9d96d5aabd96 100644 --- a/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c +++ b/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c @@ -267,10 +267,15 @@ DefaultExceptionHandler ( DEBUG ((EFI_D_ERROR, "\n")); ASSERT (FALSE); + if (!PcAdjust) { + CpuDeadLoop (); + } + // Clear the error registers that we have already displayed incase some one wants to keep going SystemContext.SystemContextArm->DFSR = 0; SystemContext.SystemContextArm->IFSR = 0; // If some one is stepping past the exception handler adjust the PC to point to the next instruction SystemContext.SystemContextArm->PC += PcAdjust; + } -- 2.19.2