clang -fret-clean on the horizon for OpenBSD/arm64

Author:
Source

While we were busy with other things, Theo de Raadt (deraadt@) is continuing the work on bringing the clang option to clean return addresses off the stack, as reported upon earlier, to OpenBSD/arm64.

Theo posted an early version of the code to tech@, saying

List:       openbsd-tech
Subject:    arm64 -fret-clean attempt
From:       "Theo de Raadt" <deraadt () openbsd ! org>
Date:       2024-07-02 5:50:45

I've been trying to write -fret-clean for arm64.

On a return-stack architecture like amd64, the callee has to clean up the
word on the stack upon return.

arm64, like some other risc architectures, is a link-register architecture.
In this case, the return address is saved in some temporary location by
the caller, who loads it into the link register before returning.  Before
that moment, the caller has to clean it up.

Read more…

Read more