Compare commits
3 Commits
Author | SHA1 | Date |
---|---|---|
|
65ed998a70 | 4 years ago |
|
d9d7fde840 | 6 years ago |
|
e5fe2bda60 | 6 years ago |
@ -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 */
|
@ -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;
|
@ -1,15 +1,15 @@
|
||||
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
|
||||
diff -up libunwind-1.1/src/arm/Gglobal.c.default-to-exidx libunwind-1.1/src/arm/Gglobal.c
|
||||
--- libunwind-1.1/src/arm/Gglobal.c.default-to-exidx 2015-06-02 10:38:39.733587918 -0400
|
||||
+++ libunwind-1.1/src/arm/Gglobal.c 2015-06-02 10:38:53.086500142 -0400
|
||||
@@ -29,7 +29,10 @@ HIDDEN define_lock (arm_lock);
|
||||
HIDDEN int tdep_init_done;
|
||||
|
||||
/* Unwinding methods to use. See UNW_METHOD_ enums */
|
||||
-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
|
||||
tdep_init (void)
|
||||
|
@ -1,24 +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 -up libunwind-1.8.0/src/Makefile.am.no-dl-iterate-phdr libunwind-1.8.0/src/Makefile.am
|
||||
--- libunwind-1.8.0/src/Makefile.am.no-dl-iterate-phdr 2024-01-29 16:30:52.230008417 -0500
|
||||
+++ libunwind-1.8.0/src/Makefile.am 2024-01-29 16:31:40.476692706 -0500
|
||||
@@ -346,7 +346,7 @@ noinst_LTLIBRARIES += $(libunwind_elf_li
|
||||
libunwind_la_LIBADD += $(libunwind_elf_libs)
|
||||
|
||||
if OS_LINUX
|
||||
- libunwind_la_SOURCES_os = os-linux.c dl-iterate-phdr.c
|
||||
+ libunwind_la_SOURCES_os = os-linux.c
|
||||
libunwind_la_SOURCES_os_local = $(libunwind_la_SOURCES_os_linux_local)
|
||||
libunwind_la_SOURCES_aarch64_os = aarch64/Gos-linux.c
|
||||
libunwind_la_SOURCES_aarch64_os_local = aarch64/Los-linux.c
|
@ -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`
|
@ -1 +1 @@
|
||||
SHA512 (libunwind-1.8.0.tar.gz) = ecbcfacacbcc4f7e4326397af448c92253f88b8f57c14c31b9b82b3a2951eb67b164b2a137b2800a2ada933a07a5bdd75f0198d3e4c6a2d8d740559e3a76f1b2
|
||||
SHA512 (libunwind-1.3.1.tar.gz) = 3110d0aed4f5c781ef1ff72c9337e59793c02c42066209a4ac44f50eff1c0b0e02a5ff9f66891e62016de14af065a47975763970b839b700c0ff2e9f415c8def
|
||||
|
Loading…
Reference in new issue