Xen Test Framework
Macros | Functions | Variables
main.c File Reference

XSA-192 More...

#include <xtf.h>
+ Include dependency graph for main.c:

Go to the source code of this file.

Macros

#define LDTE   0
 
#define LDT_SEL   ((LDTE << 3) | X86_SEL_LDT | 3)
 

Functions

void ret_from_vm86 (void)
 
 asm (".align 16;" "ret_from_vm86:" "mov $" STR(__USER_DS) ", %edx;" "mov %edx, %ds;" "mov %edx, %es;" "mov %edx, %fs;" "mov %edx, %gs;" "mov %dr0, %esp;" "jmp .Ltss_ret_point;")
 
unsigned long user_ldt_use (void)
 
void test_main (void)
 To be implemented by each test, as its entry point. More...
 

Variables

const char test_title [] = "XSA-192 PoC"
 The title of the test. More...
 
static const struct xtf_idte idte
 
env_tss vm86_tss
 

Detailed Description

XSA-192

Definition in file main.c.

Macro Definition Documentation

◆ LDTE

#define LDTE   0

◆ LDT_SEL

#define LDT_SEL   ((LDTE << 3) | X86_SEL_LDT | 3)

Function Documentation

◆ ret_from_vm86()

void ret_from_vm86 ( void  )

◆ asm()

asm ( ".align 16;" "ret_from_vm86:" "mov $" STR(__USER_DS) "  ,
%edx;" "mov %  edx,
%ds;" "mov %  edx,
%es;" "mov %  edx,
%fs;" "mov %  edx,
%gs;" "mov %  dr0,
%esp;" "jmp .Ltss_ret_point;"   
)

◆ user_ldt_use()

unsigned long user_ldt_use ( void  )

Definition at line 60 of file main.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ test_main()

void test_main ( void  )

To be implemented by each test, as its entry point.

Todo:
Implement better command line infrastructure, but this will do for now.

At the time of writing, Xen doesn't correctly handle invlpg while running in shadow mode on AMD Gen1 hardware lacking decode assistance. For this test, we simply care that Xen doesn't crash.

Definition at line 82 of file main.c.

+ Here is the call graph for this function:

Variable Documentation

◆ test_title

const char test_title[] = "XSA-192 PoC"

The title of the test.

Definition at line 24 of file main.c.

◆ idte

const struct xtf_idte idte
static
Initial value:
= {
.addr = _u(ret_from_vm86),
.cs = __KERN_CS,
.dpl = 3,
}
void ret_from_vm86(void)
#define _u(v)
Express an arbitrary value v as unsigned long.
Definition: numbers.h:53

Definition at line 39 of file main.c.

◆ vm86_tss

env_tss vm86_tss
Initial value:
=
{
.eip = 0x1000,
.cs = 0,
.ss = 0,
.esp0 = _u(&boot_stack[2 * PAGE_SIZE]),
.ss0 = __KERN_DS,
.ldtr = 0,
}
#define X86_EFLAGS_MBS
Definition: processor.h:8
#define _u(v)
Express an arbitrary value v as unsigned long.
Definition: numbers.h:53
#define X86_TSS_INVALID_IO_BITMAP
Definition: x86-tss.h:66
#define X86_EFLAGS_VM
Definition: processor.h:20
uint8_t boot_stack[3 *PAGE_SIZE]
Definition: setup.c:21
#define PAGE_SIZE
Definition: page.h:11
#define X86_EFLAGS_IOPL
Definition: processor.h:17

Definition at line 46 of file main.c.