Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

x86/um/vdso: Panic when vDSO can not be allocated

The vDSO address is added to the userspace auxiliary vectors even if the
vDSO was not allocated. When accessing the page, userspace processes
will crash.

Enforce that the allocation works.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20251013-uml-vdso-cleanup-v1-3-a079c7adcc69@weissschuh.net
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Thomas Weißschuh and committed by
Johannes Berg
12fe820f 8c0fbd6a

+1 -11
+1 -11
arch/x86/um/vdso/vma.c
··· 10 10 #include <asm/elf.h> 11 11 #include <linux/init.h> 12 12 13 - static unsigned int __read_mostly vdso_enabled = 1; 14 13 unsigned long um_vdso_addr; 15 14 static struct page *um_vdso; 16 15 ··· 24 25 25 26 um_vdso = alloc_page(GFP_KERNEL); 26 27 if (!um_vdso) 27 - goto oom; 28 + panic("Cannot allocate vdso\n"); 28 29 29 30 copy_page(page_address(um_vdso), vdso_start); 30 31 31 32 return 0; 32 - 33 - oom: 34 - printk(KERN_ERR "Cannot allocate vdso\n"); 35 - vdso_enabled = 0; 36 - 37 - return -ENOMEM; 38 33 } 39 34 subsys_initcall(init_vdso); 40 35 ··· 40 47 .name = "[vdso]", 41 48 .pages = &um_vdso, 42 49 }; 43 - 44 - if (!vdso_enabled) 45 - return 0; 46 50 47 51 if (mmap_write_lock_killable(mm)) 48 52 return -EINTR;