From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (wildebeest.demon.nl [212.238.236.112]) by sourceware.org (Postfix) with ESMTPS id B11363840C03 for ; Tue, 16 Jun 2020 22:26:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B11363840C03 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mark@klomp.org Received: from tarox.wildebeest.org (tarox.wildebeest.org [172.31.17.39]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 6A238317FC15; Wed, 17 Jun 2020 00:25:58 +0200 (CEST) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id 1F8E74024129; Wed, 17 Jun 2020 00:25:58 +0200 (CEST) From: Mark Wielaard To: elfutils-devel@sourceware.org Cc: Mark Wielaard Subject: [PATCH 05/10] libdwfl: Flag an error if CIE return_address_register is invalid. Date: Wed, 17 Jun 2020 00:25:34 +0200 Message-Id: <20200616222539.29109-5-mark@klomp.org> X-Mailer: git-send-email 2.18.4 In-Reply-To: <20200616222539.29109-1-mark@klomp.org> References: <20200616222539.29109-1-mark@klomp.org> X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jun 2020 22:26:02 -0000 If the CIE return address register is invalid (unknown) for the architecture immediately flag an error and return. Signed-off-by: Mark Wielaard --- libdwfl/ChangeLog | 5 +++++ libdwfl/frame_unwind.c | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 44b3ece7..5a3d566f 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,8 @@ +2020-06-16 Mark Wielaard + + * frame_unwind.c (handle_cfi): Flag an error if + return_address_register is invalid. + 2020-06-16 Mark Wielaard * linux-kernel-modules.c (try_kernel_name): Don't try other diff --git a/libdwfl/frame_unwind.c b/libdwfl/frame_unwind.c index d7dfa5a9..bdceeb3e 100644 --- a/libdwfl/frame_unwind.c +++ b/libdwfl/frame_unwind.c @@ -562,7 +562,11 @@ handle_cfi (Dwfl_Frame *state, Dwarf_Addr pc, Dwarf_CFI *cfi, Dwarf_Addr bias) /* The return register is special for setting the unwound->pc_state. */ unsigned ra = frame->fde->cie->return_address_register; bool ra_set = false; - ebl_dwarf_to_regno (ebl, &ra); + if (! ebl_dwarf_to_regno (ebl, &ra)) + { + __libdwfl_seterrno (DWFL_E_INVALID_REGISTER); + return; + } for (unsigned regno = 0; regno < nregs; regno++) { -- 2.18.4