diff options
author | Jeff Dike <jdike@addtoit.com> | 2007-10-16 04:26:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:43:04 -0400 |
commit | 5c8aaceab88ac787c0a4038b29143c954c2a45e0 (patch) | |
tree | 9277518e77cac9e1f97d826fa8962d1c861a9e40 | |
parent | 8d82076080d909f18dea859a6767df7e3ff69241 (diff) |
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: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | arch/um/include/kern_util.h | 2 | ||||
-rw-r--r-- | arch/um/kernel/init_task.c | 2 | ||||
-rw-r--r-- | arch/um/kernel/physmem.c | 2 | ||||
-rw-r--r-- | arch/um/kernel/process.c | 5 |
4 files changed, 7 insertions, 4 deletions
diff --git a/arch/um/include/kern_util.h b/arch/um/include/kern_util.h index 6c2be26f1d7d..b84b5dadb958 100644 --- a/arch/um/include/kern_util.h +++ b/arch/um/include/kern_util.h | |||
@@ -82,7 +82,9 @@ extern void check_stack_overflow(void *ptr); | |||
82 | extern void relay_signal(int sig, union uml_pt_regs *regs); | 82 | extern void relay_signal(int sig, union uml_pt_regs *regs); |
83 | extern int user_context(unsigned long sp); | 83 | extern int user_context(unsigned long sp); |
84 | extern void timer_irq(union uml_pt_regs *regs); | 84 | extern void timer_irq(union uml_pt_regs *regs); |
85 | #ifdef CONFIG_MODE_TT | ||
85 | extern void unprotect_stack(unsigned long stack); | 86 | extern void unprotect_stack(unsigned long stack); |
87 | #endif | ||
86 | extern void do_uml_exitcalls(void); | 88 | extern void do_uml_exitcalls(void); |
87 | extern int attach_debugger(int idle_pid, int pid, int stop); | 89 | extern int attach_debugger(int idle_pid, int pid, int stop); |
88 | extern int config_gdb(char *str); | 90 | extern int config_gdb(char *str); |
diff --git a/arch/um/kernel/init_task.c b/arch/um/kernel/init_task.c index cba516e6c99a..fa90db964b28 100644 --- a/arch/um/kernel/init_task.c +++ b/arch/um/kernel/init_task.c | |||
@@ -47,7 +47,9 @@ union thread_union cpu0_irqstack | |||
47 | __attribute__((__section__(".data.init_irqstack"))) = | 47 | __attribute__((__section__(".data.init_irqstack"))) = |
48 | { INIT_THREAD_INFO(init_task) }; | 48 | { INIT_THREAD_INFO(init_task) }; |
49 | 49 | ||
50 | #ifdef CONFIG_MODE_TT | ||
50 | void unprotect_stack(unsigned long stack) | 51 | void unprotect_stack(unsigned long stack) |
51 | { | 52 | { |
52 | os_protect_memory((void *) stack, THREAD_SIZE, 1, 1, 0); | 53 | os_protect_memory((void *) stack, THREAD_SIZE, 1, 1, 0); |
53 | } | 54 | } |
55 | #endif | ||
diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c index 5ee7e851bbc1..8aeac4d93511 100644 --- a/arch/um/kernel/physmem.c +++ b/arch/um/kernel/physmem.c | |||
@@ -105,7 +105,7 @@ void __init setup_physmem(unsigned long start, unsigned long reserve_end, | |||
105 | 105 | ||
106 | offset = uml_reserved - uml_physmem; | 106 | offset = uml_reserved - uml_physmem; |
107 | err = os_map_memory((void *) uml_reserved, physmem_fd, offset, | 107 | err = os_map_memory((void *) uml_reserved, physmem_fd, offset, |
108 | len - offset, 1, 1, 0); | 108 | len - offset, 1, 1, 1); |
109 | if(err < 0){ | 109 | if(err < 0){ |
110 | os_print_error(err, "Mapping memory"); | 110 | os_print_error(err, "Mapping memory"); |
111 | exit(1); | 111 | exit(1); |
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c index bfa52f206bb6..f083787410af 100644 --- a/arch/um/kernel/process.c +++ b/arch/um/kernel/process.c | |||
@@ -82,9 +82,9 @@ unsigned long alloc_stack(int order, int atomic) | |||
82 | if (atomic) | 82 | if (atomic) |
83 | flags = GFP_ATOMIC; | 83 | flags = GFP_ATOMIC; |
84 | page = __get_free_pages(flags, order); | 84 | page = __get_free_pages(flags, order); |
85 | if(page == 0) | 85 | if (page == 0) |
86 | return 0; | 86 | return 0; |
87 | stack_protections(page); | 87 | |
88 | return page; | 88 | return page; |
89 | } | 89 | } |
90 | 90 | ||
@@ -141,7 +141,6 @@ void release_thread(struct task_struct *task) | |||
141 | 141 | ||
142 | void exit_thread(void) | 142 | void exit_thread(void) |
143 | { | 143 | { |
144 | unprotect_stack((unsigned long) current_thread); | ||
145 | } | 144 | } |
146 | 145 | ||
147 | void *get_current(void) | 146 | void *get_current(void) |