33 asm volatile (
"1: vmclear %[ptr]; 2:"
47 asm volatile (
"1: vmptrld %[ptr]; 2:"
61 asm volatile (
"1: vmptrst %[ptr]; 2:"
63 :
"+D" (ex), [ptr]
"=m" (addr)
74 asm volatile (
"1: vmread %[field], %[value]; 2:"
76 :
"+D" (ex), [value]
"=rm" (tmp)
87 asm volatile (
"1: vmwrite %[value], %[field]; 2:"
90 : [field]
"r" (0l), [value]
"rm" (0l),
100 asm volatile (
"1: vmlaunch; 2:"
112 asm volatile (
"1: vmresume; 2:"
124 asm volatile (
"1: vmxoff; 2:"
137 asm volatile (
"1: vmxon %[ptr]; 2:"
149 struct {
uint64_t eptp, rsvd; } desc;
151 asm volatile (
"1: invept %[desc], %[type]; 2:"
154 : [type]
"r" (0l), [desc]
"m" (desc),
163 struct {
uint64_t vpid, linear; } desc;
165 asm volatile (
"1: invvpid %[desc], %[type]; 2:"
168 : [type]
"r" (0l), [desc]
"m" (desc),
174static const struct test {
203 xtf_error(
"Error: CR4.VMXE found unexpectedly set\n");
218 xtf_failure(
"Fail: CR4.VMXE settable without feature\n");
220 xtf_success(
"Success: Probably not vulnerable to XSA-278\n");
bool ex_record_fault_edi(struct cpu_regs *regs, const struct extable_entry *ex)
Record the current fault in %edi.
static unsigned long read_cr4(void)
static bool write_cr4_safe(unsigned long cr4)
static void write_cr4(unsigned long cr4)
void test_main(void)
To be implemented by each test, as its entry point.
const char test_title[]
The title of the test.
#define EXINFO_SYM(exc, ec)
unsigned int exinfo_t
Packed exception and error code information.
#define _ASM_EXTABLE_HANDLER(fault, fixup, handler)
Create an exception table entry with custom handler.
#define _p(v)
Express an abitrary integer v as void *.
void xtf_failure(const char *fmt,...)
Report a test failure.
void xtf_error(const char *fmt,...)
Report a test error.
void xtf_success(const char *fmt,...)
Report test success.
unsigned long(* fn)(unsigned long)
static exinfo_t stub_vmclear(void)
static exinfo_t stub_vmptrst(void)
static exinfo_t stub_vmxoff(void)
static exinfo_t stub_invept(void)
static exinfo_t stub_vmwrite(void)
static exinfo_t stub_vmlaunch(void)
static exinfo_t stub_vmptrld(void)
static exinfo_t stub_vmxon(void)
static exinfo_t stub_invvpid(void)
static const struct test tests[]
static exinfo_t stub_vmresume(void)
static exinfo_t stub_vmread(void)