aboutsummaryrefslogtreecommitdiffstats
path: root/sys/linux/init.go
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@google.com>2020-07-21 14:26:17 +0200
committerAndrey Konovalov <andreyknvl@gmail.com>2020-07-21 16:47:38 +0200
commita688ac13532252c1125ae8af6a190531d618ed8a (patch)
tree7cc0316c3c927dbc5ba7f649b4878a31a4a12065 /sys/linux/init.go
parente562dd8adff015d44bec3d7fd8e6608a3a031ff3 (diff)
sys/linux: disable SNAPSHOT_POWER_OFF
It causes shutdowns.
Diffstat (limited to 'sys/linux/init.go')
-rw-r--r--sys/linux/init.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/linux/init.go b/sys/linux/init.go
index f7525583b..928ba17e5 100644
--- a/sys/linux/init.go
+++ b/sys/linux/init.go
@@ -24,6 +24,7 @@ func InitTarget(target *prog.Target) {
FIFREEZE: target.GetConst("FIFREEZE"),
FITHAW: target.GetConst("FITHAW"),
SNAPSHOT_FREEZE: target.GetConst("SNAPSHOT_FREEZE"),
+ SNAPSHOT_POWER_OFF: target.GetConst("SNAPSHOT_POWER_OFF"),
EXT4_IOC_SHUTDOWN: target.GetConst("EXT4_IOC_SHUTDOWN"),
EXT4_IOC_RESIZE_FS: target.GetConst("EXT4_IOC_RESIZE_FS"),
EXT4_IOC_MIGRATE: target.GetConst("EXT4_IOC_MIGRATE"),
@@ -122,6 +123,7 @@ type arch struct {
FIFREEZE uint64
FITHAW uint64
SNAPSHOT_FREEZE uint64
+ SNAPSHOT_POWER_OFF uint64
EXT4_IOC_SHUTDOWN uint64
EXT4_IOC_RESIZE_FS uint64
EXT4_IOC_MIGRATE uint64
@@ -242,6 +244,9 @@ func (arch *arch) neutralizeIoctl(c *prog.Call) {
case arch.SNAPSHOT_FREEZE:
// SNAPSHOT_FREEZE freezes all processes and leaves the machine dead.
cmd.Val = arch.FITHAW
+ case arch.SNAPSHOT_POWER_OFF:
+ // SNAPSHOT_POWER_OFF shuts down the machine.
+ cmd.Val = arch.FITHAW
case arch.EXT4_IOC_SHUTDOWN:
// EXT4_IOC_SHUTDOWN on root fs effectively brings the machine down in weird ways.
// Fortunately, the value does not conflict with any other ioctl commands for now.