mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-12-26 16:09:45 -05:00
0e2025b67c
Signed-off-by: Daniel Weiße <dw@edgeless.systems>
18 lines
425 B
Go
18 lines
425 B
Go
package utils
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
// KernelPanic prints the error and triggers a kernel panic.
|
|
//
|
|
// This function WILL cause a system crash!
|
|
// DO NOT call it in any code that may be covered by automatic or manual tests.
|
|
func KernelPanic(err error) {
|
|
fmt.Fprint(os.Stderr, err)
|
|
_ = os.WriteFile("/proc/sys/kernel/sysrq", []byte("1"), 0o644)
|
|
_ = os.WriteFile("/proc/sysrq-trigger", []byte("c"), 0o644)
|
|
panic(err)
|
|
}
|