From owner-dev-commits-src-main@freebsd.org Fri Jul 2 22:36:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9AE1A673C9F; Fri, 2 Jul 2021 22:36:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GGqgS3kl7z4XJJ; Fri, 2 Jul 2021 22:36:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 688A21C709; Fri, 2 Jul 2021 22:36:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 162MaKhI050352; Fri, 2 Jul 2021 22:36:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 162MaKva050351; Fri, 2 Jul 2021 22:36:20 GMT (envelope-from git) Date: Fri, 2 Jul 2021 22:36:20 GMT Message-Id: <202107022236.162MaKva050351@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: 5866c369e4fd - main - Revert libunwind change to fix backtrace segfault on aarch64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5866c369e4fd917c0d456f0f10b92ee354b82279 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Jul 2021 22:36:20 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=5866c369e4fd917c0d456f0f10b92ee354b82279 commit 5866c369e4fd917c0d456f0f10b92ee354b82279 Author: Dimitry Andric AuthorDate: 2021-07-02 22:35:42 +0000 Commit: Dimitry Andric 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::getSavedRegister( case CFI_Parser::kRegisterInRegister: return registers.getRegister((int)savedReg.value); - case CFI_Parser::kRegisterUndefined: - return 0; + case CFI_Parser::kRegisterUnused: case CFI_Parser::kRegisterOffsetFromCFA: // FIX ME @@ -118,7 +117,6 @@ double DwarfInstructions::getSavedFloatRegister( case CFI_Parser::kRegisterIsExpression: case CFI_Parser::kRegisterUnused: - case CFI_Parser::kRegisterUndefined: case CFI_Parser::kRegisterOffsetFromCFA: case CFI_Parser::kRegisterInRegister: // FIX ME @@ -142,7 +140,6 @@ v128 DwarfInstructions::getSavedVectorRegister( case CFI_Parser::kRegisterIsExpression: case CFI_Parser::kRegisterUnused: - case CFI_Parser::kRegisterUndefined: case CFI_Parser::kRegisterOffsetFromCFA: case CFI_Parser::kRegisterInRegister: // FIX ME @@ -193,10 +190,6 @@ int DwarfInstructions::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::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: