@@ -7,6 +7,7 @@
struct vdso_exception_table_entry {
int insn, fixup;
+ unsigned int mask, flags;
};
bool fixup_vdso_exception(struct pt_regs *regs, int trapnr,
@@ -17,14 +18,6 @@ bool fixup_vdso_exception(struct pt_regs *regs, int trapnr,
unsigned int nr_entries, i;
unsigned long base;
- /*
- * Do not attempt to fixup #DB or #BP. It's impossible to identify
- * whether or not a #DB/#BP originated from within an SGX enclave and
- * SGX enclaves are currently the only use case for vDSO fixup.
- */
- if (trapnr == X86_TRAP_DB || trapnr == X86_TRAP_BP)
- return false;
-
if (!current->mm->context.vdso)
return false;
@@ -2,26 +2,31 @@
#ifndef __VDSO_EXTABLE_H
#define __VDSO_EXTABLE_H
+#include <asm/trapnr.h>
+
+#define ASM_VDSO_ASYNC_FLAGS (1 << 0)
+
/*
* Inject exception fixup for vDSO code. Unlike normal exception fixup,
* vDSO uses a dedicated handler the addresses are relative to the overall
* exception table, not each individual entry.
*/
#ifdef __ASSEMBLY__
-#define _ASM_VDSO_EXTABLE_HANDLE(from, to) \
- ASM_VDSO_EXTABLE_HANDLE from to
-
-.macro ASM_VDSO_EXTABLE_HANDLE from:req to:req
+.macro ASM_VDSO_EXTABLE_HANDLE from:req to:req mask:req flags:req
.pushsection __ex_table, "a"
.long (\from) - __ex_table
.long (\to) - __ex_table
+ .long (\mask)
+ .long (\flags)
.popsection
.endm
#else
-#define _ASM_VDSO_EXTABLE_HANDLE(from, to) \
- ".pushsection __ex_table, \"a\"\n" \
- ".long (" #from ") - __ex_table\n" \
- ".long (" #to ") - __ex_table\n" \
+#define ASM_VDSO_EXTABLE_HANDLE(from, to, mask, flags) \
+ ".pushsection __ex_table, \"a\"\n" \
+ ".long (" #from ") - __ex_table\n" \
+ ".long (" #to ") - __ex_table\n" \
+ ".long (" #mask ")\n" \
+ ".long (" #flags ")\n" \
".popsection\n"
#endif
@@ -4,6 +4,7 @@
#include <asm/export.h>
#include <asm/errno.h>
#include <asm/enclu.h>
+#include <asm/trapnr.h>
#include "extable.h"
@@ -146,6 +147,10 @@ SYM_FUNC_START(__vdso_sgx_enter_enclave)
.cfi_endproc
-_ASM_VDSO_EXTABLE_HANDLE(.Lenclu_eenter_eresume, .Lhandle_exception)
-
+/*
+ * Do not attempt to fixup #DB or #BP. It's impossible to identify
+ * whether or not a #DB/#BP originated from within an SGX enclave.
+ */
+ASM_VDSO_EXTABLE_HANDLE .Lenclu_eenter_eresume, .Lhandle_exception, \
+ ~((1<<X86_TRAP_DB)+(1<<X86_TRAP_BP)), 0
SYM_FUNC_END(__vdso_sgx_enter_enclave)