blob: 1bbbfd3f14302009249a496d2055d39132a0ef3e [file] [log] [blame] [edit]
# Copyright 2023 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Kernel panic if we are testing pre-boot-collector kernel crashes.
description "Conditionally crash the kernel before the boot collector runs."
author "chromium-os-dev@chromium.org"
# We must run before the boot collector; this should be good enough. (boot
# collector runs on started system-services.)
start on started boot-services
task
# This is extremely unlikely to run out of memory.
oom score -100
script
source_dir="/mnt/stateful_partition/unencrypted/preserve"
if [ -f "${source_dir}/crash-kernel-early" ]; then
rm "${source_dir}/crash-kernel-early" # croslint: disable: test only
# Ensure file changes are persisted so we don't kernel panic in a loop.
sync
# Panic the machine.
if [ -f /sys/kernel/debug/provoke-crash/DIRECT ]; then
echo PANIC > /sys/kernel/debug/provoke-crash/DIRECT
else
echo panic > /proc/breakme
fi
fi
end script