* [PATCH 2/3] signal(ia64): alternative signal stack wraparound occurs
@ 2007-10-03 8:06 ` Shi Weihua
0 siblings, 0 replies; 2+ messages in thread
From: Shi Weihua @ 2007-10-03 8:06 UTC (permalink / raw)
To: linux-kernel; +Cc: tony.luck, linux-ia64
Fixing alternative signal stack wraparound.
If a process uses alternative signal stack by using sigaltstack()
and that stack overflow, stack wraparound occurs.
This patch checks whether the signal frame is on the alternative
stack. If the frame is not on there, kill a signal SIGSEGV to the process forcedly
then the process will be terminated.
This patch is for ia64,version is 2.6.23-rc8.
Signed-off-by: Shi Weihua <shiwh@cn.fujitsu.com>
diff -pur linux-2.6.23-rc8.orig/arch/ia64/ia32/ia32_signal.c
linux-2.6.23-rc8/arch/ia64/ia32/ia32_signal.c
--- linux-2.6.23-rc8.orig/arch/ia64/ia32/ia32_signal.c 2007-07-09 08:32:17.000000000 +0900
+++ linux-2.6.23-rc8/arch/ia64/ia32/ia32_signal.c 2007-09-26 12:16:09.000000000 +0900
@@ -766,7 +766,7 @@ get_sigframe (struct k_sigaction *ka, st
/* This is the X/Open sanctioned signal stack switching. */
if (ka->sa.sa_flags & SA_ONSTACK) {
- if (!on_sig_stack(esp))
+ if (sas_ss_flags(esp) = 0)
esp = current->sas_ss_sp + current->sas_ss_size;
}
/* Legacy stack switching not supported */
@@ -787,6 +787,10 @@ setup_frame_ia32 (int sig, struct k_siga
frame = get_sigframe(ka, regs, sizeof(*frame));
+ if ((ka->sa.sa_flags & SA_ONSTACK)
+ && (sas_ss_flags((unsigned long) frame) = 0))
+ goto give_sigsegv;
+
if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
goto give_sigsegv;
@@ -854,6 +858,10 @@ setup_rt_frame_ia32 (int sig, struct k_s
frame = get_sigframe(ka, regs, sizeof(*frame));
+ if ((ka->sa.sa_flags & SA_ONSTACK)
+ && (sas_ss_flags((unsigned long) frame) = 0))
+ goto give_sigsegv;
+
if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
goto give_sigsegv;
diff -pur linux-2.6.23-rc8.orig/arch/ia64/kernel/signal.c linux-2.6.23-rc8/arch/ia64/kernel/signal.c
--- linux-2.6.23-rc8.orig/arch/ia64/kernel/signal.c 2007-07-09 08:32:17.000000000 +0900
+++ linux-2.6.23-rc8/arch/ia64/kernel/signal.c 2007-09-26 09:54:10.000000000 +0900
@@ -362,6 +362,10 @@ setup_frame (int sig, struct k_sigaction
}
frame = (void __user *) ((new_sp - sizeof(*frame)) & -STACK_ALIGN);
+ if ((ka->sa.sa_flags & SA_ONSTACK)
+ && (sas_ss_flags((unsigned long) frame) = 0))
+ return force_sigsegv_info(sig, frame);
+
if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
return force_sigsegv_info(sig, frame);
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 2/3] signal(ia64): alternative signal stack wraparound occurs
@ 2007-10-03 8:06 ` Shi Weihua
0 siblings, 0 replies; 2+ messages in thread
From: Shi Weihua @ 2007-10-03 8:06 UTC (permalink / raw)
To: linux-kernel; +Cc: tony.luck, linux-ia64
Fixing alternative signal stack wraparound.
If a process uses alternative signal stack by using sigaltstack()
and that stack overflow, stack wraparound occurs.
This patch checks whether the signal frame is on the alternative
stack. If the frame is not on there, kill a signal SIGSEGV to the process forcedly
then the process will be terminated.
This patch is for ia64,version is 2.6.23-rc8.
Signed-off-by: Shi Weihua <shiwh@cn.fujitsu.com>
diff -pur linux-2.6.23-rc8.orig/arch/ia64/ia32/ia32_signal.c
linux-2.6.23-rc8/arch/ia64/ia32/ia32_signal.c
--- linux-2.6.23-rc8.orig/arch/ia64/ia32/ia32_signal.c 2007-07-09 08:32:17.000000000 +0900
+++ linux-2.6.23-rc8/arch/ia64/ia32/ia32_signal.c 2007-09-26 12:16:09.000000000 +0900
@@ -766,7 +766,7 @@ get_sigframe (struct k_sigaction *ka, st
/* This is the X/Open sanctioned signal stack switching. */
if (ka->sa.sa_flags & SA_ONSTACK) {
- if (!on_sig_stack(esp))
+ if (sas_ss_flags(esp) == 0)
esp = current->sas_ss_sp + current->sas_ss_size;
}
/* Legacy stack switching not supported */
@@ -787,6 +787,10 @@ setup_frame_ia32 (int sig, struct k_siga
frame = get_sigframe(ka, regs, sizeof(*frame));
+ if ((ka->sa.sa_flags & SA_ONSTACK)
+ && (sas_ss_flags((unsigned long) frame) == 0))
+ goto give_sigsegv;
+
if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
goto give_sigsegv;
@@ -854,6 +858,10 @@ setup_rt_frame_ia32 (int sig, struct k_s
frame = get_sigframe(ka, regs, sizeof(*frame));
+ if ((ka->sa.sa_flags & SA_ONSTACK)
+ && (sas_ss_flags((unsigned long) frame) == 0))
+ goto give_sigsegv;
+
if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
goto give_sigsegv;
diff -pur linux-2.6.23-rc8.orig/arch/ia64/kernel/signal.c linux-2.6.23-rc8/arch/ia64/kernel/signal.c
--- linux-2.6.23-rc8.orig/arch/ia64/kernel/signal.c 2007-07-09 08:32:17.000000000 +0900
+++ linux-2.6.23-rc8/arch/ia64/kernel/signal.c 2007-09-26 09:54:10.000000000 +0900
@@ -362,6 +362,10 @@ setup_frame (int sig, struct k_sigaction
}
frame = (void __user *) ((new_sp - sizeof(*frame)) & -STACK_ALIGN);
+ if ((ka->sa.sa_flags & SA_ONSTACK)
+ && (sas_ss_flags((unsigned long) frame) == 0))
+ return force_sigsegv_info(sig, frame);
+
if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
return force_sigsegv_info(sig, frame);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-10-03 8:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-03 8:06 [PATCH 2/3] signal(ia64): alternative signal stack wraparound occurs Shi Weihua
2007-10-03 8:06 ` Shi Weihua
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.