From e786c1d6a942c734c78efc1bb1afa91cfce36123 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Thu, 2 Aug 2007 02:37:35 +0000 Subject: [PATCH] axeld + bonefish: After exec() we re-entered the userland without removing the syscall iframe from the iframe stack, thus leaking one stack slot. Fixes bug #1304. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21783 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/arch/x86/arch_thread.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/system/kernel/arch/x86/arch_thread.c b/src/system/kernel/arch/x86/arch_thread.c index 565d82fecd..729072c95f 100644 --- a/src/system/kernel/arch/x86/arch_thread.c +++ b/src/system/kernel/arch/x86/arch_thread.c @@ -334,6 +334,10 @@ arch_thread_enter_userspace(struct thread *t, addr_t entry, void *args1, void *a disable_interrupts(); + // When entering the userspace, the iframe stack needs to be empty. After + // an exec() it'll still contain the iframe from the syscall, though. + t->arch_info.iframes.index = 0; + i386_set_tss_and_kstack(t->kernel_stack_base + KERNEL_STACK_SIZE); // set the CPU dependent GDT entry for TLS