Skip to content

Commit cecd25c

Browse files
committed
x86/reboot: Secure Launch SEXIT support on reboot paths
If the MLE kernel is being powered off, rebooted or halted, then SEXIT must be called. Note that the GETSEC[SEXIT] leaf can only be called after a machine_shutdown() has been done on these paths. The machine_shutdown() is not called on a few paths like when poweroff action does not have a poweroff callback (into ACPI code) or when an emergency reset is done. In these cases, just the TXT registers are finalized but SEXIT is skipped. Signed-off-by: Ross Philipson <ross.philipson@oracle.com> Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
1 parent 4e71187 commit cecd25c

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

arch/x86/kernel/reboot.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/objtool.h>
1414
#include <linux/pgtable.h>
1515
#include <linux/kexec.h>
16+
#include <linux/slaunch.h>
1617
#include <acpi/reboot.h>
1718
#include <asm/io.h>
1819
#include <asm/apic.h>
@@ -778,6 +779,12 @@ static void native_machine_restart(char *__unused)
778779

779780
if (!reboot_force)
780781
machine_shutdown();
782+
/*
783+
* The comments for slaunch_finalize() provides the explanation for the
784+
* conditions required to do the SEXIT op reflected in the conditional
785+
* parameter do_sexit.
786+
*/
787+
slaunch_finalize(!reboot_force);
781788
__machine_emergency_restart(0);
782789
}
783790

@@ -788,6 +795,8 @@ static void native_machine_halt(void)
788795

789796
tboot_shutdown(TB_SHUTDOWN_HALT);
790797

798+
slaunch_finalize(1);
799+
791800
stop_this_cpu(NULL);
792801
}
793802

@@ -796,8 +805,12 @@ static void native_machine_power_off(void)
796805
if (kernel_can_power_off()) {
797806
if (!reboot_force)
798807
machine_shutdown();
808+
slaunch_finalize(!reboot_force);
799809
do_kernel_power_off();
810+
} else {
811+
slaunch_finalize(0);
800812
}
813+
801814
/* A fallback in case there is no PM info available */
802815
tboot_shutdown(TB_SHUTDOWN_HALT);
803816
}
@@ -825,6 +838,7 @@ void machine_shutdown(void)
825838

826839
void machine_emergency_restart(void)
827840
{
841+
slaunch_finalize(0);
828842
__machine_emergency_restart(1);
829843
}
830844

0 commit comments

Comments
 (0)