Compare commits

..

3 Commits
rawhide ... f10

Author SHA1 Message Date
Fedora Release Engineering
82b43d3fa8 dist-git conversion 2010-07-28 21:48:09 +00:00
Bill Nottingham
eacbcc5f88 Fix typo that causes a failure to update the common directory. (releng
#2781)
2009-11-26 01:54:55 +00:00
Jesse Keating
d8b08b17af Initialize branch F-10 for libunwind 2008-11-07 04:57:44 +00:00
14 changed files with 50831 additions and 731 deletions

3
.gitignore vendored
View File

@ -1,2 +1 @@
/libunwind-*.tar.gz
/v1.7.0-rc2.tar.gz
libunwind-snap-070224.tar.gz

49
frysk-patch-update Executable file
View File

@ -0,0 +1,49 @@
#! /usr/bin/perl
# $Id$
use strict;
use warnings;
sub readfile($)
{
my($filename)=@_;
local *F;
open F,$filename or die "open \"$filename\": $!";
my $F=do { local $/; <F>; } or die "read \"$filename\": $!";
close F or die "close \"$filename\": $!";
return $F;
}
sub writefile($$)
{
my($filename,$content)=@_;
local *F;
open F,">".$filename or die "create \"$filename\": $!";
print F $content or die "write \"$filename\": $!";
close F or die "close \"$filename\": $!";
}
my $spec=readfile "./libunwind.spec";
sub define_get($)
{
my($name)=@_;
my $r=($spec=~/^[%]define\s+\Q$name\E\s+(\S+)\s*$/m)[0] or die $name;
return $r;
}
my $frysksnap=define_get "frysksnap";
my $upstreamsnap=define_get "upstreamsnap";
my $patch="./libunwind-snap-${upstreamsnap}-frysk${frysksnap}.patch";
die $patch if !-e $patch;
my $content=readfile 'cvs -d :pserver:anoncvs@sources.redhat.com:/cvs/frysk'." rdiff -ko -r libunwind-20$upstreamsnap -r libunwind-0_99-0_1_frysk$frysksnap -u frysk-imports/libunwind|";
1 while $content=~s{^([^-+].*|--- |\Q+++\E )frysk-imports/(libunwind/)}{$1$2}mg;
writefile $patch,$content;
print "OK\n";

View File

@ -1,22 +0,0 @@
diff -up libunwind-1.3.1/include/libunwind.h.in.multilibfix libunwind-1.3.1/include/libunwind.h.in
--- libunwind-1.3.1/include/libunwind.h.in.multilibfix 2020-08-13 10:06:03.275601460 -0400
+++ libunwind-1.3.1/include/libunwind.h.in 2020-08-13 10:06:29.579522623 -0400
@@ -1,8 +1,6 @@
/* Provide a real file - not a symlink - as it would cause multiarch conflicts
when multiple different arch releases are installed simultaneously. */
-#ifndef UNW_REMOTE_ONLY
-
#if defined __aarch64__
#include "libunwind-aarch64.h"
#elif defined __arm__
@@ -28,9 +26,3 @@
#else
# error "Unsupported arch"
#endif
-
-#else /* UNW_REMOTE_ONLY */
-
-# include "libunwind-@arch@.h"
-
-#endif /* UNW_REMOTE_ONLY */

View File

@ -1,355 +0,0 @@
From cf6b9aadd60a85107afe5196251ca2ed198a96d0 Mon Sep 17 00:00:00 2001
From: Daniel Moody <daniel.moody@mongodb.com>
Date: Fri, 18 Feb 2022 14:24:37 -0600
Subject: [PATCH] Updated to determine PAGE_SIZE dynamically.
---
include/libunwind_i.h | 9 +++++++++
src/aarch64/Ginit.c | 19 ++++++++-----------
src/arm/Ginit.c | 13 ++-----------
src/mi/init.c | 28 ++++++++++++++++++++++++++--
src/riscv/Ginit.c | 22 ++++++++--------------
src/s390x/Ginit.c | 25 ++++++++++---------------
src/x86/Ginit.c | 13 ++-----------
src/x86_64/Ginit.c | 18 +++++-------------
8 files changed, 70 insertions(+), 77 deletions(-)
diff --git a/include/libunwind_i.h b/include/libunwind_i.h
index 6c7dda9a8..bcf229566 100644
--- a/include/libunwind_i.h
+++ b/include/libunwind_i.h
@@ -55,6 +55,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <string.h>
#include <unistd.h>
#include <sys/mman.h>
+#include <errno.h>
+#include <stdio.h>
#if defined(HAVE_ELF_H)
# include <elf.h>
@@ -288,6 +290,13 @@ print_error (const char *string)
return write (2, string, strlen (string));
}
+HIDDEN extern long unw_page_size;
+
+static inline unw_word_t uwn_page_start(unw_word_t addr)
+{
+ return addr & ~(unw_page_size - 1);
+}
+
#define mi_init UNWI_ARCH_OBJ(mi_init)
extern void mi_init (void); /* machine-independent initializations */
diff --git a/src/aarch64/Ginit.c b/src/aarch64/Ginit.c
index 2b08feb36..fe6e511df 100644
--- a/src/aarch64/Ginit.c
+++ b/src/aarch64/Ginit.c
@@ -84,8 +84,6 @@ get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
return 0;
}
-#define PAGE_SIZE 4096
-#define PAGE_START(a) ((a) & ~(PAGE_SIZE-1))
static int mem_validate_pipe[2] = {-1, -1};
@@ -197,11 +195,14 @@ tdep_init_mem_validate (void)
#ifdef HAVE_MINCORE
unsigned char present = 1;
- unw_word_t addr = PAGE_START((unw_word_t)&present);
+ size_t len = unw_page_size;
+ unw_word_t addr = uwn_page_start((unw_word_t)&present);
unsigned char mvec[1];
int ret;
- while ((ret = mincore ((void*)addr, PAGE_SIZE, (unsigned char *)mvec)) == -1 &&
- errno == EAGAIN) {}
+ while ((ret = mincore((void *)addr, len, (unsigned char *)mvec)) == -1 &&
+ errno == EAGAIN)
+ {
+ }
if (ret == 0)
{
Debug(1, "using mincore to validate memory\n");
@@ -295,12 +296,8 @@ validate_mem (unw_word_t addr)
{
size_t len;
- if (PAGE_START(addr + sizeof (unw_word_t) - 1) == PAGE_START(addr))
- len = PAGE_SIZE;
- else
- len = PAGE_SIZE * 2;
-
- addr = PAGE_START(addr);
+ len = unw_page_size;
+ addr = uwn_page_start(addr);
if (addr == 0)
return -1;
diff --git a/src/arm/Ginit.c b/src/arm/Ginit.c
index 0bac0d72d..bce52dc34 100644
--- a/src/arm/Ginit.c
+++ b/src/arm/Ginit.c
@@ -71,9 +71,6 @@ get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
return 0;
}
-#define PAGE_SIZE 4096
-#define PAGE_START(a) ((a) & ~(PAGE_SIZE-1))
-
/* Cache of already validated addresses */
#define NLGA 4
static unw_word_t last_good_addr[NLGA];
@@ -83,14 +80,8 @@ static int
validate_mem (unw_word_t addr)
{
int i, victim;
- size_t len;
-
- if (PAGE_START(addr + sizeof (unw_word_t) - 1) == PAGE_START(addr))
- len = PAGE_SIZE;
- else
- len = PAGE_SIZE * 2;
-
- addr = PAGE_START(addr);
+ size_t len = unw_page_size;
+ addr = uwn_page_start(addr);
if (addr == 0)
return -1;
diff --git a/src/mi/init.c b/src/mi/init.c
index 60a48c589..aa9319981 100644
--- a/src/mi/init.c
+++ b/src/mi/init.c
@@ -39,6 +39,30 @@ static const char rcsid[] UNUSED =
long unwi_debug_level;
#endif /* UNW_DEBUG */
+long unw_page_size;
+static void
+unw_init_page_size ()
+{
+ errno = 0;
+ long result = sysconf (_SC_PAGESIZE);
+ if (result == -1)
+ {
+ if (errno != 0)
+ {
+ print_error ("Failed to get _SC_PAGESIZE: ");
+ print_error (strerror(errno));
+ print_error ("\n");
+ }
+ else
+ print_error ("Failed to get _SC_PAGESIZE, errno was not set.\n");
+
+ unw_page_size = 4096;
+ }
+ else
+ {
+ unw_page_size = result;
+ }
+}
HIDDEN void
mi_init (void)
@@ -55,6 +79,6 @@ mi_init (void)
setbuf (stderr, NULL);
}
#endif
-
- assert (sizeof (struct cursor) <= sizeof (unw_cursor_t));
+ unw_init_page_size();
+ assert(sizeof(struct cursor) <= sizeof(unw_cursor_t));
}
diff --git a/src/riscv/Ginit.c b/src/riscv/Ginit.c
index 907f72962..4faeecbfd 100644
--- a/src/riscv/Ginit.c
+++ b/src/riscv/Ginit.c
@@ -97,9 +97,6 @@ get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
// Memory validation routines are from aarch64
-#define PAGE_SIZE 4096
-#define PAGE_START(a) ((a) & ~(PAGE_SIZE-1))
-
static int mem_validate_pipe[2] = {-1, -1};
#ifdef HAVE_PIPE2
@@ -210,11 +207,14 @@ tdep_init_mem_validate (void)
#ifdef HAVE_MINCORE
unsigned char present = 1;
- unw_word_t addr = PAGE_START((unw_word_t)&present);
+ size_t len = unw_page_size;
+ unw_word_t addr = uwn_page_start((unw_word_t)&present);
unsigned char mvec[1];
int ret;
- while ((ret = mincore ((void*)addr, PAGE_SIZE, (unsigned char *)mvec)) == -1 &&
- errno == EAGAIN) {}
+ while ((ret = mincore((void *)addr, len, (unsigned char *)mvec)) == -1 &&
+ errno == EAGAIN)
+ {
+ }
if (ret == 0)
{
Debug(1, "using mincore to validate memory\n");
@@ -306,14 +306,8 @@ cache_valid_mem(unw_word_t addr)
static int
validate_mem (unw_word_t addr)
{
- size_t len;
-
- if (PAGE_START(addr + sizeof (unw_word_t) - 1) == PAGE_START(addr))
- len = PAGE_SIZE;
- else
- len = PAGE_SIZE * 2;
-
- addr = PAGE_START(addr);
+ size_t len = unw_page_size;
+ addr = uwn_page_start(addr);
if (addr == 0)
return -1;
diff --git a/src/s390x/Ginit.c b/src/s390x/Ginit.c
index db01743c0..2bce2f4b6 100644
--- a/src/s390x/Ginit.c
+++ b/src/s390x/Ginit.c
@@ -27,6 +27,7 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+#include "libunwind_i.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -93,9 +94,6 @@ get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
return 0;
}
-#define PAGE_SIZE 4096
-#define PAGE_START(a) ((a) & ~(PAGE_SIZE-1))
-
static int mem_validate_pipe[2] = {-1, -1};
static inline void
@@ -163,7 +161,7 @@ static int mincore_validate (void *addr, size_t len)
return -1;
}
- for (i = 0; i < (len + PAGE_SIZE - 1) / PAGE_SIZE; i++)
+ for (i = 0; i < (len + unw_page_size - 1) / unw_page_size; i++)
{
if (!(mvec[i] & 1)) return -1;
}
@@ -183,11 +181,14 @@ tdep_init_mem_validate (void)
#ifdef HAVE_MINCORE
unsigned char present = 1;
- unw_word_t addr = PAGE_START((unw_word_t)&present);
+ size_t len = unw_page_size;
+ unw_word_t addr = uwn_page_start((unw_word_t)&present);
unsigned char mvec[1];
int ret;
- while ((ret = mincore ((void*)addr, PAGE_SIZE, mvec)) == -1 &&
- errno == EAGAIN) {}
+ while ((ret = mincore((void *)addr, len, mvec)) == -1 &&
+ errno == EAGAIN)
+ {
+ }
if (ret == 0 && (mvec[0] & 1))
{
Debug(1, "using mincore to validate memory\n");
@@ -210,14 +211,8 @@ static int
validate_mem (unw_word_t addr)
{
int i, victim;
- size_t len;
-
- if (PAGE_START(addr + sizeof (unw_word_t) - 1) == PAGE_START(addr))
- len = PAGE_SIZE;
- else
- len = PAGE_SIZE * 2;
-
- addr = PAGE_START(addr);
+ size_t len = unw_page_size;
+ addr = uwn_page_start(addr);
if (addr == 0)
return -1;
diff --git a/src/x86/Ginit.c b/src/x86/Ginit.c
index 3cec74a21..4261fb523 100644
--- a/src/x86/Ginit.c
+++ b/src/x86/Ginit.c
@@ -74,9 +74,6 @@ get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
return 0;
}
-#define PAGE_SIZE 4096
-#define PAGE_START(a) ((a) & ~(PAGE_SIZE-1))
-
/* Cache of already validated addresses */
#define NLGA 4
static unw_word_t last_good_addr[NLGA];
@@ -89,14 +86,8 @@ validate_mem (unw_word_t addr)
#ifdef HAVE_MINCORE
unsigned char mvec[2]; /* Unaligned access may cross page boundary */
#endif
- size_t len;
-
- if (PAGE_START(addr + sizeof (unw_word_t) - 1) == PAGE_START(addr))
- len = PAGE_SIZE;
- else
- len = PAGE_SIZE * 2;
-
- addr = PAGE_START(addr);
+ size_t len = unw_page_size;
+ addr = uwn_page_start(addr);
if (addr == 0)
return -1;
diff --git a/src/x86_64/Ginit.c b/src/x86_64/Ginit.c
index 0b121bc91..e75f92a5f 100644
--- a/src/x86_64/Ginit.c
+++ b/src/x86_64/Ginit.c
@@ -73,9 +73,6 @@ get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
return 0;
}
-#define PAGE_SIZE 4096
-#define PAGE_START(a) ((a) & ~(PAGE_SIZE-1))
-
static int mem_validate_pipe[2] = {-1, -1};
#ifdef HAVE_PIPE2
@@ -191,10 +188,11 @@ tdep_init_mem_validate (void)
#ifdef HAVE_MINCORE
unsigned char present = 1;
- unw_word_t addr = PAGE_START((unw_word_t)&present);
+ size_t len = unw_page_size;
+ unw_word_t addr = uwn_page_start((unw_word_t)&present);
unsigned char mvec[1];
int ret;
- while ((ret = mincore ((void*)addr, PAGE_SIZE, (unsigned char *)mvec)) == -1 &&
+ while ((ret = mincore ((void*)addr, len, (unsigned char *)mvec)) == -1 &&
errno == EAGAIN) {}
if (ret == 0)
{
@@ -287,14 +285,8 @@ cache_valid_mem(unw_word_t addr)
static int
validate_mem (unw_word_t addr)
{
- size_t len;
-
- if (PAGE_START(addr + sizeof (unw_word_t) - 1) == PAGE_START(addr))
- len = PAGE_SIZE;
- else
- len = PAGE_SIZE * 2;
-
- addr = PAGE_START(addr);
+ size_t len = unw_page_size;
+ addr = uwn_page_start(addr);
if (addr == 0)
return -1;

View File

@ -1,15 +0,0 @@
diff -up libunwind-1.6.2/src/arm/Gglobal.c.default-to-exidx libunwind-1.6.2/src/arm/Gglobal.c
--- libunwind-1.6.2/src/arm/Gglobal.c.default-to-exidx 2021-12-20 12:06:56.067313075 -0500
+++ libunwind-1.6.2/src/arm/Gglobal.c 2021-12-20 12:08:43.063060309 -0500
@@ -33,7 +33,10 @@ HIDDEN atomic_bool tdep_init_done = 0;
/* Android only supports three types of unwinding methods. */
HIDDEN int unwi_unwind_method = UNW_ARM_METHOD_DWARF | UNW_ARM_METHOD_EXIDX | UNW_ARM_METHOD_LR;
#else
-HIDDEN int unwi_unwind_method = UNW_ARM_METHOD_ALL;
+/* UNW_ARM_METHOD_ALL starts with UNW_ARM_METHOD_DWARF */
+/* which is never right on Fedora ARM. Default instead */
+/* to UNW_ARM_METHOD_EXIDX. */
+HIDDEN int unwi_unwind_method = UNW_ARM_METHOD_EXIDX;
#endif
HIDDEN void

View File

@ -1,25 +0,0 @@
This patch disables building of the (effectively empty)
dl-iterate-phdr.c source file. Symbols generated by annobin confuse
the run-check-namespace test because nm -g prints hidden weak symbols
in DSOs (they are considered external):
ERROR: Extraneous symbols:
000000000000de51 W dl_iterate_phdr.c.a8d8d212
ERROR: Extraneous symbols:
00000000000120b0 W dl_iterate_phdr.c.a8d8d212
This patch is downstream-specific due to annobin.
diff --git a/src/Makefile.am b/src/Makefile.am
index 2b5b02959e99eb8f..e5ff21515c36d30f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -147,7 +147,7 @@ libunwind_la_SOURCES_local = \
$(libunwind_la_SOURCES_local_unwind)
noinst_HEADERS += os-linux.h
-libunwind_la_SOURCES_os_linux = os-linux.c dl-iterate-phdr.c
+libunwind_la_SOURCES_os_linux = os-linux.c
libunwind_la_SOURCES_os_hpux = os-hpux.c

690
libunwind-orphanripper.c Normal file
View File

@ -0,0 +1,690 @@
/*
* Copyright 2006-2007 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Reap any leftover children possibly holding file descriptors.
* Children are identified by the stale file descriptor or PGID / SID.
* Both can be missed but only the stale file descriptors are important for us.
* PGID / SID may be set by the children on their own.
* If we fine a candidate we kill it will all its process tree (grandchildren).
* The child process is run with `2>&1' redirection (due to forkpty(3)).
* 2007-07-10 Jan Kratochvil <jan.kratochvil@redhat.com>
*/
/* For getpgid(2). */
#define _GNU_SOURCE 1
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <dirent.h>
#include <unistd.h>
#include <errno.h>
#include <ctype.h>
#include <string.h>
#include <limits.h>
#include <fcntl.h>
#include <assert.h>
#include <pty.h>
#include <poll.h>
#define LENGTH(x) (sizeof (x) / sizeof (*(x)))
static const char *progname;
static volatile int signal_child_hit = 0;
/* We use it to race-safely emulate ppoll(2) by poll(2). */
static int pipefd[2];
static void signal_child (int signo)
{
int i;
signal_child_hit = 1;
assert (pipefd[1] != -1);
i = close (pipefd[1]);
assert (i == 0);
pipefd[1] = -1;
}
static volatile int signal_alarm_hit = 0;
static void signal_alarm (int signo)
{
signal_alarm_hit = 1;
}
static char childptyname[LINE_MAX];
static pid_t child;
static void print_child_error (const char *reason, char **argv)
{
char **sp;
fprintf (stderr, "%s: %d %s:", progname, (int) child, reason);
for (sp = argv; *sp != NULL; sp++)
{
fputc (' ', stderr);
fputs (*sp, stderr);
}
fputc ('\n', stderr);
}
static int spawn (char **argv, int timeout)
{
pid_t child_got;
int status, amaster, i, rc;
struct sigaction act;
struct termios termios;
unsigned alarm_orig;
i = pipe (pipefd);
assert (i == 0);
/* We do not use signal(2) to be sure we have SA_RESTART set. */
memset (&act, 0, sizeof (act));
act.sa_handler = signal_child;
i = sigemptyset (&act.sa_mask);
assert (i == 0);
act.sa_flags = SA_RESTART;
i = sigaction (SIGCHLD, &act, NULL);
assert (i == 0);
/* With TERMP passed as NULL we get "\n" -> "\r\n". */
termios.c_iflag = IGNBRK | IGNPAR;
termios.c_oflag = 0;
termios.c_cflag = CS8 | CREAD | CLOCAL | HUPCL | B9600;
termios.c_lflag = IEXTEN | NOFLSH;
memset (termios.c_cc, _POSIX_VDISABLE, sizeof (termios.c_cc));
termios.c_cc[VTIME] = 0;
termios.c_cc[VMIN ] = 1;
cfmakeraw (&termios);
#ifdef FLUSHO
/* Workaround a readline deadlock bug in _get_tty_settings(). */
termios.c_lflag &= ~FLUSHO;
#endif
child = forkpty (&amaster, childptyname, &termios, NULL);
switch (child)
{
case -1:
perror ("forkpty(3)");
exit (EXIT_FAILURE);
case 0:
i = close (pipefd[0]);
assert (i == 0);
i = close (pipefd[1]);
assert (i == 0);
/* Do not replace STDIN as inferiors query its termios. */
#if 0
i = close (STDIN_FILENO);
assert (i == 0);
i = open ("/dev/null", O_RDONLY);
assert (i == STDIN_FILENO);
#endif
/* Do not setpgrp(2) in the parent process as the process-group
is shared for the whole sh(1) pipeline we could be a part
of. The process-group is set according to PID of the first
command in the pipeline.
We would rip even vi(1) in the case of:
./orphanripper sh -c 'sleep 1&' | vi -
*/
/* Do not setpgrp(2) as our pty would not be ours and we would
get `SIGSTOP' later, particularly after spawning gdb(1).
setsid(3) was already executed by forkpty(3) and it would fail if
executed again. */
if (getpid() != getpgrp ())
{
perror ("getpgrp(2)");
exit (EXIT_FAILURE);
}
execvp (argv[0], argv);
perror ("execvp(2)");
exit (EXIT_FAILURE);
default:
break;
}
i = fcntl (amaster, F_SETFL, O_RDWR | O_NONBLOCK);
if (i != 0)
{
perror ("fcntl (amaster, F_SETFL, O_NONBLOCK)");
exit (EXIT_FAILURE);
}
/* We do not use signal(2) to be sure we have SA_RESTART set. */
act.sa_handler = signal_alarm;
act.sa_flags &= ~SA_RESTART;
i = sigaction (SIGALRM, &act, NULL);
assert (i == 0);
alarm_orig = alarm (timeout);
assert (alarm_orig == 0);
while (!signal_alarm_hit)
{
struct pollfd pollfd[2];
char buf[LINE_MAX];
ssize_t buf_got;
pollfd[0].fd = amaster;
pollfd[0].events = POLLIN;
pollfd[1].fd = pipefd[0];
pollfd[1].events = POLLIN;
i = poll (pollfd, LENGTH (pollfd), -1);
if (i == -1 && errno == EINTR)
{
/* Weird but SA_RESTART sometimes does not work. */
continue;
}
assert (i >= 1);
/* Data available? Process it first. */
if (pollfd[0].revents & POLLIN)
{
buf_got = read (amaster, buf, sizeof buf);
if (buf_got <= 0)
{
perror ("read (amaster)");
exit (EXIT_FAILURE);
}
if (write (STDOUT_FILENO, buf, buf_got) != buf_got)
{
perror ("write(2)");
exit (EXIT_FAILURE);
}
}
if (pollfd[0].revents & POLLHUP)
break;
if ((pollfd[0].revents &= ~POLLIN) != 0)
{
fprintf (stderr, "%s: ppoll(2): revents 0x%x\n", progname,
(unsigned) pollfd[0].revents);
exit (EXIT_FAILURE);
}
/* Child exited? */
if (pollfd[1].revents & POLLHUP)
break;
assert (pollfd[1].revents == 0);
}
if (signal_alarm_hit)
{
i = kill (child, SIGKILL);
assert (i == 0);
}
else
alarm (0);
/* WNOHANG still could fail. */
child_got = waitpid (child, &status, 0);
if (child != child_got)
{
fprintf (stderr, "waitpid (%d) = %d: %m\n", (int) child, (int) child_got);
exit (EXIT_FAILURE);
}
if (signal_alarm_hit)
{
char *buf;
if (asprintf (&buf, "Timed out after %d seconds", timeout) != -1)
{
print_child_error (buf, argv);
free (buf);
}
rc = 128 + SIGALRM;
}
else if (WIFEXITED (status))
rc = WEXITSTATUS (status);
else if (WIFSIGNALED (status))
{
print_child_error (strsignal (WTERMSIG (status)), argv);
rc = 128 + WTERMSIG (status);
}
else if (WIFSTOPPED (status))
{
fprintf (stderr, "waitpid (%d): WIFSTOPPED - WSTOPSIG is %d\n",
(int) child, WSTOPSIG (status));
exit (EXIT_FAILURE);
}
else
{
fprintf (stderr, "waitpid (%d): !WIFEXITED (%d)\n", (int) child, status);
exit (EXIT_FAILURE);
}
assert (signal_child_hit != 0);
assert (pipefd[1] == -1);
i = close (pipefd[0]);
assert (i == 0);
/* Do not close the master FD as the child would have `/dev/pts/23 (deleted)'
entries which are not expected (and expecting ` (deleted)' would be
a race. */
#if 0
i = close (amaster);
if (i != 0)
{
perror ("close (forkpty ()'s amaster)");
exit (EXIT_FAILURE);
}
#endif
return rc;
}
/* Detected commandline may look weird due to a race:
Original command:
./orphanripper sh -c 'sleep 1&' &
Correct output:
[1] 29610
./orphanripper: Killed -9 orphan PID 29612 (PGID 29611): sleep 1
Raced output (sh(1) child still did not update its argv[]):
[1] 29613
./orphanripper: Killed -9 orphan PID 29615 (PGID 29614): sh -c sleep 1&
We could delay a bit before ripping the children. */
static const char *read_cmdline (pid_t pid)
{
char cmdline_fname[32];
static char cmdline[LINE_MAX];
int fd;
ssize_t got;
char *s;
if (snprintf (cmdline_fname, sizeof cmdline_fname, "/proc/%d/cmdline",
(int) pid) < 0)
return NULL;
fd = open (cmdline_fname, O_RDONLY);
if (fd == -1)
{
/* It may have already exited - ENOENT. */
#if 0
fprintf (stderr, "%s: open (\"%s\"): %m\n", progname, cmdline_fname);
#endif
return NULL;
}
got = read (fd, cmdline, sizeof (cmdline) - 1);
if (got == -1)
fprintf (stderr, "%s: read (\"%s\"): %m\n", progname,
cmdline_fname);
if (close (fd) != 0)
fprintf (stderr, "%s: close (\"%s\"): %m\n", progname,
cmdline_fname);
if (got < 0)
return NULL;
/* Convert '\0' argument delimiters to spaces. */
for (s = cmdline; s < cmdline + got; s++)
if (!*s)
*s = ' ';
/* Trim the trailing spaces (typically single '\0'->' '). */
while (s > cmdline && isspace (s[-1]))
s--;
*s = 0;
return cmdline;
}
static int dir_scan (const char *dirname,
int (*callback) (struct dirent *dirent, const char *pathname))
{
DIR *dir;
struct dirent *dirent;
int rc = 0;
dir = opendir (dirname);
if (dir == NULL)
{
if (errno == EACCES || errno == ENOENT)
return rc;
fprintf (stderr, "%s: opendir (\"%s\"): %m\n", progname, dirname);
exit (EXIT_FAILURE);
}
while ((errno = 0, dirent = readdir (dir)))
{
char pathname[LINE_MAX];
int pathname_len;
pathname_len = snprintf (pathname, sizeof pathname, "%s/%s",
dirname, dirent->d_name);
if (pathname_len <= 0 || pathname_len >= (int) sizeof pathname)
{
fprintf (stderr, "entry file name too long: `%s' / `%s'\n",
dirname, dirent->d_name);
continue;
}
/* RHEL-4.5 on s390x never fills in D_TYPE. */
if (dirent->d_type == DT_UNKNOWN)
{
struct stat statbuf;
int i;
/* We are not interested in the /proc/PID/fd/ links targets. */
i = lstat (pathname, &statbuf);
if (i == -1)
{
if (errno == EACCES || errno == ENOENT)
continue;
fprintf (stderr, "%s: stat (\"%s\"): %m\n", progname, pathname);
exit (EXIT_FAILURE);
}
if (S_ISDIR (statbuf.st_mode))
dirent->d_type = DT_DIR;
if (S_ISLNK (statbuf.st_mode))
dirent->d_type = DT_LNK;
/* No other D_TYPE types used in this code. */
}
rc = (*callback) (dirent, pathname);
if (rc != 0)
{
errno = 0;
break;
}
}
if (errno != 0)
{
fprintf (stderr, "%s: readdir (\"%s\"): %m\n", progname, dirname);
exit (EXIT_FAILURE);
}
if (closedir (dir) != 0)
{
fprintf (stderr, "%s: closedir (\"%s\"): %m\n", progname, dirname);
exit (EXIT_FAILURE);
}
return rc;
}
static int fd_fs_scan (pid_t pid, int (*func) (pid_t pid, const char *link))
{
char dirname[64];
if (snprintf (dirname, sizeof dirname, "/proc/%d/fd", (int) pid) < 0)
{
perror ("snprintf(3)");
exit (EXIT_FAILURE);
}
int callback (struct dirent *dirent, const char *pathname)
{
char buf[LINE_MAX];
ssize_t buf_len;
if ((dirent->d_type != DT_DIR && dirent->d_type != DT_LNK)
|| (dirent->d_type == DT_DIR && strcmp (dirent->d_name, ".") != 0
&& strcmp (dirent->d_name, "..") != 0)
|| (dirent->d_type == DT_LNK && strspn (dirent->d_name, "0123456789")
!= strlen (dirent->d_name)))
{
fprintf (stderr, "Unexpected entry \"%s\" (d_type %u)"
" on readdir (\"%s\"): %m\n",
dirent->d_name, (unsigned) dirent->d_type, dirname);
return 0;
}
if (dirent->d_type == DT_DIR)
return 0;
buf_len = readlink (pathname, buf, sizeof buf - 1);
if (buf_len <= 0 || buf_len >= (ssize_t) sizeof buf - 1)
{
if (errno != ENOENT && errno != EACCES)
fprintf (stderr, "Error reading link \"%s\": %m\n", pathname);
return 0;
}
buf[buf_len] = 0;
return (*func) (pid, buf);
}
return dir_scan (dirname, callback);
}
static void pid_fs_scan (void (*func) (pid_t pid, void *data), void *data)
{
int callback (struct dirent *dirent, const char *pathname)
{
if (dirent->d_type != DT_DIR
|| strspn (dirent->d_name, "0123456789") != strlen (dirent->d_name))
return 0;
(*func) (atoi (dirent->d_name), data);
return 0;
}
dir_scan ("/proc", callback);
}
static int rip_check_ptyname (pid_t pid, const char *link)
{
assert (pid != getpid ());
return strcmp (link, childptyname) == 0;
}
struct pid
{
struct pid *next;
pid_t pid;
};
static struct pid *pid_list;
static int pid_found (pid_t pid)
{
struct pid *entry;
for (entry = pid_list; entry != NULL; entry = entry->next)
if (entry->pid == pid)
return 1;
return 0;
}
/* Single pass is not enough, a (multithreaded) process was seen to survive.
Repeated killing of the same process is not enough, zombies can be killed.
*/
static int cleanup_acted;
static void pid_record (pid_t pid)
{
struct pid *entry;
if (pid_found (pid))
return;
cleanup_acted = 1;
entry = malloc (sizeof (*entry));
if (entry == NULL)
{
fprintf (stderr, "%s: malloc: %m\n", progname);
exit (EXIT_FAILURE);
}
entry->pid = pid;
entry->next = pid_list;
pid_list = entry;
}
static void pid_forall (void (*func) (pid_t pid))
{
struct pid *entry;
for (entry = pid_list; entry != NULL; entry = entry->next)
(*func) (entry->pid);
}
/* Returns 0 on failure. */
static pid_t pid_get_parent (pid_t pid)
{
char fname[64];
FILE *f;
char line[LINE_MAX];
pid_t retval = 0;
if (snprintf (fname, sizeof fname, "/proc/%d/status", (int) pid) < 0)
{
perror ("snprintf(3)");
exit (EXIT_FAILURE);
}
f = fopen (fname, "r");
if (f == NULL)
{
return 0;
}
while (errno = 0, fgets (line, sizeof line, f) == line)
{
if (strncmp (line, "PPid:\t", sizeof "PPid:\t" - 1) != 0)
continue;
retval = atoi (line + sizeof "PPid:\t" - 1);
errno = 0;
break;
}
if (errno != 0)
{
fprintf (stderr, "%s: fgets (\"%s\"): %m\n", progname, fname);
exit (EXIT_FAILURE);
}
if (fclose (f) != 0)
{
fprintf (stderr, "%s: fclose (\"%s\"): %m\n", progname, fname);
exit (EXIT_FAILURE);
}
return retval;
}
static void killtree (pid_t pid);
static void killtree_pid_fs_scan (pid_t pid, void *data)
{
pid_t parent_pid = *(pid_t *) data;
/* Do not optimize it as we could miss some newly spawned processes.
Always traverse all the leaves. */
#if 0
/* Optimization. */
if (pid_found (pid))
return;
#endif
if (pid_get_parent (pid) != parent_pid)
return;
killtree (pid);
}
static void killtree (pid_t pid)
{
pid_record (pid);
pid_fs_scan (killtree_pid_fs_scan, &pid);
}
static void rip_pid_fs_scan (pid_t pid, void *data)
{
pid_t pgid;
/* Shouldn't happen. */
if (pid == getpid ())
return;
/* Check both PGID and the stale file descriptors. */
pgid = getpgid (pid);
if (pgid == child
|| fd_fs_scan (pid, rip_check_ptyname) != 0)
killtree (pid);
}
static void killproc (pid_t pid)
{
const char *cmdline;
cmdline = read_cmdline (pid);
/* Avoid printing the message for already gone processes. */
if (kill (pid, 0) != 0 && errno == ESRCH)
return;
if (cmdline == NULL)
cmdline = "<error>";
fprintf (stderr, "%s: Killed -9 orphan PID %d: %s\n", progname, (int) pid, cmdline);
if (kill (pid, SIGKILL) == 0)
cleanup_acted = 1;
else if (errno != ESRCH)
fprintf (stderr, "%s: kill (%d, SIGKILL): %m\n", progname, (int) pid);
/* RHEL-3 kernels cannot SIGKILL a `T (stopped)' process. */
kill (pid, SIGCONT);
/* Do not waitpid(2) as it cannot be our direct descendant and it gets
cleaned up by init(8). */
#if 0
pid_t pid_got;
pid_got = waitpid (pid, NULL, 0);
if (pid != pid_got)
{
fprintf (stderr, "%s: waitpid (%d) != %d: %m\n", progname,
(int) pid, (int) pid_got);
return;
}
#endif
}
static void rip (void)
{
cleanup_acted = 0;
do
{
if (cleanup_acted)
usleep (1000000 / 10);
cleanup_acted = 0;
pid_fs_scan (rip_pid_fs_scan, NULL);
pid_forall (killproc);
}
while (cleanup_acted);
}
int main (int argc, char **argv)
{
int timeout = 0;
int rc;
progname = *argv++;
argc--;
if (argc < 1 || strcmp (*argv, "-h") == 0
|| strcmp (*argv, "--help") == 0)
{
puts ("Syntax: orphanripper [-t <seconds>] <execvp(3) commandline>");
exit (EXIT_FAILURE);
}
if ((*argv)[0] == '-' && (*argv)[1] == 't')
{
char *timeout_s = NULL;
if ((*argv)[2] == 0)
timeout_s = *++argv;
else if (isdigit ((*argv)[2]))
timeout_s = (*argv) + 2;
if (timeout_s != NULL)
{
long l;
char *endptr;
argv++;
l = strtol (timeout_s, &endptr, 0);
timeout = l;
if ((endptr != NULL && *endptr != 0) || timeout < 0 || timeout != l)
{
fprintf (stderr, "%s: Invalid timeout value: %s\n", progname,
timeout_s);
exit (EXIT_FAILURE);
}
}
}
rc = spawn (argv, timeout);
rip ();
return rc;
}

View File

@ -1,20 +0,0 @@
This is needed because under mock (especially with a systemd-coredump
handler on the system), no core files are created.
Submitted upstream: https://github.com/libunwind/libunwind/pull/418
diff --git a/tests/run-coredump-unwind b/tests/run-coredump-unwind
index 8d07742574602328..0c2b28c942477f7d 100755
--- a/tests/run-coredump-unwind
+++ b/tests/run-coredump-unwind
@@ -48,6 +48,10 @@ fi
./crasher backing_files
) 2>/dev/null
COREFILE=$TEMPDIR/core*
+if ! test -f "$COREFILE"; then
+ echo "crasher process did not produce coredump, test skipped"
+ exit 77
+fi
# magic option -testcase enables checking for the specific contents of the stack
./test-coredump-unwind $COREFILE -testcase `cat $TEMPDIR/backing_files`

View File

@ -0,0 +1,15 @@
--- libunwind-0.99-alpha-orig/include/libunwind_i.h 2006-07-28 05:30:50.000000000 +0200
+++ libunwind-0.99-alpha/include/libunwind_i.h 2008-09-22 01:53:04.000000000 +0200
@@ -238,11 +238,11 @@ extern int unwi_dyn_validate_cache (unw_
extern unw_dyn_info_list_t _U_dyn_info_list;
extern pthread_mutex_t _U_dyn_info_list_lock;
+#include <stdio.h>
#if UNW_DEBUG
#define unwi_debug_level UNWI_ARCH_OBJ(debug_level)
extern long unwi_debug_level;
-# include <stdio.h>
# define Debug(level,format...) \
do { \
if (unwi_debug_level >= level) \

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,109 @@
diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile -x Makefile.in libunwind-0.99-alpha-orig/Makefile.am libunwind-0.99-alpha/Makefile.am
--- libunwind-0.99-alpha-orig/Makefile.am 2006-07-27 05:13:14.000000000 +0200
+++ libunwind-0.99-alpha/Makefile.am 2008-02-24 06:43:08.000000000 +0100
@@ -40,6 +40,6 @@ EXTRA_DIST = include/dwarf.h include/dwa
include/libunwind-x86.h include/tdep-x86/libunwind_i.h \
include/tdep-x86/jmpbuf.h include/tdep-x86/dwarf-config.h \
include/libunwind-x86_64.h include/tdep-x86_64/libunwind_i.h \
- include/tdep-x86_64/jmpbuf.h include/tdep-x86_64/dwarf-config.h
-
-DISTCLEANFILES = include/libunwind.h include/tdep
+ include/tdep-x86_64/jmpbuf.h include/tdep-x86_64/dwarf-config.h \
+ include/libunwind.h include/tdep/libunwind_i.h \
+ include/tdep/jmpbuf.h include/tdep/dwarf-config.h
diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile -x Makefile.in libunwind-0.99-alpha-orig/configure.in libunwind-0.99-alpha/configure.in
--- libunwind-0.99-alpha-orig/configure.in 2008-02-24 06:29:08.000000000 +0100
+++ libunwind-0.99-alpha/configure.in 2008-02-24 06:30:29.000000000 +0100
@@ -80,8 +80,6 @@ AM_CONDITIONAL(OS_HPUX, expr x$target_os
if test x$target_arch != x$build_arch; then
CPPFLAGS="${CPPFLAGS} -DUNW_REMOTE_ONLY"
fi
-AC_CONFIG_LINKS(include/libunwind.h:include/libunwind-$target_arch.h
- include/tdep:include/tdep-$target_arch)
AC_ARG_ENABLE(debug,
[ --enable-debug turn on debug support (slows down execution)],
diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile -x Makefile.in libunwind-0.99-alpha-orig/include/libunwind.h libunwind-0.99-alpha/include/libunwind.h
--- libunwind-0.99-alpha-orig/include/libunwind.h 1970-01-01 01:00:00.000000000 +0100
+++ libunwind-0.99-alpha/include/libunwind.h 2008-02-24 06:40:59.000000000 +0100
@@ -0,0 +1,17 @@
+/* Provide a real file - not a symlink - as it would cause multiarch conflicts
+ (when multiple different arch releases are installed simultaneously.
+ https://bugzilla.redhat.com/show_bug.cgi?id=342451 */
+
+#if defined __x86_64__
+# include "libunwind-x86_64.h"
+#elif defined __i386__
+# include "libunwind-x86.h"
+#elif defined __ia64__
+# include "libunwind-ia64.h"
+#elif defined __powerpc64__
+# include "libunwind-ppc64.h"
+#elif defined __hpux
+# include "libunwind-hppa.h"
+#else
+# error "Unsupported arch"
+#endif
diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile -x Makefile.in libunwind-0.99-alpha-orig/include/tdep/dwarf-config.h libunwind-0.99-alpha/include/tdep/dwarf-config.h
--- libunwind-0.99-alpha-orig/include/tdep/dwarf-config.h 1970-01-01 01:00:00.000000000 +0100
+++ libunwind-0.99-alpha/include/tdep/dwarf-config.h 2008-02-24 06:41:02.000000000 +0100
@@ -0,0 +1,17 @@
+/* Provide a real file - not a symlink - as it would cause multiarch conflicts
+ (when multiple different arch releases are installed simultaneously.
+ https://bugzilla.redhat.com/show_bug.cgi?id=342451 */
+
+#if defined __x86_64__
+# include "tdep-x86_64/dwarf-config.h"
+#elif defined __i386__
+# include "tdep-x86/dwarf-config.h"
+#elif defined __ia64__
+# include "tdep-ia64/dwarf-config.h"
+#elif defined __powerpc64__
+# include "tdep-ppc64/dwarf-config.h"
+#elif defined __hpux
+# include "tdep-hppa/dwarf-config.h"
+#else
+# error "Unsupported arch"
+#endif
diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile -x Makefile.in libunwind-0.99-alpha-orig/include/tdep/jmpbuf.h libunwind-0.99-alpha/include/tdep/jmpbuf.h
--- libunwind-0.99-alpha-orig/include/tdep/jmpbuf.h 1970-01-01 01:00:00.000000000 +0100
+++ libunwind-0.99-alpha/include/tdep/jmpbuf.h 2008-02-24 06:41:04.000000000 +0100
@@ -0,0 +1,17 @@
+/* Provide a real file - not a symlink - as it would cause multiarch conflicts
+ (when multiple different arch releases are installed simultaneously.
+ https://bugzilla.redhat.com/show_bug.cgi?id=342451 */
+
+#if defined __x86_64__
+# include "tdep-x86_64/jmpbuf.h"
+#elif defined __i386__
+# include "tdep-x86/jmpbuf.h"
+#elif defined __ia64__
+# include "tdep-ia64/jmpbuf.h"
+#elif defined __powerpc64__
+# include "tdep-ppc64/jmpbuf.h"
+#elif defined __hpux
+# include "tdep-hppa/jmpbuf.h"
+#else
+# error "Unsupported arch"
+#endif
diff -u -X /home/jkratoch/.diffi.list -ruNp -x Makefile -x Makefile.in libunwind-0.99-alpha-orig/include/tdep/libunwind_i.h libunwind-0.99-alpha/include/tdep/libunwind_i.h
--- libunwind-0.99-alpha-orig/include/tdep/libunwind_i.h 1970-01-01 01:00:00.000000000 +0100
+++ libunwind-0.99-alpha/include/tdep/libunwind_i.h 2008-02-24 06:41:06.000000000 +0100
@@ -0,0 +1,17 @@
+/* Provide a real file - not a symlink - as it would cause multiarch conflicts
+ (when multiple different arch releases are installed simultaneously.
+ https://bugzilla.redhat.com/show_bug.cgi?id=342451 */
+
+#if defined __x86_64__
+# include "tdep-x86_64/libunwind_i.h"
+#elif defined __i386__
+# include "tdep-x86/libunwind_i.h"
+#elif defined __ia64__
+# include "tdep-ia64/libunwind_i.h"
+#elif defined __powerpc64__
+# include "tdep-ppc64/libunwind_i.h"
+#elif defined __hpux
+# include "tdep-hppa/libunwind_i.h"
+#else
+# error "Unsupported arch"
+#endif

View File

@ -0,0 +1,14 @@
diff -u -X /home/jkratoch/.diffi.list -rup libunwind-0.99-alpha-orig/tests/Makefile.am libunwind-0.99-alpha/tests/Makefile.am
--- libunwind-0.99-alpha-orig/tests/Makefile.am 2008-02-23 07:58:30.000000000 +0100
+++ libunwind-0.99-alpha/tests/Makefile.am 2008-02-23 18:59:09.000000000 +0100
@@ -4,7 +4,9 @@ EXTRA_DIST = run-ia64-test-dyn1 run-ptra
run-check-namespace check-namespace.sh.in run-ptrace-signull \
run-ptrace-stepper
-noinst_PROGRAMS_common =
+noinst_PROGRAMS_common = orphanripper
+orphanripper_LDADD = -lutil
+TESTS_ENVIRONMENT = ./orphanripper -t 120
check_PROGRAMS_common = test-proc-info test-static-link \
test-strerror
check_SCRIPTS_common = run-check-namespace

View File

@ -1,333 +1,101 @@
# The testsuite does not pass on all targets.
#
# aarch64
# Gtest-exc
# Ltest-exc
# Gtest-trace
# Ltest-trace
# Ltest-init-local-signal
# Ltest-mem-validate: https://github.com/libunwind/libunwind/issues/388
# test-reg-state
# Ltest-varargs
# Lrs-race
# test-ptrace
# run-check-namespace: https://github.com/libunwind/libunwind/issues/389
# run-ptrace-mapper
# run-ptrace-misc
# i686
# Ltest-mem-validate: https://github.com/libunwind/libunwind/issues/391
# test-async-sig
# test-ptrace
# ppc64le
# Gtest-exc
# Ltest-exc
# Gtest-resume-sig
# Ltest-resume-sig
# Gtest-resume-sig-rt
# Ltest-resume-sig-rt
# test-ptrace
# run-check-namespace
# run-ptrace-mapper
# run-ptrace-misc
#
# s390x
# Gtest-resume-sig-rt
# Ltest-resume-sig-rt
# test-ptrace
# rpmbuild parameters:
# --without check: Do not run the testsuite. Default is to run it.
%ifarch aarch64 i686 ppc64le s390x
%global test_failure_override true
%else
%global test_failure_override false
%endif
%global prerel rc2
# Define this if you want to skip the strip step and preserve debug info.
# Useful for testing.
#define __debug_install_post : > %{_builddir}/%{?buildsubdir}/debugfiles.list
Summary: An unwinding library
Name: libunwind
Version: 1.7.0
Release: 0.1.%{prerel}%{?dist}
# Latest libunwind release.
Version: 0.99
%define frysksnap 20070405cvs
%define upstreamsnap 070224
Release: 0.6.frysk%{frysksnap}%{?dist}
License: BSD
Group: Development/Debuggers
Source: http://download.savannah.nongnu.org/releases/libunwind/libunwind-snap-%{upstreamsnap}.tar.gz
Patch1: libunwind-snap-%{upstreamsnap}-frysk%{frysksnap}.patch
Patch2: libunwind-snap-070224-orphanripper.patch
Patch3: libunwind-snap-070224-multilib-rh342451.patch
Patch4: libunwind-snap-070224-dprintf-vs-stdio.h
Source1: libunwind-orphanripper.c
Buildroot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
URL: http://savannah.nongnu.org/projects/libunwind
Source: https://github.com/libunwind/libunwind/archive/refs/tags/v%{version}-%{prerel}.tar.gz
# http://download-mirror.savannah.gnu.org/releases/libunwind/libunwind-%%{version}.tar.gz
ExclusiveArch: ia64 x86_64 i386 ppc64
#Fedora specific patch
Patch1: libunwind-arm-default-to-exidx.patch
# Make libunwind.h multilib friendly
Patch2: libunwind-1.3.1-multilib-fix.patch
Patch5: libunwind-no-dl-iterate-phdr.patch
ExclusiveArch: %{arm} aarch64 hppa ia64 mips ppc %{power64} s390x %{ix86} x86_64
BuildRequires: automake libtool autoconf texlive-latex2man
BuildRequires: make
BuildRequires: gcc-c++
# host != target would cause REMOTE_ONLY build even if building i386 on x86_64.
%global _host %{_target_platform}
BuildRequires: glibc gcc make tar gzip
BuildRequires: automake libtool autoconf
Conflicts: gdb < 6.6-9
%description
Libunwind provides a C ABI to determine the call-chain of a program.
This version of libunwind is targetted for the ia64 platform.
%package devel
Summary: Development package for libunwind
Requires: libunwind = %{version}-%{release}
Group: Development/Debuggers
Requires: libunwind = %{PACKAGE_VERSION}
%description devel
The libunwind-devel package includes the libraries and header files for
libunwind.
%prep
%autosetup -p1 -n %{name}-%{version}-%{prerel}
%setup -q -n %{name}-%{version}-alpha
%patch1 -p1 -E
# New files from Patch1:
chmod +x tests/run-ptrace-stepper
chmod +x tests/run-ptrace-signull
%patch2 -p1 -E
cp -p %{SOURCE1} tests/orphanripper.c
%patch3 -p1 -E
%patch4 -p1 -E
%build
%global optflags %{optflags} -fcommon
mkdir -p config
aclocal
libtoolize --force
libtoolize
autoheader
automake --add-missing
autoconf
%configure --enable-static --enable-shared --enable-setjmp=no
make %{?_smp_mflags}
%configure --disable-static --enable-shared
make
%install
make install DESTDIR=$RPM_BUILD_ROOT
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
# /usr/include/libunwind-ptrace.h
# [...] aren't really part of the libunwind API. They are implemented in
# a archive library called libunwind-ptrace.a.
mv -f $RPM_BUILD_ROOT%{_libdir}/libunwind-ptrace.a $RPM_BUILD_ROOT%{_libdir}/libunwind-ptrace.a-save
rm -f $RPM_BUILD_ROOT%{_libdir}/libunwind*.a
mv -f $RPM_BUILD_ROOT%{_libdir}/libunwind-ptrace.a-save $RPM_BUILD_ROOT%{_libdir}/libunwind-ptrace.a
rm -f $RPM_BUILD_ROOT%{_libdir}/libunwind-ptrace*.so*
# fix multilib conflicts
touch -r NEWS $RPM_BUILD_ROOT%{_includedir}/libunwind.h
%makeinstall
rm -f $RPM_BUILD_ROOT/%{_libdir}/libunwind*.la
%check
%if 0%{?_without_check:1} || 0%{?_without_testsuite:1}
echo ====================TESTSUITE DISABLED=========================
%else
echo ====================TESTING=========================
if ! make check ; then
echo ====================FAILED TESTS=====================
cat tests/test-suite.log || true
%{test_failure_override}
fi
make check || true
echo ====================TESTING END=====================
%endif
%ldconfig_scriptlets
%clean
rm -rf $RPM_BUILD_ROOT
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%license COPYING
%doc README NEWS
%defattr(-,root,root)
%doc COPYING README NEWS
%{_libdir}/libunwind*.so.*
%files devel
%defattr(-,root,root)
%{_libdir}/libunwind*.so
%{_libdir}/libunwind-ptrace.a
%{_libdir}/pkgconfig/libunwind*.pc
%{_mandir}/*/*
# <unwind.h> does not get installed for REMOTE_ONLY targets - check it.
%{_includedir}/unwind.h
%{_includedir}/libunwind*.h
%{_includedir}/*
%changelog
* Mon Feb 20 2023 Tom Callaway <spot@fedoraproject.org> - 1.7.0-0.1.rc2
- update to 1.7.0-rc2
- disable tests on s390x (reported upstream: https://github.com/libunwind/libunwind/issues/464)
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.6.2-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Wed Sep 7 2022 Florian Weimer <fweimer@redhat.com> - 1.6.2-5
- Run the testsuite during build
* Wed Sep 7 2022 Florian Weimer <fweimer@redhat.com> - 1.6.2-4
- Enable %%autosetup to apply all patches (#2118019)
* Sun Aug 28 2022 Leif Liddy <leif.liddy@gmail.com> - 1.6.2-3
- enable dynamic page size support (bz2118019)
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.6.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.6.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Mon Dec 20 2021 Tom Callaway <spot@fedoraproject.org> - 1.6.2-1
- update to 1.6.2
* Wed Jul 21 2021 Tom Callaway <spot@fedoraproject.org> - 1.5.0-1
- update to 1.5.0
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Thu Aug 13 2020 Tom Callaway <spot@fedoraproject.org> - 1.4.0-4
- revert previous change
- fix it properly
* Mon Aug 10 2020 Tom Callaway <spot@fedoraproject.org> - 1.4.0-3
- fix multilib issues with libunwind.h (bz1866512)
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Apr 14 2020 Dan Horák <dan[at]danny.cz> - 1.4.0-1
- Update to 1.4.0 with s390x support
* Fri Jan 31 2020 Tom Callaway <spot@fedoraproject.org> - 1.3.1-5
- backport change from upstream to fix reported test failures (bz1795896)
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Sun Jan 13 2019 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 1.3.1-1
- Update to 1.3.1
- Remove no longer needed patch (builds on all arches without it)
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Fri Feb 09 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1.2.1-5
- Escape macros in %%changelog
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Sun Oct 29 2017 Tom Callaway <spot@fedoraproject.org> - 1.2.1-3
- fix multilib conflicts
* Sat Oct 14 2017 Peter Robinson <pbrobinson@fedoraproject.org> 1.2.1-2
- Add patch to fix ARM issues
* Fri Sep 1 2017 Tom Callaway <spot@fedoraproject.org> - 1.2.1-1
- update to 1.2.1
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Thu Jun 1 2017 Jes Sorensen <jes.sorensen@gmail.com> - 1.2-1
- Update to libunwind-1.2 (#1439962)
- Disable setjmp the correct way and get rid of messy patch
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.1-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.1-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Fri Jul 10 2015 Tom Callaway <spot@fedoraproject.org> - 1.1-10
- fix CVE-2015-3239
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Tue Jun 2 2015 Tom Callaway <spot@fedoraproject.org> - 1.1-8
- default arm unwinding method to exidx, old default of dwarf never works on Fedora
(#1226806)
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Tue May 13 2014 Jaromir Capik <jcapik@redhat.com> - 1.1-5
- Replacing ppc64 with the power64 macro (#1051641)
* Mon Jan 20 2014 Kyle McMartin <kmcmarti@redhat.com> 1.1-4
- Link test_ppc64_altivec against libunwind in tests/Makefile.am to fix build
on ppc64.
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Mon Jun 03 2013 Kyle McMartin <kmcmarti@redhat.com> 1.1-2
- Add aarch64 support from backported ac6c0a65. (Mark Salter)
(rhbz#969689)
* Mon Feb 18 2013 Kyle McMartin <kmcmarti@redhat.com> 1.1-1
- Update to upstream v1.1
- libunwind-install-ptrace.patch: drop upstream patch
- libunwind-arm-register-rename.patch: fixed upstream
- Add pkg-config files to libunwind-devel
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Wed Feb 15 2012 Peter Robinson <pbrobinson@fedoraproject.org> - 1.0.1-3
- Add patch to fix build on ARM
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Thu Sep 15 2011 Jan Kratochvil <jan.kratochvil@redhat.com> - 1.0.1-1.fc17
- Upgrade to the upstream release. (BZ 738595).
- Use official distribution URL for %%{source}.
* Thu Jun 02 2011 Paul Whalen <paul.whalen@senecac.on.ca> - 0.99-3.20110424git1e10c293
- Added arm macro to ExclusiveArch
* Mon May 9 2011 Jan Kratochvil <jan.kratochvil@redhat.com> - 0.99-2.20110424git1e10c293
- Install static libunwind-ptrace library into system (for ltrace, BZ 703159).
* Sun Apr 24 2011 Jan Kratochvil <jan.kratochvil@redhat.com> - 0.99-1.20110424git1e10c293
- Rebase to the upstream post-0.99 snapshot (BZ 697453).
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.99-0.16.20090430betagit4b8404d1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Wed Sep 29 2010 jkeating - 0.99-0.15.20090430betagit4b8404d1
- Rebuilt for gcc bug 634757
* Sat Sep 11 2010 Parag Nemade <paragn AT fedoraproject.org> 0.99-0.14.20090430betagit4b8404d1.fc15
- Merge-review cleanup (#226052)
* Fri Dec 4 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.99-0.13.20090430betagit4b8404d1
- The devel package now requires also base package's %%{release}.
- Update the obsolete macro %%{package_version}.
* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.99-0.12.20090430betagit4b8404d1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Wed Jul 15 2009 Jan Kratochvil <jan.kratochvil@redhat.com> - 0.99-0.11.20090430betagit4b8404d1
- Disable the libunwind-setjmp library as no longer compatible with glibc and
no Fedora dependencies on it (FTBSFS BZ 511562).
* Thu Apr 30 2009 Jan Kratochvil <jan.kratochvil@redhat.com> - 0.99-0.10.20090430betagit4b8404d1
- Fix the ia64 variant of GetIPInfo() (BZ 480412).
* Mon Apr 13 2009 Jan Kratochvil <jan.kratochvil@redhat.com> - 0.99-0.9.20090413betagitb483ea3f
- Rebase the package on the upstream variant: http://www.nongnu.org/libunwind/
- Drop the patch libunwind-snap-070224-frysk20070405cvs.patch
as even frysk-0.4-8.fc11 still has this library bundled statically.
- Disable the testsuite by default during the build.
- It should be run separately as it crashes some ia64 kernels.
- Drop the patch libunwind-snap-070224-orphanripper.patch.
- Drop the patch libunwind-snap-070224-dprintf-vs-stdio.h as no longer needed.
- Drop libunwind-snap-070224-multilib-rh342451.patch as accepted upstream.
- Fix and enable ppc (ppc32) arch.
* Tue Mar 3 2009 Jan Kratochvil <jan.kratochvil@redhat.com> - 0.99-0.8.frysk20070405cvs
- Fix .spec ExclusiveArch from i386 to %%{ix86}.
- Remove `BuildRequires: glibc gcc make tar gzip' - minimum build environment.
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.99-0.7.frysk20070405cvs
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Mon Sep 22 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 0.99-0.6.frysk20070405cvs
- Fix build error due to a `dprintf' conflict on recent glibc.
- New rpmbuild parameter: --without check
@ -356,7 +124,7 @@ echo ====================TESTING END=====================
* Sun Oct 01 2006 Jesse Keating <jkeating@redhat.com> - 0.98.5-3
- rebuilt for unwind info generation, broken in gcc-4.1.1-21
* Fri Sep 22 2006 Jan Kratochvil <jan.kratochvil@redhat.com> - 0.98.5-2
* Sat Sep 22 2006 Jan Kratochvil <jan.kratochvil@redhat.com> - 0.98.5-2
- SELinux compatibility fix - stack is now non-exec (Jakub Jelinek suggestion).
* Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - 0.98.5-1.1

View File

@ -1 +1 @@
SHA512 (v1.7.0-rc2.tar.gz) = 09920dffd7ab7eb18c3ec5ed3cbb78cc66e7456e465d7454c48d2d9d015e76d2ee78af42b34ccd85f4a15a2d61b1da461dcee12adadcfcf1ae4af3a2ecc59df3
679af461131997a5200af8b327f0c44b libunwind-snap-070224.tar.gz