Re: [PATCH v2 20/20] signal: Don't restart fork when signals come in.
From: Linus Torvalds
Date: Tue Jul 24 2018 - 16:56:19 EST
On Tue, Jul 24, 2018 at 1:40 PM Eric W. Biederman <ebiederm@xxxxxxxxxxxx> wrote:
>
> + if (signal_pending(current)) {
> + retval = restart_syscall();
> + goto fork_out;
> + }
Oh, the previous version had this too, but it wasn't as obvious
because it was just in a single line:
return ERR_PTR(restart_syscall());
but it's just crazy.
It should just be
retval = -ERESTARTNOINTR;
if (signal_pending(current))
goto fork_out;
because it's just silly and pointless to change the code to use
restart_syscall() here.
All restart_syscall() does is
set_tsk_thread_flag(current, TIF_SIGPENDING);
return -ERESTARTNOINTR;
and you just *checked* that TIF_SIGPENDING was already set. So the
above is completely pointless.
It is not clear why you made that change. The old code had the simpler
"just return -ERESTARTNOINTR" model.
Did the restart_syscall() thing come in by mistake from some previous
trials and it just hung around?
Linus