44 ASSERT((regs->cs & 3) == 3);
51 printk(
" Entered XTF via syscall\n");
56 regs->cs == 0xe023 && regs->_ss == 0xe02b )
58 xtf_warning(
"Warning: Fixing up Xen's 32bit syscall selector bug\n");
60 regs->_ss = __USER_DS;
68 printk(
" Hit #UD for syscall (not vulnerable)\n");
119 "mov (%k[ss_ptr]), %%ss;"
124 "ljmpl $%c[cs64], $1f; 1:"
127 : [cs32]
"i" (__USER_CS32),
129 [cs64]
"i" (__USER_CS),
132 :
"rbx",
"rcx",
"r11"
134 :
"ebx",
"ecx",
"edx"
154 asm volatile (
"mov %[ss], %%ss; nop; 1:"
160 return xtf_error(
"Error checking breakpoint\n"
161 " Expected %#x %pe, got %#x %pe\n",
162 exp,
_p(exp), fault,
_p(fault));
167 printk(
"Testing native syscall\n");
173 printk(
"Testing compat syscall\n");
179 xtf_success(
"Success: Not vulnerable to XSA-260\n");
bool ex_record_fault_eax(struct cpu_regs *regs, const struct extable_entry *ex)
Record the current fault in %eax.
static unsigned int read_ss(void)
void printk(const char *fmt,...)
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.
static void exec_user_void(void(*fn)(void))
#define IS_DEFINED(x)
Evalute whether the CONFIG_ token x is defined.
#define _p(v)
Express an abitrary integer v as void *.
#define _u(v)
Express an arbitrary value v as unsigned long.
void xtf_error(const char *fmt,...)
Report a test error.
void xtf_warning(const char *fmt,...)
Report a test warning.
void xtf_success(const char *fmt,...)
Report test success.
unsigned long fixup
Fixup address.
static void write_dr0(unsigned long linear)
#define DR7_SYM(bp,...)
Create a partial %dr7 setting for a particular breakpoint based on mnemonics.
static void write_dr7(unsigned long val)
static bool ex_check_UD(struct cpu_regs *regs, const struct extable_entry *ex)
void do_syscall(struct cpu_regs *regs)
May be implemented by a guest to handle SYSCALL invocations.
static unsigned int user_ss
static void user_syscall(void)
static void user_syscall_compat(void)
static void undo_stack(struct cpu_regs *regs)