Path: blob/master/tools/testing/selftests/kexec/test_kexec_jump.sh
26285 views
#!/bin/sh1# SPDX-License-Identifier: GPL-2.02#3# Prevent loading a kernel image via the kexec_load syscall when4# signatures are required. (Dependent on CONFIG_IMA_ARCH_POLICY.)56TEST="$0"7. ./kexec_common_lib.sh89# kexec requires root privileges10require_root_privileges1112# get the kernel config13get_kconfig1415kconfig_enabled "CONFIG_KEXEC_JUMP=y" "kexec_jump is enabled"16if [ $? -eq 0 ]; then17log_skip "kexec_jump is not enabled"18fi1920kconfig_enabled "CONFIG_IMA_APPRAISE=y" "IMA enabled"21ima_appraise=$?2223kconfig_enabled "CONFIG_IMA_ARCH_POLICY=y" \24"IMA architecture specific policy enabled"25arch_policy=$?2627get_secureboot_mode28secureboot=$?2930if [ $secureboot -eq 1 ] && [ $arch_policy -eq 1 ]; then31log_skip "Secure boot and CONFIG_IMA_ARCH_POLICY are enabled"32fi3334./test_kexec_jump35if [ $? -eq 0 ]; then36log_pass "kexec_jump succeeded"37else38# The more likely failure mode if anything went wrong is that the39# kernel just crashes. But if we get back here, sure, whine anyway.40log_fail "kexec_jump failed"41fi424344