From 2a24bab833e9167582e34a1ec7faaa7b011122fb Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Mon, 4 Aug 2008 21:49:11 +0000 Subject: [PATCH] arch_setup_signal_frame(): panic() if we don't have a user iframe. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26808 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/arch/x86/arch_thread.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/system/kernel/arch/x86/arch_thread.cpp b/src/system/kernel/arch/x86/arch_thread.cpp index 20a878d6b3..eab495ea93 100644 --- a/src/system/kernel/arch/x86/arch_thread.cpp +++ b/src/system/kernel/arch/x86/arch_thread.cpp @@ -170,7 +170,7 @@ x86_next_page_directory(struct thread *from, struct thread *to) // the one we're switching to is kernel space return i386_translation_map_get_pgdir(&vm_kernel_address_space()->translation_map); } - + return i386_translation_map_get_pgdir(&to->team->address_space->translation_map); } @@ -439,6 +439,11 @@ arch_setup_signal_frame(struct thread *thread, struct sigaction *action, int signal, int signalMask) { struct iframe *frame = get_current_iframe(); + if (!IFRAME_IS_USER(frame)) { + panic("arch_setup_signal_frame(): No user iframe!"); + return B_BAD_VALUE; + } + uint32 *signalCode; uint32 *userRegs; struct vregs regs; @@ -473,7 +478,7 @@ arch_setup_signal_frame(struct thread *thread, struct sigaction *action, regs._reserved_2[1] = frame->esi; regs._reserved_2[2] = frame->ebp; i386_fnsave((void *)(®s.xregs)); - + userStack -= (sizeof(struct vregs) + 3) / 4; userRegs = userStack; status = user_memcpy(userRegs, ®s, sizeof(regs));