From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by sourceware.org (Postfix) with ESMTPS id D83863852C75 for ; Thu, 17 Nov 2022 20:27:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D83863852C75 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=googlemail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=googlemail.com Received: by mail-wr1-x429.google.com with SMTP id v1so5703198wrt.11 for ; Thu, 17 Nov 2022 12:27:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=BCp6i+phsXC2TnueqhBqJedmovIX4TUxz+TvEkFpIPA=; b=CnkQ0qjxovdV/ePeIEVXS0IyxawUSjjhXfzOcGsKghplO+MFm1HWl4Ios0G4/1vrhj UP9QL7q6VnKUXglErDgCVYXKQnG0kX/bRLSl3otaON9uEsGO7CFxv9evzGqLTlRkVNxa RKo9i1xp6uIxqZfaONLvooEOjlfNqXKPH5VOwJeKLS9oSp5UqS7ahntdrDC9dJp489BT PJ4R6GGTjLWODb5K2siUkIBOAFBj7jyTORuNkajfD4en1eQvJfNPOqZHbMQ0bKAxlKNC zEf08X81qfU8w0hOoH4SJpXo+rDYaEsnOJm/rt5Bl/xAwUm6d1Ly/vLnKg0gsZDYq3R/ YKxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BCp6i+phsXC2TnueqhBqJedmovIX4TUxz+TvEkFpIPA=; b=yAoKMhRdjRvIm/xIXj8yjR9Z8r9iv4W+k2gvgTWhum9opV2mg/kQ8mc0P7CUBb4P77 QFRy5Ri25jfR92Rylp0+GUJsnTccB0Mmv0tlLSvMj4aXgt+Ss0fa87BRrEP17k9od2I7 t1YS545jGZi7dz2gEPbxnTEhQrP1n5+hJzp9aRpuSeztW+tJeEvB8dwsK2oxQ7KU7hkE uN1Rwge57XyYBMvBuq56Hp5v5FjMTjW2fuQsl3kPQEBjv11MrcipNKNjp05bjxC4LusO eEgCRvgdcCvZdF27bU3/Zw23ImH/O/vg6aM9oSTGLT6G+9IofbCX+MS1cofn2WJA6m68 oehA== X-Gm-Message-State: ANoB5pkNyIk3WTNAzrJfcVyzgYRh6qNDGDKW+rvQ6uk99/jwWhs53baw E8oJPaqQiOdmZlGnKMt3Q1ymnrP+3rtLutMxXrA= X-Google-Smtp-Source: AA0mqf708Qf9Lhu8yQ6nANt9FDyycpw5Ysu03WPwLUVT6QMHypWAbzQuLXm1bthbM1e2BNc096PeGln3A/k/LDhflUA= X-Received: by 2002:adf:dc01:0:b0:241:b6d0:97e with SMTP id t1-20020adfdc01000000b00241b6d0097emr2425683wri.100.1668716856502; Thu, 17 Nov 2022 12:27:36 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Ramana Radhakrishnan Date: Thu, 17 Nov 2022 20:27:25 +0000 Message-ID: Subject: Re: [PATCH][GCC] arm: Add support for new frame unwinding instruction "0xb5". To: Srinath Parvathaneni Cc: gcc-patches@gcc.gnu.org, richard.earnshaw@arm.com, kyrylo.tkachov@arm.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, Nov 10, 2022 at 10:38 AM Srinath Parvathaneni via Gcc-patches wrote: > > Hi, > > This patch adds support for Arm frame unwinding instruction "0xb5" [1]. When > an exception is taken and "0xb5" instruction is encounter during runtime > stack-unwinding, we use effective vsp as modifier in pointer authentication. > On completion of stack unwinding if "0xb5" instruction is not encountered > then CFA will be used as modifier in pointer authentication. > > [1] https://github.com/ARM-software/abi-aa/releases/download/2022Q3/ehabi32.pdf > > Regression tested on arm-none-eabi target and found no regressions. > > Ok for master? > No, not yet. Presumably the logic to produce 0xb5 is in the source base and this was tested with suitable options that produce said opcode ? I see no logic in place to produce the said opcode in the backend in a quick read as the pacbti patches still seem to be in review. ? So what was the test suite run actually testing ? regards Ramana > Regards, > Srinath. > > gcc/ChangeLog: > > 2022-11-09 Srinath Parvathaneni > > * libgcc/config/arm/pr-support.c (__gnu_unwind_execute): Decode opcode > "0xb5". > > > ############### Attachment also inlined for ease of reply ############### > > > diff --git a/libgcc/config/arm/pr-support.c b/libgcc/config/arm/pr-support.c > index e48854587c667a959aa66ccc4982231f63333ecc..73e4942a39b34a83c2da85def6b13e82ec501552 100644 > --- a/libgcc/config/arm/pr-support.c > +++ b/libgcc/config/arm/pr-support.c > @@ -107,7 +107,9 @@ __gnu_unwind_execute (_Unwind_Context * context, __gnu_unwind_state * uws) > _uw op; > int set_pc; > int set_pac = 0; > + int set_pac_sp = 0; > _uw reg; > + _uw sp; > > set_pc = 0; > for (;;) > @@ -124,10 +126,11 @@ __gnu_unwind_execute (_Unwind_Context * context, __gnu_unwind_state * uws) > #if defined(TARGET_HAVE_PACBTI) > if (set_pac) > { > - _uw sp; > _uw lr; > _uw pac; > - _Unwind_VRS_Get (context, _UVRSC_CORE, R_SP, _UVRSD_UINT32, &sp); > + if (!set_pac_sp) > + _Unwind_VRS_Get (context, _UVRSC_CORE, R_SP, _UVRSD_UINT32, > + &sp); > _Unwind_VRS_Get (context, _UVRSC_CORE, R_LR, _UVRSD_UINT32, &lr); > _Unwind_VRS_Get (context, _UVRSC_PAC, R_IP, > _UVRSD_UINT32, &pac); > @@ -259,7 +262,19 @@ __gnu_unwind_execute (_Unwind_Context * context, __gnu_unwind_state * uws) > continue; > } > > - if ((op & 0xfc) == 0xb4) /* Obsolete FPA. */ > + /* Use current VSP as modifier in PAC validation. */ > + if (op == 0xb5) > + { > + if (set_pac) > + _Unwind_VRS_Get (context, _UVRSC_CORE, R_SP, _UVRSD_UINT32, > + &sp); > + else > + return _URC_FAILURE; > + set_pac_sp = 1; > + continue; > + } > + > + if ((op & 0xfd) == 0xb6) /* Obsolete FPA. */ > return _URC_FAILURE; > > /* op & 0xf8 == 0xb8. */ > > >