Skip to content

RFC PIDTYPE_TGID and fewer fork restarts

Eric W. Biederman lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest11 patches 24 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11pids: Initialize leader_pid in init_taskinit/init_task.c+1 -00 replies
2/11pids: Move task_pid_type into sched/signal.hinclude/linux/sched/signal.h kernel/exit.c+8 -80 replies
3/11pids: Compute task_tgid using signal->leader_pidarch/ia64/kernel/asm-offsets.c arch/ia64/kernel/fsys.S drivers/platform/x86/thinkpad_acpi.c +6 more+22 -170 replies
4/11kvm: Don't open code task_pid in kvm_vcpu_ioctlvirt/kvm/kvm_main.c+1 -10 replies
5/11pids: Move the pgrp and session pid pointers from task_struct to signal_structarch/ia64/kernel/asm-offsets.c arch/ia64/kernel/fsys.S fs/autofs/autofs_i.h +7 more+78 -731 reply
6/11pid: Implement PIDTYPE_TGIDarch/ia64/kernel/asm-offsets.c arch/ia64/kernel/fsys.S arch/s390/kernel/perf_cpum_sf.c +11 more+19 -190 replies
7/11signal: Deliver group signals via PIDTYPE_TGID not PIDTYPE_PIDkernel/signal.c kernel/time/posix-timers.c+5 -610 replies
8/11signal: Use PIDTYPE_TGID to clearly store where file signals will be sentdrivers/net/tun.c drivers/tty/tty_io.c fs/fcntl.c +2 more+14 -170 replies
9/11tty_io: Use do_send_sig_info in __do_SACK to forcibly kill tasksdrivers/tty/tty_io.c+3 -37 replies
10/11signal: Push pid type from signal senders down into __send_signaldrivers/tty/sysrq.c drivers/tty/tty_io.c fs/fcntl.c +7 more+60 -641 reply
11/11signal: Ignore all but multi-process signals that come in during fork.include/linux/sched/signal.h kernel/fork.c kernel/signal.c+20 -25 replies

Reviews trailers per patch

1 of 11 patches has a Reviewed-by or Acked-by.

PatchOleg Nesterov
1/11
2/11
3/11
4/11
5/11
6/11
7/11
8/11
9/11
10/11
11/11A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [RFC][PATCH 0/11] PIDTYPE_TGID and fewer fork restarts

The following patches should be close. I took some patches I haven't taken the time to merge yet that make PIDTYPE_TGID not a hack.

Updated the code that deals with signals to handle PIDTYPE_TGID.

Pushed the pid type down from the signal senders all of the way down into __send_signal. That work could probably use being split into more than one patch for readability, but it seems reasonble and less of a hack than the "bool group" we have currently.

I think I have gotten all of the places we send signals to multiple processes. But I have yet to make an exhaustive examination. I would appreciate some review feedback before I burn a day doing that.

All in all this changes a little more than I might hope for but it seems a nicely targted cleanup that sorts out the fork issue.

Comments please.

I think I am 99% of the way to solving this cleanly but any feedback would be very appreciated.

Thank you in advance.

Eric W. Biederman (11):
pids: Initialize leader_pid in init_task
pids: Move task_pid_type into sched/signal.h
pids: Compute task_tgid using signal->leader_pid
kvm: Don't open code task_pid in kvm_vcpu_ioctl
pids: Move the pgrp and session pid pointers from task_struct to signal_struct
pid: Implement PIDTYPE_TGID
signal: Deliver group signals via PIDTYPE_TGID not PIDTYPE_PID
signal: Use PIDTYPE_TGID to clearly store where file signals will be sent
tty_io: Use do_send_sig_info in __do_SACK to forcibly kill tasks
signal: Push pid type from signal senders down into __send_signal
signal: Ignore all but multi-process signals that come in during fork.

 arch/ia64/kernel/asm-offsets.c       |  4 +--
 arch/ia64/kernel/fsys.S              | 12 +++----
 arch/s390/kernel/perf_cpum_sf.c      |  2 +-
 drivers/net/tun.c                    |  2 +-
 drivers/platform/x86/thinkpad_acpi.c |  1 +
 drivers/tty/sysrq.c                  |  2 +-
 drivers/tty/tty_io.c                 | 10 +++---
 fs/autofs/autofs_i.h                 |  1 +
 fs/exec.c                            |  1 +
 fs/fcntl.c                           | 38 ++++++++--------------
 fs/fuse/file.c                       |  1 +
 fs/locks.c                           |  2 +-
 fs/notify/dnotify/dnotify.c          |  3 +-
 fs/notify/fanotify/fanotify.c        |  1 +
 include/linux/init_task.h            |  9 ------
 include/linux/pid.h                  | 11 ++-----
 include/linux/sched.h                | 31 ++++--------------
 include/linux/sched/signal.h         | 39 +++++++++++++++++++++--
 include/linux/signal.h               |  6 ++--
 include/net/scm.h                    |  1 +
 include/trace/events/signal.h        | 12 +++----
 init/init_task.c                     | 12 ++++---
 kernel/events/core.c                 |  2 +-
 kernel/exit.c                        | 12 ++-----
 kernel/fork.c                        | 45 +++++++++++++++++++++-----
 kernel/pid.c                         | 42 ++++++++++++-------------
 kernel/signal.c                      | 61 ++++++++++++++++++++----------------
 kernel/time/itimer.c                 |  5 +--
 kernel/time/posix-cpu-timers.c       |  2 +-
 kernel/time/posix-timers.c           | 13 +++-----
 mm/oom_kill.c                        |  4 +--
 virt/kvm/kvm_main.c                  |  2 +-
 32 files changed, 205 insertions(+), 184 deletions(-)