Skip to content
Commit 43607896 authored by Ederson de Souza's avatar Ederson de Souza Committed by Benjamin Cabé
Browse files

arch/x86: Shadow Stack support



Shadow Stack is one of the capabilities provided by Intel Control-flow
Enforcement Technology (CET), aimed at defending against Return Oriented
Programming.

This patch enables it for x86_64 (32-bit support coming in future
patches):

    - Add relevant Kconfigs;
    - Shadow stacks should live in specially defined memory pages, so
      gen_mmu.py was updated to allow that;
    - A new macro, Z_X86_SHADOW_STACK_DEFINE, added to define the area
      for a shadow stack;
    - A new function, z_x86_thread_attach_shadow_stack(), added to
      attach a shadow stack to a never started thread;
    - locore.S changed to enable/disable shadow stack when a thread
      using it comes in/out of execution.

As not all threads are currently shadow stack capable, threads that do
not use it will still run with shadow stack disabled. Ideally, at some
point in the future, all threads would use the shadow stack, so no need
to disable it at all.

Signed-off-by: default avatarEderson de Souza <ederson.desouza@intel.com>
parent 49cb4ddb
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment