mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Use ENDBR instruction in amd64 coroutine on OpenBSD
When running on newer Intel processors supporting the feature, OpenBSD enforces indirect branch tracking. Without this endbr64 instruction, jumps to the coroutine_transfer function result in SIGILL on OpenBSD/amd64 when using such processors. The OpenBSD Ruby ports have been using a patch similar to this for the past two months. From some research, cet.h has been supported by GCC for about 6 years and LLVM for about 4 years.
This commit is contained in:
parent
c2f8e91815
commit
a60831f9b6
1 changed files with 8 additions and 0 deletions
|
@ -5,6 +5,10 @@
|
|||
## Copyright, 2018, by Samuel Williams.
|
||||
##
|
||||
|
||||
#if defined(__OpenBSD__)
|
||||
#include <cet.h>
|
||||
#endif
|
||||
|
||||
#define TOKEN_PASTE(x,y) x##y
|
||||
#define PREFIXED_SYMBOL(prefix,name) TOKEN_PASTE(prefix,name)
|
||||
|
||||
|
@ -13,6 +17,10 @@
|
|||
.globl PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer)
|
||||
PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer):
|
||||
|
||||
#if defined(__OpenBSD__)
|
||||
_CET_ENDBR
|
||||
#endif
|
||||
|
||||
# Make space on the stack for 6 registers:
|
||||
subq $48, %rsp
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue