-
Notifications
You must be signed in to change notification settings - Fork 69
c18n: Introduce fast path in trampolines #2484
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: dev
Are you sure you want to change the base?
Conversation
|
I really don't like the idea of the option being reintroduced in-tree; it adds a bunch of complexity and ugly hacks, but also it's an option that is fundamentally unsound, and will become especially broken with compartmentalised TLS. What you really need is a way to profile trampolines and be able to count cycles spent specifically in function pointer ones. |
ba44210 to
55b81ef
Compare
|
@jrtc27 I made some further changes to fix trampoline reflection when the fast path is disabled through the environment variable. The patch is tested on Morello with KDE and everything seems to be working fine. |
| PATCH_POINT(tramp_push_frame, n_rets, 7b) | ||
| PATCH_POINT(tramp_push_frame, target, 8b) | ||
|
|
||
| .section .rodata |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Um this doesn't restore the section afterwards for what follows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TRAMP macro always sets the section so this is fine.
|
|
||
| .section .rodata | ||
| .globl c18n_tramp_entry_slow_offset | ||
| .align 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.balign 8, .align is an abomination that's either .p2align or .balign depending on the architecture, and nobody ever wants to have to remember which...
55b81ef to
c7a9bb1
Compare
87c793c to
235e52e
Compare
These fast paths check if the compartment transition is a self-transition and if so, jump directly to the target without modifying the trusted stack. Calls through the PLT continue to use the old slow path as self-transitions can already be ruled out when relocating jump slots. Introduce the LD_COMPARTMENT_NO_FAST_PATH environment variable which forces all trampolines to use the slow path.
Revert two commits that made function pointer wrapping the default: It turned out that this knob was quite useful for performance evaluation.These fast paths check if the compartment transition is a self-transition and if so, jump directly to the target without modifying the trusted stack.
Calls through the PLT continue to use the old slow path as self-transitions can already be ruled out when relocating jump slots.
Introduce the LD_COMPARTMENT_NO_FAST_PATH environment variable which forces all trampolines to use the slow path.