On Wed, 2024-05-15 at 08:36 -0600, Jiri Olsa wrote: > > > > Let me ask a couple of really stupid questions. What if the shadow stack > > is "shorter" than the normal stack? I mean,
The shadow stack could overflow if it is not big enough. However since the normal stack has return addresses and data, and shadow stack has the smaller amount data of only return addresses, we can mostly avoid this by picking a large size for the shadow stack. For underflow, you can't return from the point where you enable shadow stack. Almost all uses will enable it very early. Glibc loader does it before main is reached, for example. The shadow stack selftest is not a typical usage in this respect.