Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARMv8.1-M: Add task dedicated PAC key support #1195

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

AhmedIsmail02
Copy link
Contributor

@AhmedIsmail02 AhmedIsmail02 commented Nov 19, 2024

Description

To harden the security, each task is assigned with a dedicated PAC key, so that attackers needs to get the all the PAC keys right to exploit the system using Return Oriented Programming. The kernel is updated to support the following:

  • A PAC key set with a user defined random number generator is generated and is pushed onto the task's stack when a task is created.
  • As part of scheduling, the task's PAC key is stacked/unstacked to/from the task's stack when a task is unscheduled/scheduled from/to run.

Test Steps

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

Blocks FreeRTOS/FreeRTOS-Partner-Supported-Demos#19

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@AhmedIsmail02 AhmedIsmail02 requested a review from a team as a code owner November 19, 2024 14:15
Some declarations in portasm.h and FreeRTOS.h will cause
build errors if it's not understood by the assembler.
For example the 'extern' keyword. To avoid these errors
guard any such code inside a #ifdef #endif block so
the code is included in C files but excluded by the
preprocessor in assembly files.

Signed-off-by: Ahmed Ismail <[email protected]>
ARMv8-M TrustZone variant registers stacking
procedure is modified to be consistent with the NTZ port
variant where one `stmdb` instruction is used instead of
using 'subs' instruction along with `stmia` instruction, also,
this result in more efficient context switching
handling (lower latency).

Signed-off-by: Ahmed Ismail <[email protected]>
To harden the security, each task is assigned
a dedicated PAC key, so that attackers needs
to guess the all the tasks' PAC keys right to
exploit the system using Return Oriented Programming.

The kernel is now updated to support the following:
* A PAC key set with a random number generated and
is pushed onto the task's stack when a task is created.

* As part of scheduling, the task's PAC key is stacked/unstacked
to/from the task's stack when a task is unscheduled/scheduled
from/to run.

Signed-off-by: Ahmed Ismail <[email protected]>
@AhmedIsmail02 AhmedIsmail02 force-pushed the add-task-dedicated-pac-key-support branch from d7e9592 to 05a1578 Compare November 19, 2024 16:39
Copy link

sonarcloud bot commented Nov 20, 2024

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.

3 participants