diff options
Diffstat (limited to 'arch/um')
-rw-r--r-- | arch/um/os-Linux/Makefile | 2 | ||||
-rw-r--r-- | arch/um/os-Linux/main.c | 14 |
2 files changed, 14 insertions, 2 deletions
diff --git a/arch/um/os-Linux/Makefile b/arch/um/os-Linux/Makefile index 544e0b344c75..049dfa5bc9c6 100644 --- a/arch/um/os-Linux/Makefile +++ b/arch/um/os-Linux/Makefile @@ -12,6 +12,8 @@ obj-y = execvp.o file.o helper.o irq.o main.o mem.o process.o \ CFLAGS_signal.o += -Wframe-larger-than=4096 +CFLAGS_main.o += -Wno-frame-larger-than + obj-$(CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA) += elf_aux.o USER_OBJS := $(user-objs-y) elf_aux.o execvp.o file.o helper.o irq.o \ diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c index 8a52c49c5361..5e0cba5aee93 100644 --- a/arch/um/os-Linux/main.c +++ b/arch/um/os-Linux/main.c @@ -10,6 +10,7 @@ #include <errno.h> #include <signal.h> #include <string.h> +#include <limits.h> #include <sys/resource.h> #include <sys/personality.h> #include <as-layout.h> @@ -112,8 +113,17 @@ int __init main(int argc, char **argv, char **envp) /* Disable randomization and re-exec if it was changed successfully */ ret = personality(PER_LINUX | ADDR_NO_RANDOMIZE); if (ret >= 0 && (ret & (PER_LINUX | ADDR_NO_RANDOMIZE)) != - (PER_LINUX | ADDR_NO_RANDOMIZE)) - execve("/proc/self/exe", argv, envp); + (PER_LINUX | ADDR_NO_RANDOMIZE)) { + char buf[PATH_MAX] = {}; + ssize_t ret; + + ret = readlink("/proc/self/exe", buf, sizeof(buf)); + if (ret < 0 || ret >= sizeof(buf)) { + perror("readlink failure"); + exit(1); + } + execve(buf, argv, envp); + } set_stklim(); |