diff options
author | Jeff Dike <jdike@addtoit.com> | 2007-10-16 04:27:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:43:05 -0400 |
commit | ba180fd437156f7fd8cfb2fdd021d949eeef08d6 (patch) | |
tree | b9f38b9cdd7a5b1aacf00341d1948314663c5871 /arch/um/kernel/skas | |
parent | 77bf4400319db9d2a8af6b00c2be6faa0f3d07cb (diff) |
uml: style fixes pass 3
Formatting changes in the files which have been changed in the course
of folding foo_skas functions into their callers. These include:
copyright updates
header file trimming
style fixes
adding severity to printks
These changes should be entirely non-functional.
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>
Diffstat (limited to 'arch/um/kernel/skas')
-rw-r--r-- | arch/um/kernel/skas/Makefile | 2 | ||||
-rw-r--r-- | arch/um/kernel/skas/mmu.c | 64 | ||||
-rw-r--r-- | arch/um/kernel/skas/process.c | 27 | ||||
-rw-r--r-- | arch/um/kernel/skas/syscall.c | 17 |
4 files changed, 44 insertions, 66 deletions
diff --git a/arch/um/kernel/skas/Makefile b/arch/um/kernel/skas/Makefile index b2823cdd783e..0b76d8869c94 100644 --- a/arch/um/kernel/skas/Makefile +++ b/arch/um/kernel/skas/Makefile | |||
@@ -1,5 +1,5 @@ | |||
1 | # | 1 | # |
2 | # Copyright (C) 2002 - 2004 Jeff Dike (jdike@addtoit.com) | 2 | # Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | # Licensed under the GPL | 3 | # Licensed under the GPL |
4 | # | 4 | # |
5 | 5 | ||
diff --git a/arch/um/kernel/skas/mmu.c b/arch/um/kernel/skas/mmu.c index 902d74138952..c5475ecd9fd4 100644 --- a/arch/um/kernel/skas/mmu.c +++ b/arch/um/kernel/skas/mmu.c | |||
@@ -1,20 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | 2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include "linux/sched.h" | ||
7 | #include "linux/list.h" | ||
8 | #include "linux/spinlock.h" | ||
9 | #include "linux/slab.h" | ||
10 | #include "linux/errno.h" | ||
11 | #include "linux/mm.h" | 6 | #include "linux/mm.h" |
12 | #include "asm/current.h" | 7 | #include "linux/sched.h" |
13 | #include "asm/segment.h" | ||
14 | #include "asm/mmu.h" | ||
15 | #include "asm/pgalloc.h" | 8 | #include "asm/pgalloc.h" |
16 | #include "asm/pgtable.h" | 9 | #include "asm/pgtable.h" |
17 | #include "asm/ldt.h" | ||
18 | #include "os.h" | 10 | #include "os.h" |
19 | #include "skas.h" | 11 | #include "skas.h" |
20 | 12 | ||
@@ -41,10 +33,11 @@ static int init_stub_pte(struct mm_struct *mm, unsigned long proc, | |||
41 | if (!pte) | 33 | if (!pte) |
42 | goto out_pte; | 34 | goto out_pte; |
43 | 35 | ||
44 | /* There's an interaction between the skas0 stub pages, stack | 36 | /* |
37 | * There's an interaction between the skas0 stub pages, stack | ||
45 | * randomization, and the BUG at the end of exit_mmap. exit_mmap | 38 | * randomization, and the BUG at the end of exit_mmap. exit_mmap |
46 | * checks that the number of page tables freed is the same as had | 39 | * checks that the number of page tables freed is the same as had |
47 | * been allocated. If the stack is on the last page table page, | 40 | * been allocated. If the stack is on the last page table page, |
48 | * then the stack pte page will be freed, and if not, it won't. To | 41 | * then the stack pte page will be freed, and if not, it won't. To |
49 | * avoid having to know where the stack is, or if the process mapped | 42 | * avoid having to know where the stack is, or if the process mapped |
50 | * something at the top of its address space for some other reason, | 43 | * something at the top of its address space for some other reason, |
@@ -54,36 +47,37 @@ static int init_stub_pte(struct mm_struct *mm, unsigned long proc, | |||
54 | * destroy_context_skas. | 47 | * destroy_context_skas. |
55 | */ | 48 | */ |
56 | 49 | ||
57 | mm->context.skas.last_page_table = pmd_page_vaddr(*pmd); | 50 | mm->context.skas.last_page_table = pmd_page_vaddr(*pmd); |
58 | #ifdef CONFIG_3_LEVEL_PGTABLES | 51 | #ifdef CONFIG_3_LEVEL_PGTABLES |
59 | mm->context.skas.last_pmd = (unsigned long) __va(pud_val(*pud)); | 52 | mm->context.skas.last_pmd = (unsigned long) __va(pud_val(*pud)); |
60 | #endif | 53 | #endif |
61 | 54 | ||
62 | *pte = mk_pte(virt_to_page(kernel), __pgprot(_PAGE_PRESENT)); | 55 | *pte = mk_pte(virt_to_page(kernel), __pgprot(_PAGE_PRESENT)); |
63 | *pte = pte_mkread(*pte); | 56 | *pte = pte_mkread(*pte); |
64 | return(0); | 57 | return 0; |
65 | 58 | ||
66 | out_pmd: | 59 | out_pmd: |
67 | pud_free(pud); | 60 | pud_free(pud); |
68 | out_pte: | 61 | out_pte: |
69 | pmd_free(pmd); | 62 | pmd_free(pmd); |
70 | out: | 63 | out: |
71 | return(-ENOMEM); | 64 | return -ENOMEM; |
72 | } | 65 | } |
73 | 66 | ||
74 | int init_new_context(struct task_struct *task, struct mm_struct *mm) | 67 | int init_new_context(struct task_struct *task, struct mm_struct *mm) |
75 | { | 68 | { |
76 | struct mmu_context_skas *from_mm = NULL; | 69 | struct mmu_context_skas *from_mm = NULL; |
77 | struct mmu_context_skas *to_mm = &mm->context.skas; | 70 | struct mmu_context_skas *to_mm = &mm->context.skas; |
78 | unsigned long stack = 0; | 71 | unsigned long stack = 0; |
79 | int ret = -ENOMEM; | 72 | int ret = -ENOMEM; |
80 | 73 | ||
81 | if(skas_needs_stub){ | 74 | if (skas_needs_stub) { |
82 | stack = get_zeroed_page(GFP_KERNEL); | 75 | stack = get_zeroed_page(GFP_KERNEL); |
83 | if(stack == 0) | 76 | if (stack == 0) |
84 | goto out; | 77 | goto out; |
85 | 78 | ||
86 | /* This zeros the entry that pgd_alloc didn't, needed since | 79 | /* |
80 | * This zeros the entry that pgd_alloc didn't, needed since | ||
87 | * we are about to reinitialize it, and want mm.nr_ptes to | 81 | * we are about to reinitialize it, and want mm.nr_ptes to |
88 | * be accurate. | 82 | * be accurate. |
89 | */ | 83 | */ |
@@ -91,39 +85,39 @@ int init_new_context(struct task_struct *task, struct mm_struct *mm) | |||
91 | 85 | ||
92 | ret = init_stub_pte(mm, CONFIG_STUB_CODE, | 86 | ret = init_stub_pte(mm, CONFIG_STUB_CODE, |
93 | (unsigned long) &__syscall_stub_start); | 87 | (unsigned long) &__syscall_stub_start); |
94 | if(ret) | 88 | if (ret) |
95 | goto out_free; | 89 | goto out_free; |
96 | 90 | ||
97 | ret = init_stub_pte(mm, CONFIG_STUB_DATA, stack); | 91 | ret = init_stub_pte(mm, CONFIG_STUB_DATA, stack); |
98 | if(ret) | 92 | if (ret) |
99 | goto out_free; | 93 | goto out_free; |
100 | 94 | ||
101 | mm->nr_ptes--; | 95 | mm->nr_ptes--; |
102 | } | 96 | } |
103 | 97 | ||
104 | to_mm->id.stack = stack; | 98 | to_mm->id.stack = stack; |
105 | if(current->mm != NULL && current->mm != &init_mm) | 99 | if (current->mm != NULL && current->mm != &init_mm) |
106 | from_mm = ¤t->mm->context.skas; | 100 | from_mm = ¤t->mm->context.skas; |
107 | 101 | ||
108 | if(proc_mm){ | 102 | if (proc_mm) { |
109 | ret = new_mm(stack); | 103 | ret = new_mm(stack); |
110 | if(ret < 0){ | 104 | if (ret < 0) { |
111 | printk("init_new_context_skas - new_mm failed, " | 105 | printk(KERN_ERR "init_new_context_skas - " |
112 | "errno = %d\n", ret); | 106 | "new_mm failed, errno = %d\n", ret); |
113 | goto out_free; | 107 | goto out_free; |
114 | } | 108 | } |
115 | to_mm->id.u.mm_fd = ret; | 109 | to_mm->id.u.mm_fd = ret; |
116 | } | 110 | } |
117 | else { | 111 | else { |
118 | if(from_mm) | 112 | if (from_mm) |
119 | to_mm->id.u.pid = copy_context_skas0(stack, | 113 | to_mm->id.u.pid = copy_context_skas0(stack, |
120 | from_mm->id.u.pid); | 114 | from_mm->id.u.pid); |
121 | else to_mm->id.u.pid = start_userspace(stack); | 115 | else to_mm->id.u.pid = start_userspace(stack); |
122 | } | 116 | } |
123 | 117 | ||
124 | ret = init_new_ldt(to_mm, from_mm); | 118 | ret = init_new_ldt(to_mm, from_mm); |
125 | if(ret < 0){ | 119 | if (ret < 0) { |
126 | printk("init_new_context_skas - init_ldt" | 120 | printk(KERN_ERR "init_new_context_skas - init_ldt" |
127 | " failed, errno = %d\n", ret); | 121 | " failed, errno = %d\n", ret); |
128 | goto out_free; | 122 | goto out_free; |
129 | } | 123 | } |
@@ -131,7 +125,7 @@ int init_new_context(struct task_struct *task, struct mm_struct *mm) | |||
131 | return 0; | 125 | return 0; |
132 | 126 | ||
133 | out_free: | 127 | out_free: |
134 | if(to_mm->id.stack != 0) | 128 | if (to_mm->id.stack != 0) |
135 | free_page(to_mm->id.stack); | 129 | free_page(to_mm->id.stack); |
136 | out: | 130 | out: |
137 | return ret; | 131 | return ret; |
@@ -141,12 +135,12 @@ void destroy_context(struct mm_struct *mm) | |||
141 | { | 135 | { |
142 | struct mmu_context_skas *mmu = &mm->context.skas; | 136 | struct mmu_context_skas *mmu = &mm->context.skas; |
143 | 137 | ||
144 | if(proc_mm) | 138 | if (proc_mm) |
145 | os_close_file(mmu->id.u.mm_fd); | 139 | os_close_file(mmu->id.u.mm_fd); |
146 | else | 140 | else |
147 | os_kill_ptraced_process(mmu->id.u.pid, 1); | 141 | os_kill_ptraced_process(mmu->id.u.pid, 1); |
148 | 142 | ||
149 | if(!proc_mm || !ptrace_faultinfo){ | 143 | if (!proc_mm || !ptrace_faultinfo) { |
150 | free_page(mmu->id.stack); | 144 | free_page(mmu->id.stack); |
151 | pte_lock_deinit(virt_to_page(mmu->last_page_table)); | 145 | pte_lock_deinit(virt_to_page(mmu->last_page_table)); |
152 | pte_free_kernel((pte_t *) mmu->last_page_table); | 146 | pte_free_kernel((pte_t *) mmu->last_page_table); |
diff --git a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c index dabae62d52be..9ce1c49421f8 100644 --- a/arch/um/kernel/skas/process.c +++ b/arch/um/kernel/skas/process.c | |||
@@ -1,36 +1,23 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | 2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include "linux/sched.h" | ||
7 | #include "linux/slab.h" | ||
8 | #include "linux/ptrace.h" | ||
9 | #include "linux/proc_fs.h" | ||
10 | #include "linux/file.h" | ||
11 | #include "linux/errno.h" | ||
12 | #include "linux/init.h" | 6 | #include "linux/init.h" |
13 | #include "asm/uaccess.h" | 7 | #include "linux/sched.h" |
14 | #include "asm/atomic.h" | ||
15 | #include "kern_util.h" | ||
16 | #include "as-layout.h" | 8 | #include "as-layout.h" |
17 | #include "skas.h" | ||
18 | #include "os.h" | 9 | #include "os.h" |
19 | #include "tlb.h" | 10 | #include "skas.h" |
20 | #include "kern.h" | ||
21 | #include "registers.h" | ||
22 | |||
23 | extern void schedule_tail(struct task_struct *prev); | ||
24 | 11 | ||
25 | int new_mm(unsigned long stack) | 12 | int new_mm(unsigned long stack) |
26 | { | 13 | { |
27 | int fd; | 14 | int fd; |
28 | 15 | ||
29 | fd = os_open_file("/proc/mm", of_cloexec(of_write(OPENFLAGS())), 0); | 16 | fd = os_open_file("/proc/mm", of_cloexec(of_write(OPENFLAGS())), 0); |
30 | if(fd < 0) | 17 | if (fd < 0) |
31 | return fd; | 18 | return fd; |
32 | 19 | ||
33 | if(skas_needs_stub) | 20 | if (skas_needs_stub) |
34 | map_stub_pages(fd, CONFIG_STUB_CODE, CONFIG_STUB_DATA, stack); | 21 | map_stub_pages(fd, CONFIG_STUB_CODE, CONFIG_STUB_DATA, stack); |
35 | 22 | ||
36 | return fd; | 23 | return fd; |
@@ -62,7 +49,7 @@ int __init start_uml(void) | |||
62 | { | 49 | { |
63 | stack_protections((unsigned long) &cpu0_irqstack); | 50 | stack_protections((unsigned long) &cpu0_irqstack); |
64 | set_sigstack(cpu0_irqstack, THREAD_SIZE); | 51 | set_sigstack(cpu0_irqstack, THREAD_SIZE); |
65 | if(proc_mm) | 52 | if (proc_mm) |
66 | userspace_pid[0] = start_userspace(0); | 53 | userspace_pid[0] = start_userspace(0); |
67 | 54 | ||
68 | init_new_thread_signals(); | 55 | init_new_thread_signals(); |
@@ -75,7 +62,7 @@ int __init start_uml(void) | |||
75 | 62 | ||
76 | unsigned long current_stub_stack(void) | 63 | unsigned long current_stub_stack(void) |
77 | { | 64 | { |
78 | if(current->mm == NULL) | 65 | if (current->mm == NULL) |
79 | return 0; | 66 | return 0; |
80 | 67 | ||
81 | return current->mm->context.skas.id.stack; | 68 | return current->mm->context.skas.id.stack; |
diff --git a/arch/um/kernel/skas/syscall.c b/arch/um/kernel/skas/syscall.c index e183da633c89..8582c1331048 100644 --- a/arch/um/kernel/skas/syscall.c +++ b/arch/um/kernel/skas/syscall.c | |||
@@ -1,17 +1,13 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | 2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include "linux/sys.h" | 6 | #include "linux/kernel.h" |
7 | #include "linux/ptrace.h" | 7 | #include "linux/ptrace.h" |
8 | #include "asm/errno.h" | ||
9 | #include "asm/unistd.h" | ||
10 | #include "asm/ptrace.h" | ||
11 | #include "asm/current.h" | ||
12 | #include "sysdep/syscalls.h" | ||
13 | #include "kern_util.h" | 8 | #include "kern_util.h" |
14 | #include "syscall.h" | 9 | #include "sysdep/ptrace.h" |
10 | #include "sysdep/syscalls.h" | ||
15 | 11 | ||
16 | void handle_syscall(struct uml_pt_regs *r) | 12 | void handle_syscall(struct uml_pt_regs *r) |
17 | { | 13 | { |
@@ -24,7 +20,8 @@ void handle_syscall(struct uml_pt_regs *r) | |||
24 | current->thread.nsyscalls++; | 20 | current->thread.nsyscalls++; |
25 | nsyscalls++; | 21 | nsyscalls++; |
26 | 22 | ||
27 | /* This should go in the declaration of syscall, but when I do that, | 23 | /* |
24 | * This should go in the declaration of syscall, but when I do that, | ||
28 | * strace -f -c bash -c 'ls ; ls' breaks, sometimes not tracing | 25 | * strace -f -c bash -c 'ls ; ls' breaks, sometimes not tracing |
29 | * children at all, sometimes hanging when bash doesn't see the first | 26 | * children at all, sometimes hanging when bash doesn't see the first |
30 | * ls exit. | 27 | * ls exit. |
@@ -33,7 +30,7 @@ void handle_syscall(struct uml_pt_regs *r) | |||
33 | * in case it's a compiler bug. | 30 | * in case it's a compiler bug. |
34 | */ | 31 | */ |
35 | syscall = UPT_SYSCALL_NR(r); | 32 | syscall = UPT_SYSCALL_NR(r); |
36 | if((syscall >= NR_syscalls) || (syscall < 0)) | 33 | if ((syscall >= NR_syscalls) || (syscall < 0)) |
37 | result = -ENOSYS; | 34 | result = -ENOSYS; |
38 | else result = EXECUTE_SYSCALL(syscall, regs); | 35 | else result = EXECUTE_SYSCALL(syscall, regs); |
39 | 36 | ||