From 28929764ac19e20117595935f6167149b86a4cf4 Mon Sep 17 00:00:00 2001 From: Al Cutter Date: Wed, 13 Mar 2024 16:42:03 +0000 Subject: [PATCH] Cause applet crashes to hang indefinitely --- trusted_os/debug.go | 14 +++++++------- trusted_os/main.go | 7 ------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/trusted_os/debug.go b/trusted_os/debug.go index 2ec75de..2494305 100644 --- a/trusted_os/debug.go +++ b/trusted_os/debug.go @@ -185,15 +185,15 @@ func segfault(buf []byte, ctx *monitor.ExecCtx) (err error) { } func inspect(buf []byte, ctx *monitor.ExecCtx) (err error) { - if false { - log.Printf("PC\t%s", fileLine(buf, ctx.R15)) // PC - log.Printf("LR\t%s", fileLine(buf, ctx.R14)) // LR + log.Printf("PC\t%s", fileLine(buf, ctx.R15)) // PC + log.Printf("LR\t%s", fileLine(buf, ctx.R14)) // LR - switch ctx.ExceptionVector { - case arm.UNDEFINED, arm.PREFETCH_ABORT, arm.DATA_ABORT: - return segfault(buf, ctx) - } + switch ctx.ExceptionVector { + case arm.UNDEFINED, arm.PREFETCH_ABORT, arm.DATA_ABORT: + return segfault(buf, ctx) } + // XXX block forever + <-make(chan bool, 1) return } diff --git a/trusted_os/main.go b/trusted_os/main.go index fdc73ba..2b70c28 100644 --- a/trusted_os/main.go +++ b/trusted_os/main.go @@ -252,13 +252,6 @@ func main() { // never returns handleInterrupts() - - if debug { - // We never hit this due to handleInterrupts not returning, but having this line here - // forces the linker to keep the symbol present which is necessary for the inspect() - // function to work for debug builds. - runtime.CallOnG0() - } } func createBundleVerifier(logOrigin string, logVerifier note.Verifier, manifestVerifiers []string) (firmware.BundleVerifier, error) {