- libsigsegv allocates alternate stack on the main stack (#524796)
This commit is contained in:
parent
dd49317ccd
commit
105e94eecc
112
libsigsegv-2.6-mystack.patch
Normal file
112
libsigsegv-2.6-mystack.patch
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
From 4f14ef87b2fba9718c1a88b9ed9ca7ba111d60da Mon Sep 17 00:00:00 2001
|
||||||
|
From: Paolo Bonzini <pbonzini@redhat.com>
|
||||||
|
Date: Tue, 22 Sep 2009 08:10:43 +0000
|
||||||
|
Subject: Fix crash of stackoverflow2 on x86_64-linux.
|
||||||
|
|
||||||
|
---
|
||||||
|
diff --git a/src/sigsegv.h.in b/src/sigsegv.h.in
|
||||||
|
index 85f337d..6b8e4c7 100644
|
||||||
|
--- a/src/sigsegv.h.in
|
||||||
|
+++ b/src/sigsegv.h.in
|
||||||
|
@@ -121,9 +121,11 @@ typedef void (*stackoverflow_handler_t) (int emergency, stackoverflow_context_t
|
||||||
|
/*
|
||||||
|
* Installs a stack overflow handler.
|
||||||
|
* The extra_stack argument is a pointer to a pre-allocated area used as a
|
||||||
|
- * stack for executing the handler. It is typically allocated by use of
|
||||||
|
- * `alloca' during `main'. Its size should be sufficiently large.
|
||||||
|
- * The following code determines an appropriate size:
|
||||||
|
+ * stack for executing the handler. It typically comes from a static variable
|
||||||
|
+ * or from heap-allocated memoty; placing it on the main stack may fail on
|
||||||
|
+ * some operating systems.
|
||||||
|
+ * Its size, passed in extra_stack_size, should be sufficiently large. The
|
||||||
|
+ * following code determines an appropriate size:
|
||||||
|
* #include <signal.h>
|
||||||
|
* #ifndef SIGSTKSZ / * glibc defines SIGSTKSZ for this purpose * /
|
||||||
|
* # define SIGSTKSZ 16384 / * on most platforms, 16 KB are sufficient * /
|
||||||
|
diff --git a/tests/stackoverflow1.c b/tests/stackoverflow1.c
|
||||||
|
index 0970e79..23eff58 100644
|
||||||
|
--- a/tests/stackoverflow1.c
|
||||||
|
+++ b/tests/stackoverflow1.c
|
||||||
|
@@ -88,12 +88,13 @@ recurse (volatile int n)
|
||||||
|
return *recurse_1 (n, &n);
|
||||||
|
}
|
||||||
|
|
||||||
|
+/* glibc says: Users should use SIGSTKSZ as the size of user-supplied
|
||||||
|
+ buffers. */
|
||||||
|
+char mystack[2 * 2 * SIGSTKSZ];
|
||||||
|
+
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
- /* glibc says: Users should use SIGSTKSZ as the size of user-supplied
|
||||||
|
- buffers. */
|
||||||
|
- char mystack[SIGSTKSZ];
|
||||||
|
sigset_t emptyset;
|
||||||
|
|
||||||
|
#if HAVE_SETRLIMIT && defined RLIMIT_STACK
|
||||||
|
diff --git a/tests/stackoverflow2.c b/tests/stackoverflow2.c
|
||||||
|
index 2475bf2..4a07c66 100644
|
||||||
|
--- a/tests/stackoverflow2.c
|
||||||
|
+++ b/tests/stackoverflow2.c
|
||||||
|
@@ -109,12 +109,13 @@ recurse (volatile int n)
|
||||||
|
return *recurse_1 (n, &n);
|
||||||
|
}
|
||||||
|
|
||||||
|
+/* glibc says: Users should use SIGSTKSZ as the size of user-supplied
|
||||||
|
+ buffers. */
|
||||||
|
+char mystack[2 * SIGSTKSZ];
|
||||||
|
+
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
- /* glibc says: Users should use SIGSTKSZ as the size of user-supplied
|
||||||
|
- buffers. */
|
||||||
|
- char mystack[SIGSTKSZ];
|
||||||
|
sigset_t emptyset;
|
||||||
|
void *p;
|
||||||
|
|
||||||
|
--
|
||||||
|
cgit v0.8.2.1
|
||||||
|
diff -up libsigsegv-2.6/m4/sigaltstack-longjmp.m4.stack2 libsigsegv-2.6/m4/sigaltstack-longjmp.m4
|
||||||
|
--- libsigsegv-2.6/m4/sigaltstack-longjmp.m4.stack2 2008-08-24 15:40:16.000000000 -0500
|
||||||
|
+++ libsigsegv-2.6/m4/sigaltstack-longjmp.m4 2009-09-22 13:26:07.552664938 -0500
|
||||||
|
@@ -51,9 +51,9 @@ int recurse (volatile int n)
|
||||||
|
int sum = 0;
|
||||||
|
return *recurse_1 (n, &sum);
|
||||||
|
}
|
||||||
|
+char mystack[2 * SIGSTKSZ];
|
||||||
|
int main ()
|
||||||
|
{
|
||||||
|
- char mystack[SIGSTKSZ];
|
||||||
|
stack_t altstack;
|
||||||
|
struct sigaction action;
|
||||||
|
sigset_t emptyset;
|
||||||
|
diff -up libsigsegv-2.6/m4/sigaltstack.m4.stack2 libsigsegv-2.6/m4/sigaltstack.m4
|
||||||
|
--- libsigsegv-2.6/m4/sigaltstack.m4.stack2 2008-08-24 15:41:10.000000000 -0500
|
||||||
|
+++ libsigsegv-2.6/m4/sigaltstack.m4 2009-09-22 13:25:47.462666140 -0500
|
||||||
|
@@ -71,9 +71,10 @@ int recurse (volatile int n)
|
||||||
|
int sum = 0;
|
||||||
|
return *recurse_1 (n, &sum);
|
||||||
|
}
|
||||||
|
+char mystack[2 * SIGSTKSZ];
|
||||||
|
+
|
||||||
|
int main ()
|
||||||
|
{
|
||||||
|
- char mystack[SIGSTKSZ];
|
||||||
|
stack_t altstack;
|
||||||
|
struct sigaction action;
|
||||||
|
#if defined HAVE_SETRLIMIT && defined RLIMIT_STACK
|
||||||
|
diff -up libsigsegv-2.6/m4/sigaltstack-siglongjmp.m4.stack2 libsigsegv-2.6/m4/sigaltstack-siglongjmp.m4
|
||||||
|
--- libsigsegv-2.6/m4/sigaltstack-siglongjmp.m4.stack2 2008-08-24 15:40:49.000000000 -0500
|
||||||
|
+++ libsigsegv-2.6/m4/sigaltstack-siglongjmp.m4 2009-09-22 13:26:43.994665249 -0500
|
||||||
|
@@ -49,9 +49,9 @@ int recurse (volatile int n)
|
||||||
|
int sum = 0;
|
||||||
|
return *recurse_1 (n, &sum);
|
||||||
|
}
|
||||||
|
+char mystack[2 * SIGSTKSZ];
|
||||||
|
int main ()
|
||||||
|
{
|
||||||
|
- char mystack[SIGSTKSZ];
|
||||||
|
stack_t altstack;
|
||||||
|
struct sigaction action;
|
||||||
|
#ifdef __BEOS__
|
@ -4,7 +4,7 @@
|
|||||||
Summary: Library for handling page faults in user mode
|
Summary: Library for handling page faults in user mode
|
||||||
Name: libsigsegv
|
Name: libsigsegv
|
||||||
Version: 2.6
|
Version: 2.6
|
||||||
Release: 4%{?dist}
|
Release: 5%{?dist}
|
||||||
|
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
URL: http://libsigsegv.sourceforge.net/
|
URL: http://libsigsegv.sourceforge.net/
|
||||||
@ -12,8 +12,18 @@ Source0: http://ftp.gnu.org/gnu/libsigsegv/libsigsegv-%{version}.tar.gz
|
|||||||
Group: System Environment/Libraries
|
Group: System Environment/Libraries
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||||
|
|
||||||
|
#Patch1: libsigsegv-2.6-confdefs_debug.patch
|
||||||
|
|
||||||
|
## upstream patches
|
||||||
|
# based on:
|
||||||
|
# http://git.savannah.gnu.org/cgit/libsigsegv.git/patch/?id=4f14ef87b2fba9718c1a88b9ed9ca7ba111d60da
|
||||||
|
# http://git.savannah.gnu.org/cgit/libsigsegv.git/patch/?id=54b612e978e26a52b5706272dabf84ed9d895fa7
|
||||||
|
Patch100: libsigsegv-2.6-mystack.patch
|
||||||
|
|
||||||
Source1: sigsegv-wrapper.h
|
Source1: sigsegv-wrapper.h
|
||||||
|
|
||||||
|
BuildRequires: automake libtool
|
||||||
|
|
||||||
%description
|
%description
|
||||||
This is a library for handling page faults in user mode. A page fault
|
This is a library for handling page faults in user mode. A page fault
|
||||||
occurs when a program tries to access to a region of memory that is
|
occurs when a program tries to access to a region of memory that is
|
||||||
@ -43,6 +53,9 @@ Requires: %{name}-devel = %{version}-%{release}
|
|||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
|
|
||||||
|
%patch100 -p1 -b .mystack
|
||||||
|
autoreconf
|
||||||
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%configure \
|
%configure \
|
||||||
@ -111,6 +124,9 @@ rm -rf %{buildroot}
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Sep 22 2009 Rex Dieter <rdieter@fedoraproject.org> - 2.6-5
|
||||||
|
- libsigsegv allocates alternate stack on the main stack (#524796)
|
||||||
|
|
||||||
* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.6-4
|
* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.6-4
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user