Date: Fri, 2 Jul 2021 22:36:20 GMT From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 5866c369e4fd - main - Revert libunwind change to fix backtrace segfault on aarch64 Message-ID: <202107022236.162MaKva050351@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=5866c369e4fd917c0d456f0f10b92ee354b82279 commit 5866c369e4fd917c0d456f0f10b92ee354b82279 Author: Dimitry Andric <dim@FreeBSD.org> AuthorDate: 2021-07-02 22:35:42 +0000 Commit: Dimitry Andric <dim@FreeBSD.org> CommitDate: 2021-07-02 22:35:49 +0000 Revert libunwind change to fix backtrace segfault on aarch64 Revert commit 22b615a96593 from llvm git (by Daniel Kiss): [libunwind] Support for leaf function unwinding. Unwinding leaf function is useful in cases when the backtrace finds a leaf function for example when it caused a signal. This patch also add the support for the DW_CFA_undefined because it marks the end of the frames. Ryan Prichard provided code for the tests. Reviewed By: #libunwind, mstorsjo Differential Revision: https://reviews.llvm.org/D83573 Reland with limit the test to the x86_64-linux target. Bisection has shown that this particular upstream commit causes programs using backtrace(3) on aarch64 to segfault. This affects the lang/rust port, for instance. Until we can upstream to fix this problem, revert the commit for now. Reported by: mikael PR: 256864 --- contrib/llvm-project/libunwind/src/DwarfInstructions.hpp | 9 +-------- contrib/llvm-project/libunwind/src/DwarfParser.hpp | 3 +-- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/contrib/llvm-project/libunwind/src/DwarfInstructions.hpp b/contrib/llvm-project/libunwind/src/DwarfInstructions.hpp index c39cabe1f783..ee98f538d437 100644 --- a/contrib/llvm-project/libunwind/src/DwarfInstructions.hpp +++ b/contrib/llvm-project/libunwind/src/DwarfInstructions.hpp @@ -93,8 +93,7 @@ typename A::pint_t DwarfInstructions<A, R>::getSavedRegister( case CFI_Parser<A>::kRegisterInRegister: return registers.getRegister((int)savedReg.value); - case CFI_Parser<A>::kRegisterUndefined: - return 0; + case CFI_Parser<A>::kRegisterUnused: case CFI_Parser<A>::kRegisterOffsetFromCFA: // FIX ME @@ -118,7 +117,6 @@ double DwarfInstructions<A, R>::getSavedFloatRegister( case CFI_Parser<A>::kRegisterIsExpression: case CFI_Parser<A>::kRegisterUnused: - case CFI_Parser<A>::kRegisterUndefined: case CFI_Parser<A>::kRegisterOffsetFromCFA: case CFI_Parser<A>::kRegisterInRegister: // FIX ME @@ -142,7 +140,6 @@ v128 DwarfInstructions<A, R>::getSavedVectorRegister( case CFI_Parser<A>::kRegisterIsExpression: case CFI_Parser<A>::kRegisterUnused: - case CFI_Parser<A>::kRegisterUndefined: case CFI_Parser<A>::kRegisterOffsetFromCFA: case CFI_Parser<A>::kRegisterInRegister: // FIX ME @@ -193,10 +190,6 @@ int DwarfInstructions<A, R>::stepWithDwarf(A &addressSpace, pint_t pc, prolog.savedRegisters[i])); else return UNW_EBADREG; - } else if (i == (int)cieInfo.returnAddressRegister) { - // Leaf function keeps the return address in register and there is no - // explicit intructions how to restore it. - returnAddress = registers.getRegister(cieInfo.returnAddressRegister); } } diff --git a/contrib/llvm-project/libunwind/src/DwarfParser.hpp b/contrib/llvm-project/libunwind/src/DwarfParser.hpp index de0eb6de9d70..b41cc7bcfda2 100644 --- a/contrib/llvm-project/libunwind/src/DwarfParser.hpp +++ b/contrib/llvm-project/libunwind/src/DwarfParser.hpp @@ -69,7 +69,6 @@ public: }; enum RegisterSavedWhere { kRegisterUnused, - kRegisterUndefined, kRegisterInCFA, kRegisterOffsetFromCFA, kRegisterInRegister, @@ -503,7 +502,7 @@ bool CFI_Parser<A>::parseFDEInstructions(A &addressSpace, "malformed DW_CFA_undefined DWARF unwind, reg too big"); return false; } - results->setRegisterLocation(reg, kRegisterUndefined, initialState); + results->setRegisterLocation(reg, kRegisterUnused, initialState); _LIBUNWIND_TRACE_DWARF("DW_CFA_undefined(reg=%" PRIu64 ")\n", reg); break; case DW_CFA_same_value:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202107022236.162MaKva050351>