Build correctly with IBT and Shadow Stack (#1289)

Add .gnu.property notes to indicate support for IBT and shadow stacks
when libsodium is built with it.  There's no stack switching code in
here, so this should not need any other codegen changes.
This commit is contained in:
Siddhesh Poyarekar
2023-07-18 17:56:18 +02:00
committed by GitHub
parent c341b85969
commit 0bc8e0bdfd
2 changed files with 36 additions and 0 deletions
@@ -9,6 +9,24 @@
#include "ladder.S" #include "ladder.S"
#if defined(__linux__) && defined(__ELF__) #if defined(__linux__) && defined(__ELF__)
#if defined(__CET__)
.section .note.gnu.property,"a"
.p2align 3
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.p2align 3
.long 0xc0000002
.long 3f - 2f
2:
.long __CET__
3:
.p2align 3
4:
#endif
.section .note.GNU-stack,"",%progbits .section .note.GNU-stack,"",%progbits
#endif #endif
@@ -958,5 +958,23 @@ jmp ._bytesbetween1and255
#endif #endif
#if defined(__linux__) && defined(__ELF__) #if defined(__linux__) && defined(__ELF__)
#if defined(__CET__)
.section .note.gnu.property,"a"
.p2align 3
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.p2align 3
.long 0xc0000002
.long 3f - 2f
2:
.long __CET__
3:
.p2align 3
4:
#endif
.section .note.GNU-stack,"",%progbits .section .note.GNU-stack,"",%progbits
#endif #endif