mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-07-10 17:09:27 -04:00
Add kernel panic util function
Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
parent
b30101aba6
commit
4b156be15e
1 changed files with 17 additions and 0 deletions
17
internal/utils/utils.go
Normal file
17
internal/utils/utils.go
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
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.Println(err)
|
||||||
|
_ = os.WriteFile("/proc/sys/kernel/sysrq", []byte("1"), 0o644)
|
||||||
|
_ = os.WriteFile("/proc/sysrq-trigger", []byte("c"), 0o644)
|
||||||
|
panic(err)
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue