diff mbox series

[edk2,v2] ArmPkg/DefaultExceptionHandlerLib ARM: avoid endless loop in RELEASE builds

Message ID 20181219173907.2602-1-ard.biesheuvel@linaro.org
State Accepted
Commit 5c8bc8be9e5e4665ab7e31558db9e3fe9990a13e
Headers show
Series [edk2,v2] ArmPkg/DefaultExceptionHandlerLib ARM: avoid endless loop in RELEASE builds | expand

Commit Message

Ard Biesheuvel Dec. 19, 2018, 5:39 p.m. UTC
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.

Retain the code following the deadloop so that we can keep going when
running in a debugger.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
v2: remove pointless 'if (!PcdAdjust)' conditional

 ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c | 2 ++
 1 file changed, 2 insertions(+)

-- 
2.19.2

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Leif Lindholm Dec. 19, 2018, 7:11 p.m. UTC | #1
On Wed, Dec 19, 2018 at 06:39:07PM +0100, Ard Biesheuvel wrote:
> 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.

> 

> Retain the code following the deadloop so that we can keep going when

> running in a debugger.


Could you add a clarifying comment to this extent?
Because I was scratching my head when I looked at that before :)

With that:
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>


> 

> Contributed-under: TianoCore Contribution Agreement 1.1

> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---

> v2: remove pointless 'if (!PcdAdjust)' conditional

> 

>  ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c | 2 ++

>  1 file changed, 2 insertions(+)

> 

> diff --git a/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c b/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c

> index 0b9da031b47d..4978711ed0e8 100644

> --- a/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c

> +++ b/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c

> @@ -267,6 +267,8 @@ DefaultExceptionHandler (

>    DEBUG ((EFI_D_ERROR, "\n"));

>    ASSERT (FALSE);

>  

> +  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;

> -- 

> 2.19.2

> 

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Ard Biesheuvel Dec. 19, 2018, 8:06 p.m. UTC | #2
On Wed, 19 Dec 2018 at 20:11, Leif Lindholm <leif.lindholm@linaro.org> wrote:
>

> On Wed, Dec 19, 2018 at 06:39:07PM +0100, Ard Biesheuvel wrote:

> > 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.

> >

> > Retain the code following the deadloop so that we can keep going when

> > running in a debugger.

>

> Could you add a clarifying comment to this extent?

> Because I was scratching my head when I looked at that before :)

>

> With that:

> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

>


Pushed as 5c8bc8be9e5e4665ab7e31558db9e3fe9990a13e

> >

> > Contributed-under: TianoCore Contribution Agreement 1.1

> > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> > ---

> > v2: remove pointless 'if (!PcdAdjust)' conditional

> >

> >  ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c | 2 ++

> >  1 file changed, 2 insertions(+)

> >

> > diff --git a/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c b/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c

> > index 0b9da031b47d..4978711ed0e8 100644

> > --- a/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c

> > +++ b/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c

> > @@ -267,6 +267,8 @@ DefaultExceptionHandler (

> >    DEBUG ((EFI_D_ERROR, "\n"));

> >    ASSERT (FALSE);

> >

> > +  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;

> > --

> > 2.19.2

> >

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox series

Patch

diff --git a/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c b/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c
index 0b9da031b47d..4978711ed0e8 100644
--- a/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c
+++ b/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c
@@ -267,6 +267,8 @@  DefaultExceptionHandler (
   DEBUG ((EFI_D_ERROR, "\n"));
   ASSERT (FALSE);
 
+  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;