From 68b9883cc16ec2ce699d832ef60241b1a4e47d33 Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Thu, 19 Sep 2024 14:45:09 +0200 Subject: um: Discover host_task_size from envp When loading the UML binary, the host kernel will place the stack at the highest possible address. It will then map the program name and environment variables onto the start of the stack. As such, an easy way to figure out the host_task_size is to use the highest pointer to an environment variable as a reference. Ensure that this works by disabling address layout randomization and re-executing UML in case it was enabled. This increases the available TASK_SIZE for 64 bit UML considerably. Signed-off-by: Benjamin Berg Link: https://patch.msgid.link/20240919124511.282088-9-benjamin@sipsolutions.net Signed-off-by: Johannes Berg --- arch/um/include/shared/as-layout.h | 2 +- arch/um/include/shared/os.h | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) (limited to 'arch/um/include/shared') diff --git a/arch/um/include/shared/as-layout.h b/arch/um/include/shared/as-layout.h index 283226c34ca4..d9679c911e54 100644 --- a/arch/um/include/shared/as-layout.h +++ b/arch/um/include/shared/as-layout.h @@ -49,7 +49,7 @@ extern unsigned long brk_start; extern unsigned long host_task_size; extern unsigned long stub_start; -extern int linux_main(int argc, char **argv); +extern int linux_main(int argc, char **argv, char **envp); extern void uml_finishsetup(void); struct siginfo; diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h index b511637e1f76..bf539fee7831 100644 --- a/arch/um/include/shared/os.h +++ b/arch/um/include/shared/os.h @@ -325,9 +325,6 @@ extern int __ignore_sigio_fd(int fd); /* tty.c */ extern int get_pty(void); -/* sys-$ARCH/task_size.c */ -extern unsigned long os_get_top_address(void); - long syscall(long number, ...); /* irqflags tracing */ -- cgit v1.2.3