Commit graph

12 commits

Author SHA1 Message Date
Nobuyoshi Nakada
1f39184bc7 Substitute coroutine_transfer with prefixed symbol in Makefile
```
coroutine/arm64/Context.S:31:57: error: invoking macro TOKEN_PASTE argument 1: empty macro arguments are undefined in ISO C90 [-Wpedantic]
   31 | .global PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer)
      |                                                         ^
```
2024-10-08 23:29:49 +09:00
KJ Tsanaktsidis
86c2724e75 Don't emit ELF notes on non-ELF platforms
These apparently break compilation on old MacOS toolchains, because the
MachO section name is capped to 16 chars (although, on my MacOS, at
least, the section name just gets truncated). Nevertheless, these serve
no purpose on non-ELF platforms (they're part of the LSB Linux ABI).

[Bug #20677]
2024-08-22 17:35:43 +10:00
KJ Tsanaktsidis
8ec67052e6 Do not define SHSTK feature for amd64 Context.S
We do not implement CET shadow-stack switching in amd64 Context.S. If
you compile Ruby with `-fcf-protection=full` and run it with
`GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK` exported, it will crash with a
control flow exception.

Configure the appropriate notes at the end of Context.S

[Bug #18061]
2024-07-07 20:14:44 +10:00
Vít Ondruch
d9398ac430
Use __CET__ macro to enable IBT support. (#11081)
According to the GCC documentation [1], the macro `__CET__` is dfined
when `-fcf-protection` compiler option is used. Therefore use this macro
to enable IBT support instead of special casing for `__OpenBSD__`.

[1]: https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html#index-fcf-protection
2024-07-04 08:37:41 +09:00
Jeremy Evans
a60831f9b6 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.
2024-06-13 07:28:59 -07:00
Samuel Williams
40d774bec6
Avoid memory dependency between instructions. (#8284) 2023-08-25 13:28:33 +12:00
David Carlier
0ead818d81 Generating note.GNU-stack section for FreeBSD on x86.
Not enabling for ELF in general as not all platform support it
 (e.g. NetBSD, implictly stack never executable).
2021-03-05 14:33:52 +13:00
Samuel Williams
f96216df8d
Remove "All Rights Reserved." from Copyright statement. 2019-12-28 12:41:47 +13:00
Samuel Williams
6c6bf9ffcb Add ucontext coroutine implementation for generic fallback. 2019-06-26 20:19:53 +12:00
Nobuyoshi Nakada
e0f0ab959e
Remove unused symbols 2019-05-16 21:58:42 +09:00
samuel
f33adbc11e Ensure stack is correctly protected
See https://bugs.ruby-lang.org/issues/15335 for more details.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-24 11:35:34 +00:00
samuel
e64f71f812 Change Makefile rule for assembly to use .S rather than .s
It is more conventional to use compiler to pre-process and
assemble the `.S` file rather than forcing Makefile to use `.s`.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-24 11:35:29 +00:00
Renamed from coroutine/amd64/Context.s (Browse further)