Skip to content

RFC exec: Fixing ptrace'd mulit-threaded hang

Eric W. Biederman linux-api lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 RFC Latest5 patches 8 repliesIn review
  2. v1 RFC2 patches 6 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5ptrace: Don't wait in PTRACE_O_TRACEEXIT for exec or coredumpkernel/signal.c+42 -611 reply
2/5sighand: Count each thread group once in sighand_structkernel/exit.c kernel/fork.c+5 -30 replies
3/5clone: Disallown CLONE_THREAD with a shared sighand_structkernel/fork.c+7 -03 replies
4/5exec: If possible don't wait for ptraced threads to be reapedfs/exec.c kernel/exit.c kernel/signal.c+11 -311 reply
5/5signal: Don't allow accessing signal_struct by old threads after execfs/exec.c include/linux/sched/signal.h kernel/fork.c +2 more+13 -13 replies

Reviews trailers per patch

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

Read the v2 thread

Cover letter [RFC][PATCH v2 0/5] exec: Fixing ptrace'd mulit-threaded hang

Oleg your comment about kill being able to send signal was an important dimension I had missed thank you.

This patchset just denies the case of SIGHAND between different multi-threaded processes as I don't think anyone cares. I can fix that if anyone cares but I am not certain we actally do.

I have reworked the ptrace notification code so that we always send notifications if we can but don't wait if it is a coredump or an exec. Which simpilifies the code nicely.

A few more tweaks are needed before a final version but I think things are compelling.

 fs/exec.c                    |  23 ++-------
 include/linux/sched/signal.h |   1 +
 kernel/exit.c                |  20 ++++----
 kernel/fork.c                |  14 +++++-
 kernel/ptrace.c              |   4 ++
 kernel/signal.c              | 112 +++++++++++++++++++------------------------
 6 files changed, 78 insertions(+), 96 deletions(-)

Eric W. Biederman (5):
ptrace: Don't wait in PTRACE_O_TRACEEXIT for exec or coredump
sighand: Count each thread group once in sighand_struct
clone: Disallown CLONE_THREAD with a shared sighand_struct
exec: If possible don't wait for ptraced threads to be reaped
signal: Don't allow accessing signal_struct by old threads after exec

Eric