-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix Intel CET / SHSTK support in fibers #14027
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: PHP-8.3
Are you sure you want to change the base?
Conversation
If that's the case, you should definitively upstream your bug fix. |
I planed to do so, but do you confirm the duplication in boostorg/context#248 was a mistake? |
yes :) |
Sync Zend/asm/*_x86_64_sysv_elf_gas.S with upstream
* Syscall number for map_shadow_stack has changed since initial support was added. * Use SYS_map_shadow_stack instead of hard-coded number when possible
The shadow stack may need as much space as the fiber stack in the worse case, so allocate a shadow stack the same size as the fiber stack. This matches what the kernel does for the main stack.
|
Oh, I didn't notice this. I will check |
The LINUX_X64_RELEASE_NTS job is the last one running Ubuntu 22.04 I believe, and in this version the Glibc loader doesn't enable SHSTK. The program crashes on the |
I think you re right, I get a SIGILL for those instructions in one intel machine but not the other (more modern distro). |
This fixes SHSTK support in fibers:
map_shadow_stack
has changed since initial support was added. I update the syscall number and use the SYS_map_shadow_stack macro instead of the hard coded number when possible. Note: when the configure check is broken, SHSTK is not disabled. Instead, SHSTK handling is not added, causing fibers to crash. So there is no risk of disabling a security feature by breaking this check.This can be tested with a kernel >= 6.6 and glibc >= 2.39, when compiling with
CFLAGS=-fcf-protection=full LDFLAGS=-Wl,-z,cet-report=error
, and running withGLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK
.Check that the binary was compiled with SHSTK:
Check CPU and kernel support:
Check that
ld
enables SHSTK:See https://docs.kernel.org/next/x86/shstk.html
See https://www.phoronix.com/news/Glibc-Intel-CET-Shadow-Stack