Re: [GIT PULL] Please pull proc and exec work for 5.7-rc1
From: Linus Torvalds
Date: Tue Apr 07 2020 - 16:48:05 EST
On Tue, Apr 7, 2020 at 1:29 PM Bernd Edlinger <bernd.edlinger@xxxxxxxxxx> wrote:
>
> Maybe, actually I considered this, but I was anxious that making something
> that is so far not killable suddenly killable might break other things.
I don't think it can.
Basically, if you have a execve() and a setprocattr() racing, one or
the other starts first.
And if the execve() started first, then the setprocattr() thread would
get killed by the execve(), and there's no serialization. So you might
as well just say "it got killed before it even started to wait".
So semantically, having a killable wait is basically exactly the same
as losing the race - which wasn't ordered to begin with.
It's not like anybody will see the return value - the thread that
would have gotten the value got killed.
So doing
if (down_writel_killable(&credlock))
return -EINTR;
may *look* like it's new semantics, but it isn't really. That EINTR
error isn't visible to anybody, and everything looks absolutely
identical to "execve() in the other thread started earlier and killed
the thread even before it got to the system call".
Linus