From nobody Sat Jul 1 07:52:24 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QtPY43CK7z4kjyb; Sat, 1 Jul 2023 07:52:24 +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 4QtPY42gQGz3xnX; Sat, 1 Jul 2023 07:52:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688197944; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NudrRo+tz6gW7SltPDZdIErMkUA+38/tJSLBaYyNvsc=; b=BYG2X0PudmVQbDYazMFFQ5fM3i64fFKML8NVJ+oJa42uxZ3CiSPBQAkgWoD8Sm3+9ok8Y8 +sNIrPPGQokK4PsuSihilZjF7Y57Z/NKPrW+6x67Pbdz1MFUCMc39ljoA9Njzlhus75HhK 223ARg81e1FteQG5J9RxUNmbUDM3tJQHbpgacp6pwB3dcrZ1n+2oWJm55ekz1fwewnADE5 HBqC9ECIAl97zBmqHWs60FwqzGE8Qfvmy95v0q0eoisG+2I6ZJSxfr4RzVOVjR4d7ASRZV 9qJpM56N2j1Ybu7UZRGcFfZx2gjDYuCM4lqrNhFpemakaV344pksQsNnM/8y3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688197944; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NudrRo+tz6gW7SltPDZdIErMkUA+38/tJSLBaYyNvsc=; b=Oc2Pp848JkohvIF6RKitIk5lnIc6BR6tLm9gbW7nwVwuHGuW8szSVw/OcS+2CVdMdnuQ4J I0ZG230GmeJ2KdubUDHtwXZdgZ/p5g524lAKjgGuXeZqCqy4eZYNOyMQ7HvrEWn5w/fwD/ lxSqgyI8LJ18pkNqL6IKrKv9ykFLyFLZ1hj5BA+bzos4kRX2MMbd0dUK+xggn45XKR5qe+ PPmTi95dFIRV0VHynzMNfHgV+ij57x23jAH3A9eCdqs9LNo7b1BAdwjgPcLqOnrp9r2bEf Huu6+tlAiZOqSQ6T/W9CK+IRqD6Yxh+T8TI05ZERy06vyOClGxwNRoCKuLiyHg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1688197944; a=rsa-sha256; cv=none; b=HdMAjTdjN03tpDNa712oENRHF115r16QuWKo6q9qpHKLaIcp+j55+5z1t8TNXhv/+TwaVB SvQjs7lrxUTCOlsonGe7yFzJnmvm+O+obzWhph37WSGTz0X2wv7AlagSP3XhsHSfM+pw+9 ae6KmdZEs/aYQ8KYZt0IcTwoi5mVPC1QjH7OhOHt/kbXSEnzdpR4hkIwKsNaex7DkLIBCg FBhLgxlKabkv5yXgAXkLE5yX4dbR0dp9cxFzcSIPJsy/XBnJDTLd4NCzLpbTAb2XR4v+I5 RoQfpN2UV2jrEfi/GI05Ydbbc1xvwpG33q3e5rWOXJ1hsJhISXCwtuptMR9oSA== 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 4QtPY41j5fzHrS; Sat, 1 Jul 2023 07:52:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3617qOdP023810; Sat, 1 Jul 2023 07:52:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3617qOLF023809; Sat, 1 Jul 2023 07:52:24 GMT (envelope-from git) Date: Sat, 1 Jul 2023 07:52:24 GMT Message-Id: <202307010752.3617qOLF023809@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 3bdf68086de8 - main - rtld: Add a stop indicator to rtld_start to satisfy unwinders on x86_64 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3bdf68086de8bee79f09cba28fd0df3be6565216 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=3bdf68086de8bee79f09cba28fd0df3be6565216 commit 3bdf68086de8bee79f09cba28fd0df3be6565216 Author: Dmitry Chagin AuthorDate: 2023-07-01 07:51:35 +0000 Commit: Dmitry Chagin CommitDate: 2023-07-01 07:51:35 +0000 rtld: Add a stop indicator to rtld_start to satisfy unwinders on x86_64 The right unwinding stop indicator should be CFI-undefined PC. https://dwarfstd.org/doc/Dwarf3.pdf - page 118: If a Return Address register is defined in the virtual unwind table, and its rule is undefined (for example, by DW_CFA_undefined), then there is no return address and no call address, and the virtual unwind of stack activations is complete. That is allows gdb and libunwind successfully stop when unwinding stack from global constructors and destructors. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D40794 --- libexec/rtld-elf/amd64/rtld_start.S | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libexec/rtld-elf/amd64/rtld_start.S b/libexec/rtld-elf/amd64/rtld_start.S index 72240a92c063..5b5cb2ccb47f 100644 --- a/libexec/rtld-elf/amd64/rtld_start.S +++ b/libexec/rtld-elf/amd64/rtld_start.S @@ -30,14 +30,18 @@ .globl .rtld_start .type .rtld_start,@function .rtld_start: + .cfi_startproc + .cfi_undefined %rip xorq %rbp,%rbp # Clear frame pointer for good form subq $24,%rsp # A place to store exit procedure addr + .cfi_def_cfa_offset 32 movq %rdi,%r12 movq %rsp,%rsi # save address of exit proc movq %rsp,%rdx # construct address of obj_main addq $8,%rdx call _rtld # Call rtld(sp); returns entry point popq %rsi # Get exit procedure address + .cfi_def_cfa_offset 24 movq %r12,%rdi # *ap /* * At this point, %rax contains the entry point of the main program, and @@ -47,6 +51,7 @@ .globl .rtld_goto_main .rtld_goto_main: # This symbol exists just to make debugging easier. jmp *%rax # Enter main program + .cfi_endproc /*