From nobody Sun May 14 21:57:55 2023 X-Original-To: dev-commits-src-all@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 4QKGb44SWqz49CZX for ; Sun, 14 May 2023 21:58:08 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QKGb412PQz4166 for ; Sun, 14 May 2023 21:58:08 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-307d84f5ce4so2951207f8f.2 for ; Sun, 14 May 2023 14:58:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684101486; x=1686693486; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6Sf3nZaPeuxLTNp/9lHvaej1wKVlGYOwX6VpiJ9I82I=; b=actW17z8zLS9spv6e9hT+6yLzWT2cR0yNaga5C1Ygn5nrzQf8K/DbWvT4xQbhUCNnt nkML2gkaEr3vObnDmxLDZUD4ywlrlyRYzf4+vHn7SkLEjr42OJ3m3SrNBRCRi/zGR7da sKRxJ/7QLyow49NHesPmhpeM+zOuIC+TdlEKqQylhcwq8t03eFVB4PXyDx3bo2npp1nw Gib3WrZHwmryq2V9L9AoFqlVhSua2R/ECPTVy5IZVEd5IYSI8a+kR05+2Jlr7U20ue4G tUZA836hVB1Bh2ts5issjyyfJ6eaVHLxlVjV3Lgzol3myCqSJDTSsYzJqKFPPjhl4Ati 3vNA== X-Gm-Message-State: AC+VfDzsGqY90BC8pbuuEFQEI9xjYYeUGtstlN4MM+YDmEZVRluWdqL1 6JugEw2OY8rTxRiRe3v6Wci3W+Rblu6M8642zcfZiw== X-Google-Smtp-Source: ACHHUZ6rHNYhrzlsrgqtUx2v3HSdzytQVFD9SwwhGIv74JbWZEMBIJJC2BwxvcueBgAIGXfWmrChkQ== X-Received: by 2002:adf:f302:0:b0:306:3b78:fe33 with SMTP id i2-20020adff302000000b003063b78fe33mr21453356wro.32.1684101486505; Sun, 14 May 2023 14:58:06 -0700 (PDT) Received: from smtpclient.apple ([131.111.5.246]) by smtp.gmail.com with ESMTPSA id j10-20020adff54a000000b00304b5b2f5ffsm30378306wrp.53.2023.05.14.14.58.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 May 2023 14:58:06 -0700 (PDT) Content-Type: text/plain; charset=utf-8 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.500.231\)) Subject: Re: git: d957343f8713 - main - linux(4): Rework signal trampoline on Aarch64 From: Jessica Clarke In-Reply-To: <202305142131.34ELV9OX074101@gitrepo.freebsd.org> Date: Sun, 14 May 2023 22:57:55 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <202305142131.34ELV9OX074101@gitrepo.freebsd.org> To: Dmitry Chagin X-Mailer: Apple Mail (2.3731.500.231) X-Rspamd-Queue-Id: 4QKGb412PQz4166 X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N On 14 May 2023, at 22:31, Dmitry Chagin wrote: >=20 > The branch main has been updated by dchagin: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3Dd957343f8713a312442a0140b7a7752e= d7b2d870 >=20 > commit d957343f8713a312442a0140b7a7752ed7b2d870 > Author: Dmitry Chagin > AuthorDate: 2023-05-14 21:27:31 +0000 > Commit: Dmitry Chagin > CommitDate: 2023-05-14 21:27:31 +0000 >=20 > linux(4): Rework signal trampoline on Aarch64 >=20 > To avoid clobbering of any registers by the trampoline code use = Linux > way to call signal handlers. I.e., we are out from the kernel right = into > the signal handler, put return address from the signal handler into = the > link register. > The mysterious NOP is required for some unwinders (e.g. libc++) = that > unconditionally subtract one from the result of _Unwind_GetIP() in = order > to identify the calling function. >=20 > MFC after: 1 week So this is basically a revert of c56480a83235 "linux(4): Implement = signal trampoline for arm64 in a FreeBSD-way=E2=80=9D? Not a huge fan of this = flip-flopping without much justification and with no review. Jess > --- > sys/arm64/linux/linux_locore.asm | 5 +++-- > sys/arm64/linux/linux_sysvec.c | 6 +++--- > sys/arm64/linux/linux_vdso.lds.s | 1 + > 3 files changed, 7 insertions(+), 5 deletions(-) >=20 > diff --git a/sys/arm64/linux/linux_locore.asm = b/sys/arm64/linux/linux_locore.asm > index 6ebecef51b39..de3e5dd52a00 100644 > --- a/sys/arm64/linux/linux_locore.asm > +++ b/sys/arm64/linux/linux_locore.asm > @@ -45,10 +45,11 @@ linux_platform: >=20 > .text >=20 > - nop /* This is what Linux calls a "Mysterious NOP". */ > EENTRY(__kernel_rt_sigreturn) > - blr x8 > + nop /* This is what Linux calls a "Mysterious NOP". */ >=20 > + .globl __user_rt_sigreturn > +__user_rt_sigreturn: > mov x8, #LINUX_SYS_linux_rt_sigreturn > svc #0 > EEND(__kernel_rt_sigreturn) > diff --git a/sys/arm64/linux/linux_sysvec.c = b/sys/arm64/linux/linux_sysvec.c > index 299586e1c7b6..bb9ff25893eb 100644 > --- a/sys/arm64/linux/linux_sysvec.c > +++ b/sys/arm64/linux/linux_sysvec.c > @@ -118,7 +118,7 @@ LIN_SDT_PROBE_DEFINE0(sysvec, linux_exec_setregs, = todo); >=20 > LINUX_VDSO_SYM_CHAR(linux_platform); > LINUX_VDSO_SYM_INTPTR(kern_timekeep_base); > -LINUX_VDSO_SYM_INTPTR(__kernel_rt_sigreturn); > +LINUX_VDSO_SYM_INTPTR(__user_rt_sigreturn); >=20 > static int > linux_fetch_syscall_args(struct thread *td) > @@ -353,9 +353,9 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, = sigset_t *mask) > tf->tf_x[2] =3D 0; > } > tf->tf_x[29] =3D (register_t)&fp->fp; > - tf->tf_x[8] =3D (register_t)catcher; > + tf->tf_elr =3D (register_t)catcher; > tf->tf_sp =3D (register_t)fp; > - tf->tf_elr =3D (register_t)__kernel_rt_sigreturn; > + tf->tf_lr =3D (register_t)__user_rt_sigreturn; >=20 > CTR3(KTR_SIG, "sendsig: return td=3D%p pc=3D%#x sp=3D%#x", td, = tf->tf_elr, > tf->tf_sp); > diff --git a/sys/arm64/linux/linux_vdso.lds.s = b/sys/arm64/linux/linux_vdso.lds.s > index 652b99545069..3f6b70c09176 100644 > --- a/sys/arm64/linux/linux_vdso.lds.s > +++ b/sys/arm64/linux/linux_vdso.lds.s > @@ -70,6 +70,7 @@ VERSION > global: > linux_platform; > kern_timekeep_base; > + __user_rt_sigreturn; > local: *; > }; > } Jess