Skip to content

Commit 1fc350e

Browse files
btw616jmberg-intel
authored andcommitted
um: Allocate vdso page pointer statically
Instead of dynamically allocating the pointer to the vdso page during boot, we can just allocate it statically. Doing so will reduce error handling and make the code slightly more readable. Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com> Link: https://patch.msgid.link/20250212045756.164977-1-tiwei.btw@antgroup.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 84a6fc3 commit 1fc350e

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

arch/x86/um/vdso/vma.c

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,22 @@
1212

1313
static unsigned int __read_mostly vdso_enabled = 1;
1414
unsigned long um_vdso_addr;
15+
static struct page *um_vdso;
1516

1617
extern unsigned long task_size;
1718
extern char vdso_start[], vdso_end[];
1819

19-
static struct page **vdsop;
20-
2120
static int __init init_vdso(void)
2221
{
23-
struct page *um_vdso;
24-
2522
BUG_ON(vdso_end - vdso_start > PAGE_SIZE);
2623

2724
um_vdso_addr = task_size - PAGE_SIZE;
2825

29-
vdsop = kmalloc(sizeof(struct page *), GFP_KERNEL);
30-
if (!vdsop)
31-
goto oom;
32-
3326
um_vdso = alloc_page(GFP_KERNEL);
34-
if (!um_vdso) {
35-
kfree(vdsop);
36-
27+
if (!um_vdso)
3728
goto oom;
38-
}
3929

4030
copy_page(page_address(um_vdso), vdso_start);
41-
*vdsop = um_vdso;
4231

4332
return 0;
4433

@@ -56,6 +45,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
5645
struct mm_struct *mm = current->mm;
5746
static struct vm_special_mapping vdso_mapping = {
5847
.name = "[vdso]",
48+
.pages = &um_vdso,
5949
};
6050

6151
if (!vdso_enabled)
@@ -64,7 +54,6 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
6454
if (mmap_write_lock_killable(mm))
6555
return -EINTR;
6656

67-
vdso_mapping.pages = vdsop;
6857
vma = _install_special_mapping(mm, um_vdso_addr, PAGE_SIZE,
6958
VM_READ|VM_EXEC|
7059
VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,

0 commit comments

Comments
 (0)