x86: set stack guard page non-writable
This will trigger a page fault if the guard area is written to. Since the exception itself will try to write to the memory, a double fault will be triggered and we will do an IA task switch to the df_tss and panic. Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
0fab8a6dc5
commit
054d47b29c
1 changed files with 5 additions and 0 deletions
|
@ -20,6 +20,7 @@
|
|||
#include <linker/sections.h>
|
||||
#include <kernel_structs.h>
|
||||
#include <wait_q.h>
|
||||
#include <mmustructs.h>
|
||||
|
||||
/* forward declaration */
|
||||
|
||||
|
@ -204,6 +205,10 @@ void _new_thread(struct k_thread *thread, char *pStackMem, size_t stackSize,
|
|||
|
||||
unsigned long *pInitialThread;
|
||||
|
||||
#if CONFIG_X86_STACK_PROTECTION
|
||||
_x86_mmu_set_flags(pStackMem, MMU_PAGE_SIZE, MMU_ENTRY_NOT_PRESENT,
|
||||
MMU_PTE_P_MASK);
|
||||
#endif
|
||||
#if _STACK_GUARD_SIZE
|
||||
pStackMem += _STACK_GUARD_SIZE;
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue