public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrea Corallo <andrea.corallo@arm.com>
To: Andrea Corallo via Gcc-patches <gcc-patches@gcc.gnu.org>
Cc: nd <nd@arm.com>, Richard Earnshaw <Richard.Earnshaw@arm.com>
Subject: Re: [PATCH] [1/2] arm: Implement cortex-M return signing address codegen
Date: Wed, 24 Nov 2021 11:08:18 +0100	[thread overview]
Message-ID: <gkr5yshg92l.fsf@arm.com> (raw)
In-Reply-To: <gkrlf23f0hp.fsf@arm.com> (Andrea Corallo via Gcc-patches's message of "Fri, 5 Nov 2021 09:52:18 +0100")

Andrea Corallo via Gcc-patches <gcc-patches@gcc.gnu.org> writes:

> Hi all,
>
> this patch enables address return signature and verification based on
> Armv8.1-M Pointer Authentication [1].
>
> To sign the return address, we use the PAC R12, LR, SP instruction
> upon function entry.  This is signing LR using SP and storing the
> result in R12.  R12 will be pushed into the stack.
>
> During function epilogue R12 will be popped and AUT R12, LR, SP will
> be used to verify that the content of LR is still valid before return.
>
> Here an example of PAC instrumented function prologue and epilogue:
>
>         pac     r12, lr, sp
>         push    {r3, r7, lr}
>         push    {r12}
>         sub     sp, sp, #4
>         [...] function body
>         add     sp, sp, #4
>         pop     {r12}
>         pop     {r3, r7, lr}
>         aut     r12, lr, sp
>         bx      lr
>
> The patch also takes care of generating a PACBTI instruction in place
> of the sequence BTI+PAC when Branch Target Identification is enabled
> contextually.
>
> These two patches apply on top of Tejas series posted here [2].
>
> Regressioned and arm-linux-gnu aarch64-linux-gnu bootstraped.
>
> Best Regards
>
>   Andrea
>
> [1] <https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/armv8-1-m-pointer-authentication-and-branch-target-identification-extension>
> [2] <https://gcc.gnu.org/pipermail/gcc-patches/2021-October/581176.html>

Ping

Best Regards

  Andrea

  reply	other threads:[~2021-11-24 10:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-05  8:52 Andrea Corallo
2021-11-24 10:08 ` Andrea Corallo [this message]
2021-12-08 10:33   ` Andrea Corallo
2021-12-08 11:31 ` Richard Earnshaw
2021-12-17 15:52   ` Andrea Corallo
2021-12-17 16:55     ` Richard Earnshaw
2021-12-17 17:22       ` Andrea Corallo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=gkr5yshg92l.fsf@arm.com \
    --to=andrea.corallo@arm.com \
    --cc=Richard.Earnshaw@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=nd@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).