On Sun, Aug 30, 2020 at 07:31:39AM -0500, Eric W. Biederman wrote: > I am thinking that for cases where we want to do significant work it > might be better to ask the process to pause at someplace safe (probably > get_signal) and then do all of the work when we know nothing is changing > in the process. > > I don't really like the idea of checking and then checking again. We > might have to do it but it feels like the model is wrong somewhere. > > Given that this is tricky to hit in practice, and given that I am > already working the general problem of how to sort out the locking I am > going to work this with the rest of the thorny issues of in exec. This > feels like a case where the proper solution is that we simply need > something better than a mutex. One possible alternative would be something RCU-like, surround the thing with get_task_cred() / put_cred() and then have commit_creds() wait for the usage of the old creds to drop to 0 before continuing. (Also, get_cred_rcu() is disgusting for casting away const) But this could be complete garbage, I'm not much familiar with any of thise code.