mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
x86/um/vdso: nommu: vdso memory update
On !MMU mode, the address of vdso is accessible from userspace. This commit implements the entry point by pointing a block of page address. This commit also add memory permission configuration of vdso page to be executable. Signed-off-by: Hajime Tazaki <thehajime@gmail.com> Signed-off-by: Ricardo Koller <ricarkol@google.com> [remove print, add comment on #endif] Link: https://patch.msgid.link/20260723113633.6393b6b5c614.Ia508c720e53c944e663430117899fb4912021d8a@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
cf2dd04179
commit
5b4d63ca18
|
|
@ -9,6 +9,7 @@
|
|||
#include <asm/page.h>
|
||||
#include <asm/elf.h>
|
||||
#include <linux/init.h>
|
||||
#include <os.h>
|
||||
|
||||
unsigned long um_vdso_addr;
|
||||
static struct page *um_vdso;
|
||||
|
|
@ -20,18 +21,25 @@ static int __init init_vdso(void)
|
|||
{
|
||||
BUG_ON(vdso_end - vdso_start > PAGE_SIZE);
|
||||
|
||||
um_vdso_addr = task_size - PAGE_SIZE;
|
||||
|
||||
um_vdso = alloc_page(GFP_KERNEL);
|
||||
if (!um_vdso)
|
||||
panic("Cannot allocate vdso\n");
|
||||
|
||||
copy_page(page_address(um_vdso), vdso_start);
|
||||
|
||||
#ifdef CONFIG_MMU
|
||||
um_vdso_addr = task_size - PAGE_SIZE;
|
||||
#else
|
||||
/* this is fine with NOMMU as everything is accessible */
|
||||
um_vdso_addr = (unsigned long)page_address(um_vdso);
|
||||
os_protect_memory((void *)um_vdso_addr, vdso_end - vdso_start, 1, 0, 1);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
subsys_initcall(init_vdso);
|
||||
|
||||
#ifdef CONFIG_MMU
|
||||
int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
|
||||
{
|
||||
struct vm_area_struct *vma;
|
||||
|
|
@ -53,3 +61,4 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
|
|||
|
||||
return IS_ERR(vma) ? PTR_ERR(vma) : 0;
|
||||
}
|
||||
#endif /* CONFIG_MMU */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user