Skip to content
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

c18n: Miscellaneous improvements #2266

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open

c18n: Miscellaneous improvements #2266

wants to merge 2 commits into from

Conversation

dpgao
Copy link
Contributor

@dpgao dpgao commented Dec 11, 2024

Improve trampolines to clear the correct number of return values during tail-call.
Improve previous uses of c18n_return_address.

Turn all use sites of __builtin_return_address(0) to use the newly
defined rtld_get_return_address macro, which is overridden to take into
account the existence of trampolines when c18n is enabled.
In the following example, bar makes a tail-call to foo, which returns a
value that is observable to the caller of bar, even though bar returns
nothing.

    void *foo();
    void bar() { foo(); }

When bar is called, previous versions of the trampoline clears return
value registers as if foo is being called directly, leaking a
capability. Instead, clear the maximum number of return value registers
as required for both foo and bar.
@dpgao dpgao requested a review from jrtc27 December 11, 2024 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant