aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/um/include/asm/mmu.h2
-rw-r--r--arch/um/kernel/skas/mmu.c23
2 files changed, 6 insertions, 19 deletions
diff --git a/arch/um/include/asm/mmu.h b/arch/um/include/asm/mmu.h
index 30509b9f37fd..53e8b498ebba 100644
--- a/arch/um/include/asm/mmu.h
+++ b/arch/um/include/asm/mmu.h
@@ -12,7 +12,7 @@
12typedef struct mm_context { 12typedef struct mm_context {
13 struct mm_id id; 13 struct mm_id id;
14 struct uml_arch_mm_context arch; 14 struct uml_arch_mm_context arch;
15 struct page **stub_pages; 15 struct page *stub_pages[2];
16} mm_context_t; 16} mm_context_t;
17 17
18extern void __switch_mm(struct mm_id * mm_idp); 18extern void __switch_mm(struct mm_id * mm_idp);
diff --git a/arch/um/kernel/skas/mmu.c b/arch/um/kernel/skas/mmu.c
index 1aee587e9c5d..db2ef422c1b8 100644
--- a/arch/um/kernel/skas/mmu.c
+++ b/arch/um/kernel/skas/mmu.c
@@ -92,8 +92,6 @@ int init_new_context(struct task_struct *task, struct mm_struct *mm)
92 goto out_free; 92 goto out_free;
93 } 93 }
94 94
95 to_mm->stub_pages = NULL;
96
97 return 0; 95 return 0;
98 96
99 out_free: 97 out_free:
@@ -120,29 +118,20 @@ void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm)
120 if (ret) 118 if (ret)
121 goto out; 119 goto out;
122 120
123 pages = kmalloc(2 * sizeof(struct page *), GFP_KERNEL); 121 mm->context.stub_pages[0] = virt_to_page(&__syscall_stub_start);
124 if (pages == NULL) { 122 mm->context.stub_pages[1] = virt_to_page(mm->context.id.stack);
125 printk(KERN_ERR "arch_dup_mmap failed to allocate 2 page "
126 "pointers\n");
127 goto out;
128 }
129
130 pages[0] = virt_to_page(&__syscall_stub_start);
131 pages[1] = virt_to_page(mm->context.id.stack);
132 mm->context.stub_pages = pages;
133 123
134 /* dup_mmap already holds mmap_sem */ 124 /* dup_mmap already holds mmap_sem */
135 err = install_special_mapping(mm, STUB_START, STUB_END - STUB_START, 125 err = install_special_mapping(mm, STUB_START, STUB_END - STUB_START,
136 VM_READ | VM_MAYREAD | VM_EXEC | 126 VM_READ | VM_MAYREAD | VM_EXEC |
137 VM_MAYEXEC | VM_DONTCOPY, pages); 127 VM_MAYEXEC | VM_DONTCOPY,
128 mm->context.stub_pages);
138 if (err) { 129 if (err) {
139 printk(KERN_ERR "install_special_mapping returned %d\n", err); 130 printk(KERN_ERR "install_special_mapping returned %d\n", err);
140 goto out_free; 131 goto out;
141 } 132 }
142 return; 133 return;
143 134
144out_free:
145 kfree(pages);
146out: 135out:
147 force_sigsegv(SIGSEGV, current); 136 force_sigsegv(SIGSEGV, current);
148} 137}
@@ -151,8 +140,6 @@ void arch_exit_mmap(struct mm_struct *mm)
151{ 140{
152 pte_t *pte; 141 pte_t *pte;
153 142
154 if (mm->context.stub_pages != NULL)
155 kfree(mm->context.stub_pages);
156 pte = virt_to_pte(mm, STUB_CODE); 143 pte = virt_to_pte(mm, STUB_CODE);
157 if (pte != NULL) 144 if (pte != NULL)
158 pte_clear(mm, STUB_CODE, pte); 145 pte_clear(mm, STUB_CODE, pte);