[OpenWrt-Devel] idea: trigger failsafe mode "in software"
bittorf at bluebottle.com
Sun Oct 12 11:42:18 EDT 2014
sometimes it can be useful to trigger failsafe
without beeing physically at the box. during
bootup there is a decision made if the box should
startup normal or in failsafe.
in this state we dont have uci yet (or the rootfs)
but it should be possible to early mount the debugfs
and look for a magic string which can be found in crashlog
a "magic crash" can be made with e.g.
echo -e '#!/bin/sh\necho c >/proc/sysrq-trigger' >/tmp/do_failsafe.sh
chmod +x /tmp/do_failsafe.sh
after the artificial crashreboot, we can see in '/sys/kernel/debug/crashlog'
<6>[ 347.690000] SysRq : Trigger a crash
<1>[ 347.690000] CPU 0 Unable to handle kernel paging request at virtual address 00000000, epc == 801a7ea4, ra == 801a826c <4>[ 347.690000] Oops[#1]:
<4>[ 347.690000] CPU: 0 PID: 7268 Comm: do_failsafe.sh Not tainted 3.10.36 #5
<4>[ 347.690000] task: 8084d920 ti: 81840000 task.ti: 81840000
<4>[ 347.690000] $ 0 : 00000000 00000001 00000001 00000001
so in /lib/preinit/30_failsafe_wait we can do e.g.:
head -n6 /sys/kernel/debug/crashlog |
fgrep -q ' Comm: do_failsafe.sh ' && FAILSAFE=true
two questions raise up:
is it too much mount debugfs during bootup, because
failsafe also means "minimal influence"
is it a security hole?
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
More information about the openwrt-devel