Messages in this thread | | | Subject | Re: [GIT PULL] Please pull proc and exec work for 5.7-rc1 | From | Bernd Edlinger <> | Date | Fri, 3 Apr 2020 18:36:37 +0200 |
| |
On 4/3/20 6:23 PM, Linus Torvalds wrote: > On Fri, Apr 3, 2020 at 8:09 AM Bernd Edlinger <bernd.edlinger@hotmail.de> wrote: >> >> On 4/2/20 9:04 PM, Linus Torvalds wrote: >>> In fact, then you could drop the >>> >>> mutex_unlock(&tsk->signal->exec_update_mutex); >>> >>> in the error case of exec_mmap(), because now the error handling in >>> free_bprm() would do the cleanup automatically. >>> >> >> The error handling is sometimes called when the exec_update_mutex is >> not taken, in fact even de_thread not called. > > But that's the whole point of the flag. Make the flag be about "do I > hold the mutex", and then the error handling does the right thing > regardless. > >> Can you say how you would suggest that to be done? > > I think the easiest thing to do to explain is to just write the patch. > > This is entirely untested, but see what the difference is? I make the > flag be about exactly where I take the lock, not about some "I have > called exec_mmap". > > Which means that now exec_mmap() doesn't even need to unlock it in the > error case, because the unlocking will happen properly in the > bprm_exit regardless. > > This makes that unconditional unlocking logic much more obvious. > > That said, Eric says he can make it all properly static so that it > doesn't need that kind of dynamic "if (x) unlock()" logic at all, > which is much better. > > So this patch is not for consumption, it's purely for "look, something > like this" >
Works for me. But I also want to wait for Eric, I am curious. I have a lot of time.
Bernd.
> Linus >
| |