Skip to content

Conversation

@avagin
Copy link
Member

@avagin avagin commented Aug 15, 2025

Branch protection uses PAC. It cryptographically "signs" a function's return address before it is stored on the stack. Upon return, the address is authenticated using a secret key. If the signature is invalid, the program will fault.

The PIE code is used for the parasite and the restorer. In both cases, it runs in a foreign process. The case of the restorer is even trickier because it needs to restore the original PAC keys, which invalidates all previously "signed" pointers within the restorer itself.

Fixes #2709

@rst0git
Copy link
Member

rst0git commented Aug 15, 2025

@avagin Compiling CRIU with this patch fails on Debian 10 / Raspbian 10 with the following error:

gcc: error: unrecognized command line option '-mbranch-protection=none'; did you mean '-fcf-protection=none'?

The branch-protection option was introduced relatively recently and these distributions use gcc 8.3.0.
https://gcc.gnu.org/pipermail/gcc-patches/2022-April/593736.html

Branch protection uses PAC. It cryptographically "signs" a function's
return address before it is stored on the stack. Upon return, the address
is authenticated using a secret key. If the signature is invalid, the
program will fault.

The PIE code is used for the parasite and the restorer. In both cases, it
runs in a foreign process. The case of the restorer is even trickier
because it needs to restore the original PAC keys, which invalidates
all previously "signed" pointers within the restorer itself.

Fixes checkpoint-restore#2709

Signed-off-by: Andrei Vagin <avagin@gmail.com>
@avagin avagin force-pushed the arm64-branch-protection branch from f046b73 to aececb2 Compare August 15, 2025 07:41
@avagin
Copy link
Member Author

avagin commented Aug 15, 2025

@rst0git I uploaded a new version. Please try it out.

Copy link
Member

@rst0git rst0git left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@mihalicyn mihalicyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool stuff!

LGTM

@avagin avagin merged commit d8c3492 into checkpoint-restore:criu-dev Aug 15, 2025
37 of 42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

criu 4.1.1 times out in runc c/r tests on GHA arm (ubuntu-24.04-arm)

3 participants