aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-21 16:36:41 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-21 16:36:41 -0400
commite2a0883e4071237d09b604a342c28b96b44a04b3 (patch)
treeaa56f4d376b5eb1c32358c19c2669c2a94e0e1fd /arch/um
parent3a990a52f9f25f45469e272017a31e7a3fda60ed (diff)
parent07c0c5d8b8c122b2f2df9ee574ac3083daefc981 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs pile 1 from Al Viro: "This is _not_ all; in particular, Miklos' and Jan's stuff is not there yet." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (64 commits) ext4: initialization of ext4_li_mtx needs to be done earlier debugfs-related mode_t whack-a-mole hfsplus: add an ioctl to bless files hfsplus: change finder_info to u32 hfsplus: initialise userflags qnx4: new helper - try_extent() qnx4: get rid of qnx4_bread/qnx4_getblk take removal of PF_FORKNOEXEC to flush_old_exec() trim includes in inode.c um: uml_dup_mmap() relies on ->mmap_sem being held, but activate_mm() doesn't hold it um: embed ->stub_pages[] into mmu_context gadgetfs: list_for_each_safe() misuse ocfs2: fix leaks on failure exits in module_init ecryptfs: make register_filesystem() the last potential failure exit ntfs: forgets to unregister sysctls on register_filesystem() failure logfs: missing cleanup on register_filesystem() failure jfs: mising cleanup on register_filesystem() failure make configfs_pin_fs() return root dentry on success configfs: configfs_create_dir() has parent dentry in dentry->d_parent configfs: sanitize configfs_create() ...
Diffstat (limited to 'arch/um')
-rw-r--r--arch/um/include/asm/mmu.h2
-rw-r--r--arch/um/include/asm/mmu_context.h11
-rw-r--r--arch/um/kernel/skas/mmu.c25
3 files changed, 16 insertions, 22 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/include/asm/mmu_context.h b/arch/um/include/asm/mmu_context.h
index 591b3d8d7614..aa4a743dc4ab 100644
--- a/arch/um/include/asm/mmu_context.h
+++ b/arch/um/include/asm/mmu_context.h
@@ -9,7 +9,7 @@
9#include <linux/sched.h> 9#include <linux/sched.h>
10#include <asm/mmu.h> 10#include <asm/mmu.h>
11 11
12extern void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm); 12extern void uml_setup_stubs(struct mm_struct *mm);
13extern void arch_exit_mmap(struct mm_struct *mm); 13extern void arch_exit_mmap(struct mm_struct *mm);
14 14
15#define deactivate_mm(tsk,mm) do { } while (0) 15#define deactivate_mm(tsk,mm) do { } while (0)
@@ -23,7 +23,9 @@ static inline void activate_mm(struct mm_struct *old, struct mm_struct *new)
23 * when the new ->mm is used for the first time. 23 * when the new ->mm is used for the first time.
24 */ 24 */
25 __switch_mm(&new->context.id); 25 __switch_mm(&new->context.id);
26 arch_dup_mmap(old, new); 26 down_write(&new->mmap_sem);
27 uml_setup_stubs(new);
28 up_write(&new->mmap_sem);
27} 29}
28 30
29static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, 31static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
@@ -39,6 +41,11 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
39 } 41 }
40} 42}
41 43
44static inline void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm)
45{
46 uml_setup_stubs(mm);
47}
48
42static inline void enter_lazy_tlb(struct mm_struct *mm, 49static inline void enter_lazy_tlb(struct mm_struct *mm,
43 struct task_struct *tsk) 50 struct task_struct *tsk)
44{ 51{
diff --git a/arch/um/kernel/skas/mmu.c b/arch/um/kernel/skas/mmu.c
index 1aee587e9c5d..4947b319f53a 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:
@@ -103,7 +101,7 @@ int init_new_context(struct task_struct *task, struct mm_struct *mm)
103 return ret; 101 return ret;
104} 102}
105 103
106void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm) 104void uml_setup_stubs(struct mm_struct *mm)
107{ 105{
108 struct page **pages; 106 struct page **pages;
109 int err, ret; 107 int err, ret;
@@ -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);