-
Notifications
You must be signed in to change notification settings - Fork 212
[aaelf64-morello] Define relocations and code seqeuences for indirect TLS #357
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: main
Are you sure you want to change the base?
Conversation
|
CI failure looks to be a missing apt update in #355 |
|
Thanks for the patch. I've hopefully fixed the CI with #358 I'll take a look through the changes this week. I guess the CHERI ELF ABI https://github.com/CTSRD-CHERI/cheri-elf-gabi/blob/main/gabi.md is my best reference documentation to check against? If you have anyone else in the Morello/CHERI community that you would like to add as a reviewer it is possible to @ them in a review comment. Unfortunately the project permissions make it difficult to add people to the review tabs. |
|
The reference in this PR to the CHERI ELF gABI document is a bit aspirational, in that beyond defining various generic CHERI ELF encodings (DT_/PT_/NT_) there isn't anything describing the model written down yet (despite already being implemented in CHERI LLVM for CHERI-RISC-V). The best I can offer for now is a 15 minute talk I gave last year (https://www.youtube.com/watch?v=7RvclCy4Zvg) but I realise that's not a great response... you could at least skip to 8:40 as a bit over half the talk was a brief overview of TLS ignoring CHERI, so "only" 6 minutes to sit through. But that was intended for a general CHERI audience, and I'm guessing you're more interested in the finer details? I don't know if there's anyone else who would be interested in reviewing these changes, but I suppose I can tag @bsdjhb as a linker and TLS enlightened CHERI person, and @fboudra as the current Morello LLVM maintainer. I'll also go post it on the Morello Slack to see if anyone else wants to read it. |
8f73c49 to
d6307b8
Compare
smithp35
left a comment
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.
Thanks for the link to the presentation. Main thing I wanted to find out was whether this was a direction that the Morello community are happy about, and it seems like that this is the case, particularly as there is a migration path.
I think I spotted a typo, but otherwise the additional relocations seem to fit the same conventions as used by the rest of the document and I couldn't spot anything obviously wrong.
There's already a mention that a Morello ELF file can contain a CHERI_ELF Note section. I see that there are mentions of TGOT in https://github.com/CTSRD-CHERI/cheri-elf-gabi/blob/main/gabi.md#-program-header-table and https://github.com/CTSRD-CHERI/cheri-elf-gabi/blob/main/gabi.md#-dynamic-table
Could be worth mentioning these if they are applicable to Morello (or not).
aaelf64-morello/aaelf64-morello.rst
Outdated
| pointer-sized entries will be relocated with ``R_MORELLO_TLSDESC(S+A)``. | ||
|
|
||
| - ``GTGOTTLSDESC(S+A)`` represents a consecutive pair of pointer-sized entries | ||
| as the indirect TLS version of ``GTLSDESC(A)``. The pair of pointer-sized |
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.
Possible typo: GTLSDESC(S+A)
It's where we intend to go with CheriBSD, yes, and that's where the migration path is important, we ensure upgrading from release N to release N+1 works rather than requiring a reinstall (i.e. software built for release N works on release N+1, but often not N+2). I can't speak for developers of other Morello OSes, though Morello Linux isn't under active development any more, it only sees maintenance fixes for new compiler versions.
If you mean PT_CHERI_TGOT and DT_CHERI_TGOT*, yes, those will be used. I'm not sure it makes sense to explicitly call them out though? It's part of the CHERI gABI, which this sits on top of, so it would seem a bit odd to re-enumerate them. I could add some additional sections, like the existing bit that talks about ELF notes, that mention program headers and the dynamic table include entries as defined by the CHERI gABI? I'd treat that as a separate change, though, as something that's already missing (PT_CHERI_PCC is used today in Morello LLVM). On the notes front, there are Morello-specific values for NT_CHERI_TLS_ABI that I should document here though (for each of "mixed" and "compat"). |
d6307b8 to
46b2b1b
Compare
… TLS This specifies how to implement the new TGOT-based indirect TLS for Morello, which avoids the need for dynamic derivation of bounded capabilities from a widely-bounded capability, and allows for selective exposure of TLS variables to different compartments.
46b2b1b to
98d1a2d
Compare
This specifies how to implement the new TGOT-based indirect TLS for
Morello, which avoids the need for dynamic derivation of bounded
capabilities from a widely-bounded capability, and allows for selective
exposure of TLS variables to different compartments.