Commit 5c8aacea authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds

uml: stop specially protecting kernel stacks

Map all of physical memory as executable to avoid having to change stack
protections during fork and exit.

unprotect_stack is now called only from MODE_TT code, so it is marked as such.
Signed-off-by: default avatarJeff Dike <jdike@linux.intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 8d820760
...@@ -82,7 +82,9 @@ extern void check_stack_overflow(void *ptr); ...@@ -82,7 +82,9 @@ extern void check_stack_overflow(void *ptr);
extern void relay_signal(int sig, union uml_pt_regs *regs); extern void relay_signal(int sig, union uml_pt_regs *regs);
extern int user_context(unsigned long sp); extern int user_context(unsigned long sp);
extern void timer_irq(union uml_pt_regs *regs); extern void timer_irq(union uml_pt_regs *regs);
#ifdef CONFIG_MODE_TT
extern void unprotect_stack(unsigned long stack); extern void unprotect_stack(unsigned long stack);
#endif
extern void do_uml_exitcalls(void); extern void do_uml_exitcalls(void);
extern int attach_debugger(int idle_pid, int pid, int stop); extern int attach_debugger(int idle_pid, int pid, int stop);
extern int config_gdb(char *str); extern int config_gdb(char *str);
......
...@@ -47,7 +47,9 @@ union thread_union cpu0_irqstack ...@@ -47,7 +47,9 @@ union thread_union cpu0_irqstack
__attribute__((__section__(".data.init_irqstack"))) = __attribute__((__section__(".data.init_irqstack"))) =
{ INIT_THREAD_INFO(init_task) }; { INIT_THREAD_INFO(init_task) };
#ifdef CONFIG_MODE_TT
void unprotect_stack(unsigned long stack) void unprotect_stack(unsigned long stack)
{ {
os_protect_memory((void *) stack, THREAD_SIZE, 1, 1, 0); os_protect_memory((void *) stack, THREAD_SIZE, 1, 1, 0);
} }
#endif
...@@ -105,7 +105,7 @@ void __init setup_physmem(unsigned long start, unsigned long reserve_end, ...@@ -105,7 +105,7 @@ void __init setup_physmem(unsigned long start, unsigned long reserve_end,
offset = uml_reserved - uml_physmem; offset = uml_reserved - uml_physmem;
err = os_map_memory((void *) uml_reserved, physmem_fd, offset, err = os_map_memory((void *) uml_reserved, physmem_fd, offset,
len - offset, 1, 1, 0); len - offset, 1, 1, 1);
if(err < 0){ if(err < 0){
os_print_error(err, "Mapping memory"); os_print_error(err, "Mapping memory");
exit(1); exit(1);
......
...@@ -82,9 +82,9 @@ unsigned long alloc_stack(int order, int atomic) ...@@ -82,9 +82,9 @@ unsigned long alloc_stack(int order, int atomic)
if (atomic) if (atomic)
flags = GFP_ATOMIC; flags = GFP_ATOMIC;
page = __get_free_pages(flags, order); page = __get_free_pages(flags, order);
if(page == 0) if (page == 0)
return 0; return 0;
stack_protections(page);
return page; return page;
} }
...@@ -141,7 +141,6 @@ void release_thread(struct task_struct *task) ...@@ -141,7 +141,6 @@ void release_thread(struct task_struct *task)
void exit_thread(void) void exit_thread(void)
{ {
unprotect_stack((unsigned long) current_thread);
} }
void *get_current(void) void *get_current(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment