From nobody Sun May 14 21:31:06 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 4QKFzt4MR7z49B6v; Sun, 14 May 2023 21:31:06 +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 4QKFzt3VMXz3wj8; Sun, 14 May 2023 21:31:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684099866; 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=KvYPMv5TzrbJ1cV3kbaCCO+mU9ujM5YFkmrOwm4+eTg=; b=ksEbHqxGFXyQFYyWJ2EmQZm3vMJ8U99M4+y852jn1AFxJAjVMPpEN0Dm7qAyIotP1nTXgN 3GdW9wtWRH/EIqag+w+JcO2O2lNua1h46OBNPbuT6ZcFCIZWKPdH+zP215riJk9e8clkcL YKq1moOnQSDS1LoCdaaYTx8EXAecT6clZnFAeLpgCOl9RT4WZcvo76xr5IrytWulbSpCe6 mDSMeB0JZkMH8RE1rq1wGaXtfP1bud8/5BX4n15DQ66mmJXIL/ROKoRL1YQ/siv9xpbZah g0zR/aVVbcgB9JXSweyK0RNo5oSd6dGGmSYLXhWPFnmOg2jptVVzgRvQy95pKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684099866; 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=KvYPMv5TzrbJ1cV3kbaCCO+mU9ujM5YFkmrOwm4+eTg=; b=Soy5VaJ2iudtkZ2gZFMl2JZbtSdX2w4NU5fKJucHeZTLYCuR3TEEFV73IYU/5CuXVTwdpk V7+o6SWLmISoxjO2DpO68hfz8WF+quMs4BR3otyZOSDEmmAf6ZfriVExKU6Fwp7JioidG3 swBKt+h7KaDSXJwd88fzTBwfnxV9ZPDMJdXF/1eLEcayj2lbG7Nj7gO9nyMNMkCLRsdibR d/6jRUkFcL+l7d9CfSOZ+al6nTUe/TugG3kYYZ14nr2vNezwIwmDyY4OxT8nFzYB37i2jy AW8UYxYGQdYij2+RBfdVhgyjAC2y14Fgjc9NsMJhWdDA3zGf1I2cZegtZ+lsMw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1684099866; a=rsa-sha256; cv=none; b=CIErTHaGphg7MzUY1fXmZugG4DMW/ApOk9uS+RV/sVImt3gQxHC8T6hQ096hr4nodA+uWl h1HOapzdcEOTBxlwt9Nsj8aBKD10ORUO0T9+cfRx4g44T39RnjoAm2MsZqpDjwAFMww6BC O4RxXyGZjarAhgMx0iDwkwI9wr0QtLMt+K8DvByeRm3C8x7v59cGY5MR+V1w+fNw984KA2 vP/+erEf9T1nCzbLmiNetK9AJsFupe2PVaxleA3sNztFaEy7xS/7wPYUFu080sjteYa3aF qJGTY+0pKoJPN53U1rc9QAteL6oWKZTlnMDPJg3jr5GbBFCVTadLsllYDoW6Yw== 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 4QKFzt2YBCzFg9; Sun, 14 May 2023 21:31:06 +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 34ELV6TT074038; Sun, 14 May 2023 21:31:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 34ELV6Y1074037; Sun, 14 May 2023 21:31:06 GMT (envelope-from git) Date: Sun, 14 May 2023 21:31:06 GMT Message-Id: <202305142131.34ELV6Y1074037@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: bf3a14b41a7b - main - linux(4): Fix stack unwinding on arm64 [1/2] 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: bf3a14b41a7bfe8357a4672a8f901cfc887f3862 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=bf3a14b41a7bfe8357a4672a8f901cfc887f3862 commit bf3a14b41a7bfe8357a4672a8f901cfc887f3862 Author: Dmitry Chagin AuthorDate: 2023-05-14 21:24:57 +0000 Commit: Dmitry Chagin CommitDate: 2023-05-14 21:24:57 +0000 linux(4): Fix stack unwinding on arm64 [1/2] An Aarch64 sigreturn trampoline frame can't currently be described in a DWARF .eh_frame section, because Aarch64 does not define a register number for PC and provide no direct way to encode PC of the previous frame. Instead, unwinders (libgcc, gdb, libunwind) detect the sigreturn frame by looking for the sigreturn instruction. If a sigreturn frame is detected, unwinders restores all the gprs, SP and PC by assuming that sp points to an rt_sigframe Linux kernel struct When entering the kernel, the link register (lr) contains the return address of the previous frame, the exception link register (elr) contains the address of the next instruction after the one which generated the exception, i.e., PC. MFC after: 1 week --- sys/arm64/linux/linux_sysvec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c index a49e41c21525..b2853d8e8359 100644 --- a/sys/arm64/linux/linux_sysvec.c +++ b/sys/arm64/linux/linux_sysvec.c @@ -295,7 +295,7 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) memcpy(&frame->sf.sf_uc.uc_sc.regs, tf->tf_x, sizeof(tf->tf_x)); frame->sf.sf_uc.uc_sc.regs[30] = tf->tf_lr; frame->sf.sf_uc.uc_sc.sp = tf->tf_sp; - frame->sf.sf_uc.uc_sc.pc = tf->tf_lr; + frame->sf.sf_uc.uc_sc.pc = tf->tf_elr; frame->sf.sf_uc.uc_sc.pstate = tf->tf_spsr; frame->sf.sf_uc.uc_sc.fault_address = (register_t)ksi->ksi_addr;