x86: synchronize usage of CONFIG_X86_STACK_PROTECTION
Most places use CONFIG_X86_STACK_PROTECTION, but there are some places using CONFIG_HW_STACK_PROTECTION. So synchronize all to use CONFIG_X86_STACK_PROTECTION instead. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
3d39864900
commit
ac5835565b
6 changed files with 8 additions and 8 deletions
|
@ -134,7 +134,7 @@ FUNC_NORETURN void arch_user_mode_enter(k_thread_entry_t user_entry,
|
||||||
stack_start = POINTER_TO_UINT(_current->stack_obj);
|
stack_start = POINTER_TO_UINT(_current->stack_obj);
|
||||||
stack_size = K_THREAD_STACK_LEN(_current->stack_info.size);
|
stack_size = K_THREAD_STACK_LEN(_current->stack_info.size);
|
||||||
|
|
||||||
#if defined(CONFIG_HW_STACK_PROTECTION)
|
#if defined(CONFIG_X86_STACK_PROTECTION)
|
||||||
/* With hardware stack protection, the first page of stack
|
/* With hardware stack protection, the first page of stack
|
||||||
* is a guard page. So need to skip it.
|
* is a guard page. So need to skip it.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -185,7 +185,7 @@ def main():
|
||||||
# fault exception handling
|
# fault exception handling
|
||||||
if "CONFIG_USERSPACE" in syms:
|
if "CONFIG_USERSPACE" in syms:
|
||||||
num_entries = 7
|
num_entries = 7
|
||||||
elif "CONFIG_HW_STACK_PROTECTION" in syms:
|
elif "CONFIG_X86_STACK_PROTECTION" in syms:
|
||||||
num_entries = 5
|
num_entries = 5
|
||||||
else:
|
else:
|
||||||
num_entries = 3
|
num_entries = 3
|
||||||
|
|
|
@ -120,7 +120,7 @@ void z_x86_pentry_get(int *paging_level, pentry_t *val, pentry_t *ptables,
|
||||||
void z_x86_dump_page_tables(pentry_t *ptables);
|
void z_x86_dump_page_tables(pentry_t *ptables);
|
||||||
#endif /* CONFIG_EXCEPTION_DEBUG */
|
#endif /* CONFIG_EXCEPTION_DEBUG */
|
||||||
|
|
||||||
#ifdef CONFIG_HW_STACK_PROTECTION
|
#ifdef CONFIG_X86_STACK_PROTECTION
|
||||||
/* Legacy function - set identity-mapped MMU stack guard page to RO in the
|
/* Legacy function - set identity-mapped MMU stack guard page to RO in the
|
||||||
* kernel's page tables to prevent writes and generate an exception
|
* kernel's page tables to prevent writes and generate an exception
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
*/
|
*/
|
||||||
#if defined(CONFIG_USERSPACE)
|
#if defined(CONFIG_USERSPACE)
|
||||||
#define GS_TLS_SEG (0x38 | 0x03)
|
#define GS_TLS_SEG (0x38 | 0x03)
|
||||||
#elif defined(CONFIG_HW_STACK_PROTECTION)
|
#elif defined(CONFIG_X86_STACK_PROTECTION)
|
||||||
#define GS_TLS_SEG (0x28 | 0x03)
|
#define GS_TLS_SEG (0x28 | 0x03)
|
||||||
#else
|
#else
|
||||||
#define GS_TLS_SEG (0x18 | 0x03)
|
#define GS_TLS_SEG (0x18 | 0x03)
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
|
|
||||||
#ifdef CONFIG_USERSPACE
|
#ifdef CONFIG_USERSPACE
|
||||||
#define GDT_NUM_ENTRIES 7
|
#define GDT_NUM_ENTRIES 7
|
||||||
#elif defined(CONFIG_HW_STACK_PROTECTION)
|
#elif defined(CONFIG_X86_STACK_PROTECTION)
|
||||||
#define GDT_NUM_ENTRIES 5
|
#define GDT_NUM_ENTRIES 5
|
||||||
#else
|
#else
|
||||||
#define GDT_NUM_ENTRIES 3
|
#define GDT_NUM_ENTRIES 3
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#define ARCH_STACK_PTR_ALIGN 4UL
|
#define ARCH_STACK_PTR_ALIGN 4UL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_HW_STACK_PROTECTION) || defined(CONFIG_USERSPACE)
|
#if defined(CONFIG_X86_STACK_PROTECTION) || defined(CONFIG_USERSPACE)
|
||||||
#define Z_X86_STACK_BASE_ALIGN CONFIG_MMU_PAGE_SIZE
|
#define Z_X86_STACK_BASE_ALIGN CONFIG_MMU_PAGE_SIZE
|
||||||
#else
|
#else
|
||||||
#define Z_X86_STACK_BASE_ALIGN ARCH_STACK_PTR_ALIGN
|
#define Z_X86_STACK_BASE_ALIGN ARCH_STACK_PTR_ALIGN
|
||||||
|
@ -62,7 +62,7 @@
|
||||||
* privileged mode stack.
|
* privileged mode stack.
|
||||||
*/
|
*/
|
||||||
struct z_x86_thread_stack_header {
|
struct z_x86_thread_stack_header {
|
||||||
#ifdef CONFIG_HW_STACK_PROTECTION
|
#ifdef CONFIG_X86_STACK_PROTECTION
|
||||||
char guard_page[CONFIG_MMU_PAGE_SIZE];
|
char guard_page[CONFIG_MMU_PAGE_SIZE];
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_USERSPACE
|
#ifdef CONFIG_USERSPACE
|
||||||
|
@ -78,7 +78,7 @@ struct z_x86_thread_stack_header {
|
||||||
#define ARCH_THREAD_STACK_RESERVED \
|
#define ARCH_THREAD_STACK_RESERVED \
|
||||||
sizeof(struct z_x86_thread_stack_header)
|
sizeof(struct z_x86_thread_stack_header)
|
||||||
|
|
||||||
#ifdef CONFIG_HW_STACK_PROTECTION
|
#ifdef CONFIG_X86_STACK_PROTECTION
|
||||||
#define ARCH_KERNEL_STACK_RESERVED CONFIG_MMU_PAGE_SIZE
|
#define ARCH_KERNEL_STACK_RESERVED CONFIG_MMU_PAGE_SIZE
|
||||||
#define ARCH_KERNEL_STACK_OBJ_ALIGN CONFIG_MMU_PAGE_SIZE
|
#define ARCH_KERNEL_STACK_OBJ_ALIGN CONFIG_MMU_PAGE_SIZE
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue