diff options
author | Jeff Dike <jdike@addtoit.com> | 2007-05-11 01:22:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-11 11:29:33 -0400 |
commit | 57598fd7b31f6437874308a79ca23e51c74da59b (patch) | |
tree | b81df1f04864611d23dbaae11343f3827f6e4aa7 | |
parent | 22258d406f91d7f7ee8e58f18b3722d0647f6a9a (diff) |
uml: remove task_protections
Replaced task_protections with stack_protections since they do the same
thing, and task_protections was misnamed anyway.
This needs THREAD_SIZE, so that's imported via common-offsets.h
Also tidied up the code in the vicinity.
Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | arch/um/include/common-offsets.h | 2 | ||||
-rw-r--r-- | arch/um/include/os.h | 1 | ||||
-rw-r--r-- | arch/um/kernel/tt/exec_kern.c | 2 | ||||
-rw-r--r-- | arch/um/kernel/tt/process_kern.c | 2 | ||||
-rw-r--r-- | arch/um/kernel/um_arch.c | 2 | ||||
-rw-r--r-- | arch/um/os-Linux/util.c | 23 |
6 files changed, 8 insertions, 24 deletions
diff --git a/arch/um/include/common-offsets.h b/arch/um/include/common-offsets.h index 5593a8027083..541f4a8ca512 100644 --- a/arch/um/include/common-offsets.h +++ b/arch/um/include/common-offsets.h | |||
@@ -28,3 +28,5 @@ DEFINE(UM_NR_CPUS, NR_CPUS); | |||
28 | 28 | ||
29 | /* For crypto assembler code. */ | 29 | /* For crypto assembler code. */ |
30 | DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx)); | 30 | DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx)); |
31 | |||
32 | DEFINE(UM_THREAD_SIZE, THREAD_SIZE); | ||
diff --git a/arch/um/include/os.h b/arch/um/include/os.h index 688d181b5f8a..4d9fb26387d5 100644 --- a/arch/um/include/os.h +++ b/arch/um/include/os.h | |||
@@ -272,7 +272,6 @@ extern void do_longjmp(void *p, int val); | |||
272 | 272 | ||
273 | /* util.c */ | 273 | /* util.c */ |
274 | extern void stack_protections(unsigned long address); | 274 | extern void stack_protections(unsigned long address); |
275 | extern void task_protections(unsigned long address); | ||
276 | extern int raw(int fd); | 275 | extern int raw(int fd); |
277 | extern void setup_machinename(char *machine_out); | 276 | extern void setup_machinename(char *machine_out); |
278 | extern void setup_hostinfo(char *buf, int len); | 277 | extern void setup_hostinfo(char *buf, int len); |
diff --git a/arch/um/kernel/tt/exec_kern.c b/arch/um/kernel/tt/exec_kern.c index 98e21743e604..40126cb51801 100644 --- a/arch/um/kernel/tt/exec_kern.c +++ b/arch/um/kernel/tt/exec_kern.c | |||
@@ -57,7 +57,7 @@ void flush_thread_tt(void) | |||
57 | enable_timer(); | 57 | enable_timer(); |
58 | free_page(stack); | 58 | free_page(stack); |
59 | protect_memory(uml_reserved, high_physmem - uml_reserved, 1, 1, 0, 1); | 59 | protect_memory(uml_reserved, high_physmem - uml_reserved, 1, 1, 0, 1); |
60 | task_protections((unsigned long) current_thread); | 60 | stack_protections((unsigned long) current_thread); |
61 | force_flush_all(); | 61 | force_flush_all(); |
62 | unblock_signals(); | 62 | unblock_signals(); |
63 | } | 63 | } |
diff --git a/arch/um/kernel/tt/process_kern.c b/arch/um/kernel/tt/process_kern.c index c631303cb800..74347adf81bf 100644 --- a/arch/um/kernel/tt/process_kern.c +++ b/arch/um/kernel/tt/process_kern.c | |||
@@ -209,7 +209,7 @@ void finish_fork_handler(int sig) | |||
209 | if(current->mm != current->parent->mm) | 209 | if(current->mm != current->parent->mm) |
210 | protect_memory(uml_reserved, high_physmem - uml_reserved, 1, | 210 | protect_memory(uml_reserved, high_physmem - uml_reserved, 1, |
211 | 1, 0, 1); | 211 | 1, 0, 1); |
212 | task_protections((unsigned long) current_thread); | 212 | stack_protections((unsigned long) current_thread); |
213 | 213 | ||
214 | free_page(current->thread.temp_stack); | 214 | free_page(current->thread.temp_stack); |
215 | local_irq_disable(); | 215 | local_irq_disable(); |
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index 1cf954a47fd7..ecc458fe51b9 100644 --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c | |||
@@ -459,7 +459,7 @@ int __init linux_main(int argc, char **argv) | |||
459 | 459 | ||
460 | uml_postsetup(); | 460 | uml_postsetup(); |
461 | 461 | ||
462 | task_protections((unsigned long) &init_thread_info); | 462 | stack_protections((unsigned long) &init_thread_info); |
463 | os_flush_stdout(); | 463 | os_flush_stdout(); |
464 | 464 | ||
465 | return CHOOSE_MODE(start_uml_tt(), start_uml_skas()); | 465 | return CHOOSE_MODE(start_uml_tt(), start_uml_skas()); |
diff --git a/arch/um/os-Linux/util.c b/arch/um/os-Linux/util.c index c307a89ed259..7cbcf484e13d 100644 --- a/arch/um/os-Linux/util.c +++ b/arch/um/os-Linux/util.c | |||
@@ -33,25 +33,8 @@ | |||
33 | 33 | ||
34 | void stack_protections(unsigned long address) | 34 | void stack_protections(unsigned long address) |
35 | { | 35 | { |
36 | int prot = PROT_READ | PROT_WRITE | PROT_EXEC; | 36 | if(mprotect((void *) address, UM_THREAD_SIZE, |
37 | 37 | PROT_READ | PROT_WRITE | PROT_EXEC) < 0) | |
38 | if(mprotect((void *) address, UM_KERN_PAGE_SIZE, prot) < 0) | ||
39 | panic("protecting stack failed, errno = %d", errno); | ||
40 | } | ||
41 | |||
42 | void task_protections(unsigned long address) | ||
43 | { | ||
44 | unsigned long guard = address + UM_KERN_PAGE_SIZE; | ||
45 | unsigned long stack = guard + UM_KERN_PAGE_SIZE; | ||
46 | int prot = 0, pages; | ||
47 | |||
48 | #ifdef notdef | ||
49 | if(mprotect((void *) stack, UM_KERN_PAGE_SIZE, prot) < 0) | ||
50 | panic("protecting guard page failed, errno = %d", errno); | ||
51 | #endif | ||
52 | pages = (1 << UML_CONFIG_KERNEL_STACK_ORDER) - 2; | ||
53 | prot = PROT_READ | PROT_WRITE | PROT_EXEC; | ||
54 | if(mprotect((void *) stack, pages * UM_KERN_PAGE_SIZE, prot) < 0) | ||
55 | panic("protecting stack failed, errno = %d", errno); | 38 | panic("protecting stack failed, errno = %d", errno); |
56 | } | 39 | } |
57 | 40 | ||
@@ -72,7 +55,7 @@ int raw(int fd) | |||
72 | 55 | ||
73 | /* XXX tcsetattr could have applied only some changes | 56 | /* XXX tcsetattr could have applied only some changes |
74 | * (and cfmakeraw() is a set of changes) */ | 57 | * (and cfmakeraw() is a set of changes) */ |
75 | return(0); | 58 | return 0; |
76 | } | 59 | } |
77 | 60 | ||
78 | void setup_machinename(char *machine_out) | 61 | void setup_machinename(char *machine_out) |