Skip to content

Commit afa01db

Browse files
committed
Apply Intel Control-flow Technology for x86-64 on asm_trampoline.S
Intel's Control-flow Technology requires manual application for the assembler files. See also: https://sourceware.org/annobin/annobin.html/Test-cf-protection.html
1 parent 65ae3d5 commit afa01db

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Python/asm_trampoline.S

+19
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
# }
1010
_Py_trampoline_func_start:
1111
#ifdef __x86_64__
12+
ENDBR64
1213
sub $8, %rsp
1314
call *%rcx
1415
add $8, %rsp
@@ -34,3 +35,21 @@ _Py_trampoline_func_start:
3435
.globl _Py_trampoline_func_end
3536
_Py_trampoline_func_end:
3637
.section .note.GNU-stack,"",@progbits
38+
#ifdef __x86_64__
39+
.section .note.gnu.property,"a"
40+
.align 8
41+
.long 1f - 0f
42+
.long 4f - 1f
43+
.long 5
44+
0:
45+
.string "GNU"
46+
1:
47+
.align 8
48+
.long 0xc0000002
49+
.long 3f - 2f
50+
2:
51+
.long 0x3
52+
3:
53+
.align 8
54+
4:
55+
#endif // __x86_64__

0 commit comments

Comments
 (0)