[PATCH v4 0/5] aarch64: support shadow stack in clone3
Yury Khrustalev
yury.khrustalev@arm.com
Thu Nov 13 15:03:06 GMT 2025
On Tue, Nov 11, 2025 at 01:52:40PM -0500, enh wrote:
> yeah, historically i've hated similar apis but that's in part been
> because stack usage was so dependent on locals and inlining decisions
> and the like. but while inlining decisions are still relevant here, it
> does seem like this -- being only a control stack -- is going to be
> strictly less problematic.
>
> (though almost every case i can think of has ended in "no, _you're_
> the problem --- change your algorithm so its machine stack use isn't
> proportional to the size of input; stop tweaking the machine stack
> size and get your own heap allocated stack-like data structure", and
> i'm not sure that's likely to change here.)
Since API to control stack size already exists [1], I think it makes
sense to allow change shadow stack size as well. Whatever are the
reasons for changing stack size, the efforts may become futile if, for
example, shadow stack corresponding to this custom-sized stack is
over-allocated. If normal stack requires much bigger size for some
reason, we might run out of shadow stack size which would also be not
ideal.
So, I think this new API should be OK.
[1]: https://www.man7.org/linux/man-pages/man3/pthread_attr_setstacksize.3.html
More information about the Libc-alpha
mailing list