summaryrefslogtreecommitdiff
path: root/arch/um
diff options
context:
space:
mode:
authorDavid Gow <davidgow@google.com>2024-10-18 07:10:08 +0800
committerJohannes Berg <johannes.berg@intel.com>2024-10-18 10:37:52 +0200
commit8508a5e0e9db3932ca43651f86ba1042a1e9f4ca (patch)
treec3667f28ac0c4035efdaea546c19361123ec6ff1 /arch/um
parent1e3071d629b2e2cd7faeb8de2f88ba31cfd7231a (diff)
um: Fix misaligned stack in stub_exe
The stub_exe could segfault when built with some compilers (e.g. gcc 13.2.0), as SSE instructions which relied on stack alignment could be generated, but the stack was misaligned. This seems to be due to the __start entry point being run with a 16-byte aligned stack, but the x86_64 SYSV ABI wanting the stack to be so aligned _before_ a function call (so it is misaligned when the function is entered due to the return address being pushed). The function prologue then realigns it. Because the entry point is never _called_, and hence there is no return address, the prologue is therefore actually misaligning it, and causing the generated movaps instructions to SIGSEGV. This results in the following error: start_userspace : expected SIGSTOP, got status = 139 Don't generate this prologue for __start by using __attribute__((naked)), which resolves the issue. Fixes: 32e8eaf263d9 ("um: use execveat to create userspace MMs") Signed-off-by: David Gow <davidgow@google.com> Link: https://lore.kernel.org/linux-um/CABVgOS=boUoG6=LHFFhxEd8H8jDP1zOaPKFEjH+iy2n2Q5S2aQ@mail.gmail.com/ Link: https://patch.msgid.link/20241017231007.1500497-2-davidgow@google.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'arch/um')
-rw-r--r--arch/um/kernel/skas/stub_exe.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/um/kernel/skas/stub_exe.c b/arch/um/kernel/skas/stub_exe.c
index 04f75c577f1a..722ce6267476 100644
--- a/arch/um/kernel/skas/stub_exe.c
+++ b/arch/um/kernel/skas/stub_exe.c
@@ -79,7 +79,7 @@ noinline static void real_init(void)
__builtin_unreachable();
}
-void _start(void)
+__attribute__((naked)) void _start(void)
{
char *alloc;