Skip to content

Conversation

@jrtc27
Copy link
Contributor

@jrtc27 jrtc27 commented Jan 5, 2026

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.

@jrtc27
Copy link
Contributor Author

jrtc27 commented Jan 5, 2026

CI failure looks to be a missing apt update in #355

@smithp35
Copy link
Contributor

smithp35 commented Jan 6, 2026

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.

@jrtc27
Copy link
Contributor Author

jrtc27 commented Jan 6, 2026

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.

@jrtc27 jrtc27 force-pushed the aaelf64-morello-tgot branch from 8f73c49 to d6307b8 Compare January 6, 2026 16:49
Copy link
Contributor

@smithp35 smithp35 left a 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).

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
Copy link
Contributor

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)

@jrtc27
Copy link
Contributor Author

jrtc27 commented Jan 7, 2026

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.

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.

Could be worth mentioning these if they are applicable to Morello (or not).

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").

@jrtc27 jrtc27 force-pushed the aaelf64-morello-tgot branch from d6307b8 to 46b2b1b Compare January 7, 2026 19:22
… 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.
@jrtc27 jrtc27 force-pushed the aaelf64-morello-tgot branch from 46b2b1b to 98d1a2d Compare January 7, 2026 21:10
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.

2 participants