troglobit / finit

Fast init for Linux. Cookies included
https://troglobit.com/projects/finit/
MIT License
633 stars 63 forks source link

Ctrl-C in login shell is forwarded to PID 1 causing reboot #175

Closed troglobit closed 3 years ago

troglobit commented 3 years ago

Westermo reports that the following TCL script can be used to cause a system reboot due to SIGINT being forwarded from the login shell to Finit.

#!/usr/bin/env tclsh

package require Expect

spawn "console" "-f" "ser14"
sleep 1
send "\n"
send "\n"

set count 10;
while {$count > 0} {
    send "\r"
    expect {
        ":/#> " {
            puts "All, set lets go"
            send "\004"
            for {set i 0} {$i < 100} {incr i} {
                send "\003"
            }

            sleep 2
        }

        "Please press Enter to activate this console." {
            send "\r"
        }

        "ogin:" {
            send "admin\r"
        }

        "assword:" {
            send "admin\r"
        }
    }
}
troglobit commented 3 years ago

Confirmed.

hongkongkiwi commented 3 years ago

Could this be added as an optional feature? I like this behaviour.

troglobit commented 3 years ago

No, this was a bug. I have no intention of bringing it back ever again. It's very dangerous to allow signals to reach PID 1 in this fashion. And I also don't want to support such use-cases.