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

Does ld.so need padded TLS? #449

Open
fw-immunant opened this issue Oct 15, 2024 · 3 comments
Open

Does ld.so need padded TLS? #449

fw-immunant opened this issue Oct 15, 2024 · 3 comments

Comments

@fw-immunant
Copy link
Contributor

From Slack:

Ayrton: does ld.so need padded tls?

Frances: that's a very good question, I'll do some investigation tomorrow because I'm not sure off the top of my head; at least plausibly it does, if it persists in the address space and its TLS gets accessed from different compartments after startup... on the other hand if we frontload all dynamic loading the way we plan to, that might interact here

Ayrton: that would make sense. Also I noticed the nginx demo doesn't use padded libc. I don't think it's necessarily worth spending time to fix but I just wanted to clarify when it was necessary/what the memory layout of TLS is like since presumably nginx does rely on libc TLS via errno

@ayrtonm
Copy link
Contributor

ayrtonm commented Oct 17, 2024

The same question also applies to libgcc_s.so.1 and libstdc++.so.6

@fw-immunant
Copy link
Contributor Author

The good news is that on ARM the situation is a bit simpler, because when we compile everything with our toolchain we use libcxx instead of libstdc++, which means that libgcc_s.so is no longer involved (libcxx doesn't depend on it) and libc++.so blessedly has no static TLS, so it doesn't need to be padded.

On x86_64, the real question is when the TLS of these shared objects gets accessed.

@kkysen
Copy link
Contributor

kkysen commented Oct 18, 2024

Is there any downside to padding all of these, though? I'm not sure exactly how to use a padded ld.so since it's the loader, but the others seem simple if you're already padding all of the other libraries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants