On Fri, Feb 09, 2024 at 08:18:11PM +0000, Edgecombe, Rick P wrote:
On Sat, 2024-02-03 at 00:05 +0000, Mark Brown wrote:
+ if (write_user_shstk_64((u64 __user *)addr, 0)) + return false;
+ return true; +}
So, don't we want to consume the token on the *new* task's MM, which was already duplicated but still unmapped? In which case I think the other arch's would need to GUP regardless of the existence of shadow stack atomic ops.
Yes, that would be better - if nothing else it allows reuse of the same shadow stack for multiple !CLONE_VM clone3()s.
I wonder about adding a shstk_post_fork() to make it easier to think about and maintain, even if there are no issues today.
I agree.