mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hajime Tazaki <thehajime@gmail.com>
To: linux-um@lists.infradead.org
Cc: thehajime@gmail.com, ricarkol@google.com,
	Liam.Howlett@oracle.com, linux-kernel@vger.kernel.org
Subject: [PATCH v9 08/13] x86/um/vdso: nommu: vdso memory update
Date: Thu, 19 Jun 2025 10:04:12 +0900	[thread overview]
Message-ID: <207204e01eab3318e475f80be9fbaece51dd13cb.1750294482.git.thehajime@gmail.com> (raw)
In-Reply-To: <cover.1750294482.git.thehajime@gmail.com>

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>
---
 arch/x86/um/vdso/vma.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/arch/x86/um/vdso/vma.c b/arch/x86/um/vdso/vma.c
index dc8dfb2abd80..1c8c39f87681 100644
--- a/arch/x86/um/vdso/vma.c
+++ b/arch/x86/um/vdso/vma.c
@@ -9,6 +9,7 @@
 #include <asm/page.h>
 #include <asm/elf.h>
 #include <linux/init.h>
+#include <os.h>
 
 static unsigned int __read_mostly vdso_enabled = 1;
 unsigned long um_vdso_addr;
@@ -21,14 +22,24 @@ 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)
 		goto oom;
 
 	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
+
+	pr_info("vdso_start=%lx um_vdso_addr=%lx pg_um_vdso=%lx",
+	       (unsigned long)vdso_start, um_vdso_addr,
+	       (unsigned long)page_address(um_vdso));
+
 	return 0;
 
 oom:
@@ -39,6 +50,7 @@ static int __init init_vdso(void)
 }
 subsys_initcall(init_vdso);
 
+#ifdef CONFIG_MMU
 int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 {
 	struct vm_area_struct *vma;
@@ -63,3 +75,4 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 
 	return IS_ERR(vma) ? PTR_ERR(vma) : 0;
 }
+#endif
-- 
2.43.0


  parent reply	other threads:[~2025-06-19  1:04 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-19  1:04 [PATCH v9 00/13] nommu UML Hajime Tazaki
2025-06-19  1:04 ` [PATCH v9 01/13] x86/um: nommu: elf loader for fdpic Hajime Tazaki
2025-06-19  1:04 ` [PATCH v9 02/13] um: decouple MMU specific code from the common part Hajime Tazaki
2025-06-19  1:04 ` [PATCH v9 03/13] um: nommu: memory handling Hajime Tazaki
2025-06-19  1:04 ` [PATCH v9 04/13] x86/um: nommu: syscall handling Hajime Tazaki
2025-06-19 10:31   ` Benjamin Berg
2025-06-21 12:40     ` Hajime Tazaki
2025-06-19  1:04 ` [PATCH v9 05/13] um: nommu: seccomp syscalls hook Hajime Tazaki
2025-06-19  1:04 ` [PATCH v9 06/13] x86/um: nommu: process/thread handling Hajime Tazaki
2025-06-19 10:36   ` Benjamin Berg
2025-06-19 12:22     ` Hajime Tazaki
2025-06-19  1:04 ` [PATCH v9 07/13] um: nommu: configure fs register on host syscall invocation Hajime Tazaki
2025-06-19 10:40   ` Benjamin Berg
2025-06-19 12:22     ` Hajime Tazaki
2025-06-19 12:38       ` Benjamin Berg
2025-06-19 12:57         ` Hajime Tazaki
2025-06-19  1:04 ` Hajime Tazaki [this message]
2025-06-19  1:04 ` [PATCH v9 09/13] x86/um: nommu: signal handling Hajime Tazaki
2025-06-19  1:04 ` [PATCH v9 10/13] um: nommu: a work around for MMU dependency to PCI driver Hajime Tazaki
2025-06-19  1:04 ` [PATCH v9 11/13] um: change machine name for uname output Hajime Tazaki
2025-06-19  1:04 ` [PATCH v9 12/13] um: nommu: add documentation of nommu UML Hajime Tazaki
2025-06-19  1:04 ` [PATCH v9 13/13] um: nommu: plug nommu code into build system Hajime Tazaki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=207204e01eab3318e475f80be9fbaece51dd13cb.1750294482.git.thehajime@gmail.com \
    --to=thehajime@gmail.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-um@lists.infradead.org \
    --cc=ricarkol@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®