Skip to content

Commit

Permalink
Add upstream libunwind PR 308 as a patch
Browse files Browse the repository at this point in the history
  • Loading branch information
ararslan committed Nov 6, 2021
1 parent f89a6e1 commit 0700c6d
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 26 deletions.
2 changes: 1 addition & 1 deletion deps/Versions.make
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ LIBSUITESPARSE_JLL_NAME := SuiteSparse
# unwind
UNWIND_VER := 1.5.0
UNWIND_JLL_NAME := LibUnwind
UNWIND_JLL_VER := 1.5.0+0
UNWIND_JLL_VER := 1.5.0+1

# zlib
ZLIB_VER := 1.2.11
Expand Down
48 changes: 24 additions & 24 deletions deps/checksums/unwind
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
LibUnwind.v1.5.0+0.aarch64-linux-gnu.tar.gz/md5/f3b0f232bd6a61d9e6c53e2586341730
LibUnwind.v1.5.0+0.aarch64-linux-gnu.tar.gz/sha512/d5279678e375cf1d8ec80adc8ef624666cdf0eb456814bf4e56dde9db9c8b8cab47e626f631633b8c489a9aab51d7469555309536178f398c101edf38701ca69
LibUnwind.v1.5.0+0.aarch64-linux-musl.tar.gz/md5/4dd218a6a98b98f3da67d70ea0748d77
LibUnwind.v1.5.0+0.aarch64-linux-musl.tar.gz/sha512/20729bf372ff5691a3d4c2459c6ea9445c71d4148e8532afff03a20a0c2bf86df5478af458e7250ea26d5130abb4337bc86c8d981a55051af3894f371872c200
LibUnwind.v1.5.0+0.armv6l-linux-gnueabihf.tar.gz/md5/dd7e5f2f609a4502e3e30c658dd801af
LibUnwind.v1.5.0+0.armv6l-linux-gnueabihf.tar.gz/sha512/55e519131c66c25e1d0e91388c78f9ac9738e2b78c63af621f5c8c6e065269484f3c4e393521b59bc2b2e43ef19fbf89e509d51f4863d1e581772bbb2e8e64ae
LibUnwind.v1.5.0+0.armv6l-linux-musleabihf.tar.gz/md5/c66e7dbb8f5be459dad02b5c121ccffc
LibUnwind.v1.5.0+0.armv6l-linux-musleabihf.tar.gz/sha512/9e3630191e96b983e27b41f27e41a49f04b3dd97b29e143f48ce66f46b559415dabafc4ce76dc682e6539ddd1461b79a9dc1bf0e2b42c79aea4804031bf69aa4
LibUnwind.v1.5.0+0.armv7l-linux-gnueabihf.tar.gz/md5/ae83a78342ecda24c7fac0ee808d2b6f
LibUnwind.v1.5.0+0.armv7l-linux-gnueabihf.tar.gz/sha512/706cbe6283848abe99e37c221820250a0152a5e57d32c3717bc45dd2057d095b37dc8c94eb22d345f629f133b7f62c9b6cb14eadbfa23a21a4984fd10ed3bbe8
LibUnwind.v1.5.0+0.armv7l-linux-musleabihf.tar.gz/md5/1ffc08d9dc691a63a90b9f1d13b3f000
LibUnwind.v1.5.0+0.armv7l-linux-musleabihf.tar.gz/sha512/811fcc4644daf53a49efbdf4a0eed0fb9e30b186302eff16219466f12e5497115cb97123e4cf00c1debeb6c4fc98dcff31347055fdc7f559df274f382d2f26d7
LibUnwind.v1.5.0+0.i686-linux-gnu.tar.gz/md5/3af2f193486d2a90da845a282e198794
LibUnwind.v1.5.0+0.i686-linux-gnu.tar.gz/sha512/83075b5d0b676795171c4d19010348606c822dbd2265730a65ba83188384938f2ab68eba353115ffe0b4c84f29957151bb417c1d1d49f2fe050d9f9a642da506
LibUnwind.v1.5.0+0.i686-linux-musl.tar.gz/md5/c0b74c9dc759a53dbef415952dd8e0b9
LibUnwind.v1.5.0+0.i686-linux-musl.tar.gz/sha512/1f033c73137e1b97009bd6f73cb6f24c2aebd718b9a0bcba4d27356ce48cd86bd563fc11bc1b333d2b367243344973b01f9185ac54639b0f9996cd9b8cb5df20
LibUnwind.v1.5.0+0.powerpc64le-linux-gnu.tar.gz/md5/34341404ff592fb25f2588e72011adf6
LibUnwind.v1.5.0+0.powerpc64le-linux-gnu.tar.gz/sha512/f8c849c0c302eeedeccea8e46427d5364911681241f0d59ded42aa46769a9bfef93d756ec539838f8e7920a59df7aa7a3a820524998231fc22e6bed5a45db5fc
LibUnwind.v1.5.0+0.x86_64-linux-gnu.tar.gz/md5/ceceb95566b8ed0991b4b7f400fe559e
LibUnwind.v1.5.0+0.x86_64-linux-gnu.tar.gz/sha512/e48d51ea8703c4c113fd6e9fc60ca6b7cd0b0b0500d7dc15e2644208a43c28ba99fed4265d27c7c318f92f5e04bdabc43de0666a18bf1979e07353aebfb41b46
LibUnwind.v1.5.0+0.x86_64-linux-musl.tar.gz/md5/21b3b0aaea4ee69206b891cbd53c0f4c
LibUnwind.v1.5.0+0.x86_64-linux-musl.tar.gz/sha512/0ed1a5febc7c2b65e6d4f63e598826a2a9292496b70c520762f6aa92171fb8474f353c99f91cb9afaf8504db9fb53801872814e8ec383a76700cd57abd97fb02
LibUnwind.v1.5.0+0.x86_64-unknown-freebsd.tar.gz/md5/39fdeff14b1d1b9870022bc744d00500
LibUnwind.v1.5.0+0.x86_64-unknown-freebsd.tar.gz/sha512/4352b4558e85dbc972ad6247b18dfb5b8957f1e1689c9ce747b441a8173b6cd9536622419baa82e40f3913f7624e8a4ea795e54d5cbce9f819d820681a0dcaa3
LibUnwind.v1.5.0+1.aarch64-linux-gnu.tar.gz/md5/4f27fbe5a0e0897d75e3690e2f24c10b
LibUnwind.v1.5.0+1.aarch64-linux-gnu.tar.gz/sha512/fad4ac07121823859bf6af322c0d3b52b353b1e7b2a12611dc14bfc18663fc4278a4eab61653b306bf07abfff8dc92ef07d55b24117d8ccc5a8662139b5301a1
LibUnwind.v1.5.0+1.aarch64-linux-musl.tar.gz/md5/730455d3e334b61e9232f978a5ba9841
LibUnwind.v1.5.0+1.aarch64-linux-musl.tar.gz/sha512/64a04b6d362774c5dc9534a49b58ea676cb514fc10ce0747cd79d5319841e9b0695701c631a2598499d2fa888d36a89f0560f7910d01fa4c7e2fc223a2143a8d
LibUnwind.v1.5.0+1.armv6l-linux-gnueabihf.tar.gz/md5/e335c0eb5fd97e870400f472ed163722
LibUnwind.v1.5.0+1.armv6l-linux-gnueabihf.tar.gz/sha512/4211fa7a4a08631a335a327cda511272527ff590507819dc9ee89ec1db7a7603c1ce9dcfcb22950acb4246fef297493eccd5260fb76d9929c84cc9c755381849
LibUnwind.v1.5.0+1.armv6l-linux-musleabihf.tar.gz/md5/d8b094c08d496b45cf5e4f6f964caa43
LibUnwind.v1.5.0+1.armv6l-linux-musleabihf.tar.gz/sha512/0fe159785b8f35ae5b8301754ed244f687156a9565fe2d6d6c72e8b4e0c04c26183079b69093ab4fec9de4bd8b69d248a1569d8fc539ef04787ed09d36e41bdd
LibUnwind.v1.5.0+1.armv7l-linux-gnueabihf.tar.gz/md5/55289aa21e11f8fa3867dd650f863b2d
LibUnwind.v1.5.0+1.armv7l-linux-gnueabihf.tar.gz/sha512/e669616bc1be3b34552b9927279e0b43df1e5ab0e72659a9e128d894df6b46d10f7d72b30eb5ad3355f01776a5f5250195633b846747fdbaefd2ac69915157fc
LibUnwind.v1.5.0+1.armv7l-linux-musleabihf.tar.gz/md5/5a99cca618b56961b7108c618f8704c4
LibUnwind.v1.5.0+1.armv7l-linux-musleabihf.tar.gz/sha512/7465262f611ff347fa57a910019e4a243451d801edf1fd9bb19a5f2ab9e9b84885da26781af18c1405347918e74b21b4f0a308d938cd3198b6260e0df8b5bc6b
LibUnwind.v1.5.0+1.i686-linux-gnu.tar.gz/md5/bd52e05f513c8b86d8b71a9f833bde57
LibUnwind.v1.5.0+1.i686-linux-gnu.tar.gz/sha512/750a082730c35b11cc1745a05e140bd83fd7511560ac90e15b472383b60b4641285b959a1a0897e2c6cb6bbf3857497ef7164642bfc79660c9c681cda189f530
LibUnwind.v1.5.0+1.i686-linux-musl.tar.gz/md5/41482181efe7218a6aae785b76ad4d62
LibUnwind.v1.5.0+1.i686-linux-musl.tar.gz/sha512/e1212ecc9efe16fc7401b1abafd3ab55c435a868e9a5408a4d9ca0039c4c422fb635314ae8d69913d4699a52ae070dc12db9cbb95d18f6e4fa41dd5047b22049
LibUnwind.v1.5.0+1.powerpc64le-linux-gnu.tar.gz/md5/fa9dafea4ad00266188a310294b9342e
LibUnwind.v1.5.0+1.powerpc64le-linux-gnu.tar.gz/sha512/d90370601804b477f588fbeba549a197150fc080ccee112b0e93a00393d03b7908a5f8ceed1a33c6ea8860c0f88c0d1e05a676336c948897f518d6130c480f5e
LibUnwind.v1.5.0+1.x86_64-linux-gnu.tar.gz/md5/57b35a4b10407daf0e06c32acb942c0f
LibUnwind.v1.5.0+1.x86_64-linux-gnu.tar.gz/sha512/0ab66f46a0b947c29d9ac76b1b10591435a9098e1a93b99eb64444c9fabd97439764a0fd1483ee5e26c2f617ca97d3929184bcbb9f1f2778ad109a9fb07d2daa
LibUnwind.v1.5.0+1.x86_64-linux-musl.tar.gz/md5/7116a5228632a6f96bfc979d72ad530d
LibUnwind.v1.5.0+1.x86_64-linux-musl.tar.gz/sha512/20c18da77864985ba8bb0a5857c23b807730de354d2fd0504b627e53a2d8763a72c2ebb5ac8bb7615f4a66a27937c12e89619489893b4ee17c3fea8acd12c704
LibUnwind.v1.5.0+1.x86_64-unknown-freebsd.tar.gz/md5/79bb8128f52068faf1cb8e82f39272dc
LibUnwind.v1.5.0+1.x86_64-unknown-freebsd.tar.gz/sha512/c60a09be8d945d7309e219e830f7cebcb11b7924b9d98ea4b0a93730ed4c2eda846bd0f043cdb225c86cc576d5708fd4f4fbe1324c7b71e47a02ae1d42c7e47f
libunwind-1.5.0.tar.gz/md5/c6923dda0675f6a4ef21426164dc8b6a
libunwind-1.5.0.tar.gz/sha512/1df20ca7a8cee2f2e61294fa9b677e88fec52e9d5a329f88d05c2671c69fa462f6c18808c97ca9ff664ef57292537a844f00b18d142b1938c9da701ca95a4bab
36 changes: 36 additions & 0 deletions deps/patches/libunwind-dwarf-table.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
From a5b5fd28ed03cb1ab524d24dc534c1fa167bf5a1 Mon Sep 17 00:00:00 2001
From: Alex Arslan <ararslan@comcast.net>
Date: Fri, 5 Nov 2021 16:58:41 -0700
Subject: [PATCH] Fix table indexing in `dwarf_search_unwind_table`

`table_len` is used as an index into `table`, assuming it represents the
number of entries. However, it is defined as the number of entries
multiplied by `sizeof(unw_word_t)`. This is accounted for in other
places that use `table_len`, e.g. in `lookup`, which divides out the
size of `unw_word_t`, but the indexing expression uses `table_len`
directly. So when `table` has say 2 entries, we're actually looking at
index 15 rather than 1 in the comparison. This can cause the conditional
to erroneously evaluate to true, allowing the following line to
segfault.

This was observed with JIT compiled code from Julia with LLVM on
FreeBSD.

Co-Authored-By: Jameson Nash <vtjnash@gmail.com>
---
src/dwarf/Gfind_proc_info-lsb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/dwarf/Gfind_proc_info-lsb.c b/src/dwarf/Gfind_proc_info-lsb.c
index 5e27a501..af4cbce8 100644
--- a/src/dwarf/Gfind_proc_info-lsb.c
+++ b/src/dwarf/Gfind_proc_info-lsb.c
@@ -866,7 +866,7 @@ dwarf_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
if (as == unw_local_addr_space)
{
e = lookup (table, table_len, ip - ip_base);
- if (e && &e[1] < &table[table_len])
+ if (e && &e[1] < &table[table_len / sizeof (unw_word_t)])
last_ip = e[1].start_ip_offset + ip_base;
else
last_ip = di->end_ip;
6 changes: 5 additions & 1 deletion deps/unwind.mk
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ $(SRCCACHE)/libunwind-$(UNWIND_VER)/libunwind-cfa-rsp.patch-applied: $(SRCCACHE)
cd $(SRCCACHE)/libunwind-$(UNWIND_VER) && patch -p1 -f -u < $(SRCDIR)/patches/libunwind-cfa-rsp.patch
echo 1 > $@

$(BUILDDIR)/libunwind-$(UNWIND_VER)/build-configured: $(SRCCACHE)/libunwind-$(UNWIND_VER)/source-extracted $(SRCCACHE)/libunwind-$(UNWIND_VER)/libunwind-cfa-rsp.patch-applied
$(SRCCACHE)/libunwind-$(UNWIND_VER)/libunwind-dwarf-table.patch-applied: $(SRCCACHE)/libunwind-$(UNWIND_VER)/libunwind-cfa-rsp.patch-applied
cd $(SRCCACHE)/libunwind-$(UNWIND_VER) && patch -p1 -f -u -l < $(SRCDIR)/patches/libunwind-dwarf-table.patch
echo 1 > $@

$(BUILDDIR)/libunwind-$(UNWIND_VER)/build-configured: $(SRCCACHE)/libunwind-$(UNWIND_VER)/source-extracted $(SRCCACHE)/libunwind-$(UNWIND_VER)/libunwind-dwarf-table.patch-applied
mkdir -p $(dir $@)
cd $(dir $@) && \
$(dir $<)/configure $(CONFIGURE_COMMON) CPPFLAGS="$(CPPFLAGS) $(LIBUNWIND_CPPFLAGS)" CFLAGS="$(CFLAGS) $(LIBUNWIND_CFLAGS)" --enable-shared --disable-minidebuginfo --disable-tests --disable-zlibdebuginfo
Expand Down

0 comments on commit 0700c6d

Please sign in to comment.