7
7
*/
8
8
9
9
#include <linux/cache.h>
10
+ #include <linux/vdso_datastore.h>
10
11
#include <linux/elf.h>
11
12
#include <linux/err.h>
12
13
#include <linux/kernel.h>
@@ -33,15 +34,6 @@ extern char vdso_start[], vdso_end[];
33
34
/* Total number of pages needed for the data and text portions of the VDSO. */
34
35
unsigned int vdso_total_pages __ro_after_init ;
35
36
36
- static union vdso_data_store vdso_data_store __page_aligned_data ;
37
- struct vdso_data * vdso_data = vdso_data_store .data ;
38
-
39
- static struct page * vdso_data_page __ro_after_init ;
40
- static const struct vm_special_mapping vdso_data_mapping = {
41
- .name = "[vvar]" ,
42
- .pages = & vdso_data_page ,
43
- };
44
-
45
37
static int vdso_mremap (const struct vm_special_mapping * sm ,
46
38
struct vm_area_struct * new_vma )
47
39
{
@@ -192,9 +184,6 @@ static int __init vdso_init(void)
192
184
if (vdso_text_pagelist == NULL )
193
185
return - ENOMEM ;
194
186
195
- /* Grab the VDSO data page. */
196
- vdso_data_page = virt_to_page (vdso_data );
197
-
198
187
/* Grab the VDSO text pages. */
199
188
for (i = 0 ; i < text_pages ; i ++ ) {
200
189
struct page * page ;
@@ -205,7 +194,7 @@ static int __init vdso_init(void)
205
194
206
195
vdso_text_mapping .pages = vdso_text_pagelist ;
207
196
208
- vdso_total_pages = 1 ; /* for the data/vvar page */
197
+ vdso_total_pages = VDSO_NR_PAGES ; /* for the data/vvar pages */
209
198
vdso_total_pages += text_pages ;
210
199
211
200
cntvct_ok = cntvct_functional ();
@@ -216,16 +205,7 @@ static int __init vdso_init(void)
216
205
}
217
206
arch_initcall (vdso_init );
218
207
219
- static int install_vvar (struct mm_struct * mm , unsigned long addr )
220
- {
221
- struct vm_area_struct * vma ;
222
-
223
- vma = _install_special_mapping (mm , addr , PAGE_SIZE ,
224
- VM_READ | VM_MAYREAD ,
225
- & vdso_data_mapping );
226
-
227
- return PTR_ERR_OR_ZERO (vma );
228
- }
208
+ static_assert (__VDSO_PAGES == VDSO_NR_PAGES );
229
209
230
210
/* assumes mmap_lock is write-locked */
231
211
void arm_install_vdso (struct mm_struct * mm , unsigned long addr )
@@ -238,12 +218,12 @@ void arm_install_vdso(struct mm_struct *mm, unsigned long addr)
238
218
if (vdso_text_pagelist == NULL )
239
219
return ;
240
220
241
- if (install_vvar ( mm , addr ))
221
+ if (IS_ERR ( vdso_install_vvar_mapping ( mm , addr ) ))
242
222
return ;
243
223
244
- /* Account for vvar page . */
245
- addr += PAGE_SIZE ;
246
- len = (vdso_total_pages - 1 ) << PAGE_SHIFT ;
224
+ /* Account for vvar pages . */
225
+ addr += VDSO_NR_PAGES * PAGE_SIZE ;
226
+ len = (vdso_total_pages - VDSO_NR_PAGES ) << PAGE_SHIFT ;
247
227
248
228
vma = _install_special_mapping (mm , addr , len ,
249
229
VM_READ | VM_EXEC | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC ,
0 commit comments