Skip to content

Not restarting for due to signals.

Eric W. Biederman lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v5 Latest6 patches 3 repliesIn review

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6fork: Move and describe why the code examines PIDNS_ADDINGkernel/fork.c+7 -40 replies
2/6fork: Unconditionally exit if a fatal signal is pendingkernel/fork.c+6 -00 replies
3/6signal: Add calculate_sigpending()include/linux/sched/signal.h kernel/sched/core.c kernel/signal.c+14 -00 replies
4/6fork: Skip setting TIF_SIGPENDING in ptrace_init_taskinclude/linux/ptrace.h+0 -20 replies
5/6fork: Have new threads join on-going signal group stopsinclude/linux/sched/signal.h kernel/fork.c kernel/signal.c+31 -120 replies
6/6signal: Don't restart fork when signals come in.include/linux/sched/signal.h init/init_task.c kernel/fork.c +1 more+52 -183 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v5 yet.

Read the v5 thread

Cover letter [PATCH v5 0/6] Not restarting for due to signals.

This builds on patches 1-15 of my previous patch posting. As those are non-controversial I am not posting them again.

I took longer than I had hoped to get this set together because a kernel testing robot noticed some random corruption with the way I had been adding to the list. I finally tracked it down to failing to remove the sigset from the list during fork_idle. So I have made that logic simpler and use hlist_del_init which will only remove an item from a list if it was placed on the list in the first place.

I took Oleg's suggesting and moved calculate_sigpending into schedule_tail where recalc_sigpending an be used directly. Then in calculate_sigpending I just unconditionally set TIF_SIGPENDING and allow recalc_sigpending to clear TIF_SIGPENDING if we don't need it.

I also now handle the stop/continue signal magic where we only let one of stop signals and SIGCONT be pending at a time. Looking at it from first principles dropping one of SIGTSTP SIGTTIN SIGTTOU or SIGCONT before calling it's handler feels wrong. I checked and it is our historical behavior, so I won't even thinking of introducing different behavior at this point.

Eric W. Biederman (6):
fork: Move and describe why the code examines PIDNS_ADDING
fork: Unconditionally exit if a fatal signal is pending
signal: Add calculate_sigpending()
fork: Skip setting TIF_SIGPENDING in ptrace_init_task
fork: Have new threads join on-going signal group stops
signal: Don't restart fork when signals come in.

 include/linux/ptrace.h       |  2 --
 include/linux/sched/signal.h | 11 ++++++++++
 init/init_task.c             |  1 +
 kernel/fork.c                | 49 ++++++++++++++++++++++++++++++--------------
 kernel/sched/core.c          |  2 ++
 kernel/signal.c              | 43 ++++++++++++++++++++++++++++++++++++++
 6 files changed, 91 insertions(+), 17 deletions(-)

Eric