[PATCH v2 2/3] nptl: Add libc allocated shadow stack for new threads
Florian Weimer
fweimer@redhat.com
Tue Sep 9 14:26:21 GMT 2025
* Adhemerval Zanella Netto:
> Yes, but it does not really help current code that does. And
> makecontext/swapcontext were removed from POSIX-2008; so adding a
> glibc extension for a deprecated POSIX feature does not seems a good
> way forward.
I agree. An implementation of stackful coroutines could have a place in
glibc, but the legacy POSIX interfaces really aren't that. The choice
of what is preserved in the context and what carries over in a context
switch seems quite arbitrary. For example, why do we call into the
kernel to switch the signal mask? But not the alternate signal stack?
Why do we switch floating point state that is generally not callee-saved
(at least on some architectures), but not the memory protection key
registers? And so on.
A design from scratch could address these issues and also tackle the
lack of proper resource management.
Thanks,
Florian
More information about the Libc-alpha
mailing list