From b53cc98db93b672fcaa0bfa1a0e232bbe3ce65d7 Mon Sep 17 00:00:00 2001 From: Qiyang Sun <qs2g22@soton.ac.uk> Date: Thu, 15 Aug 2024 21:35:18 +0100 Subject: [PATCH] Fastinit trigger kernel panic if argument invalid --- recipes-core/fastinit/files/fastinit.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/recipes-core/fastinit/files/fastinit.sh b/recipes-core/fastinit/files/fastinit.sh index 5d805bb..5c89cc2 100755 --- a/recipes-core/fastinit/files/fastinit.sh +++ b/recipes-core/fastinit/files/fastinit.sh @@ -77,9 +77,12 @@ level_six() { runlevel=$1 if [ -z "$runlevel" ]; then - warn_to_kernel "cannot read runlevel from argument" + crit_to_kernel "cannot read runlevel from argument" warn_to_kernel "please edit cmdline.txt in bootfs" warn_to_kernel "usage: init=/usr/sbin/fastinit RUNLEVEL" + crit_to_kernel "triggering kernel panic (c) using sysrq" + mount -t proc proc /proc + echo c > /proc/sysrq-trigger else case $runlevel in 0) @@ -105,8 +108,11 @@ else level_six ;; *) - warn_to_kernel "Runlevel $runlevel not implemented" + crit_to_kernel "Runlevel $runlevel not implemented" warn_to_kernel "usage: /usr/sbin/fastinit RUNLEVEL" + crit_to_kernel "triggering kernel panic (c) using sysrq" + mount -t proc proc /proc + echo c > /proc/sysrq-trigger ;; esac fi -- GitLab