Merge branch 'signal-for-v5.17' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 17 Jan 2022 03:49:30 +0000 (05:49 +0200)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 17 Jan 2022 03:49:30 +0000 (05:49 +0200)
Pull signal/exit/ptrace updates from Eric Biederman:
 "This set of changes deletes some dead code, makes a lot of cleanups
  which hopefully make the code easier to follow, and fixes bugs found
  along the way.

  The end-game which I have not yet reached yet is for fatal signals
  that generate coredumps to be short-circuit deliverable from
  complete_signal, for force_siginfo_to_task not to require changing
  userspace configured signal delivery state, and for the ptrace stops
  to always happen in locations where we can guarantee on all
  architectures that the all of the registers are saved and available on
  the stack.

  Removal of profile_task_ext, profile_munmap, and profile_handoff_task
  are the big successes for dead code removal this round.

  A bunch of small bug fixes are included, as most of the issues
  reported were small enough that they would not affect bisection so I
  simply added the fixes and did not fold the fixes into the changes
  they were fixing.

  There was a bug that broke coredumps piped to systemd-coredump. I
  dropped the change that caused that bug and replaced it entirely with
  something much more restrained. Unfortunately that required some
  rebasing.

  Some successes after this set of changes: There are few enough calls
  to do_exit to audit in a reasonable amount of time. The lifetime of
  struct kthread now matches the lifetime of struct task, and the
  pointer to struct kthread is no longer stored in set_child_tid. The
  flag SIGNAL_GROUP_COREDUMP is removed. The field group_exit_task is
  removed. Issues where task->exit_code was examined with
  signal->group_exit_code should been examined were fixed.

  There are several loosely related changes included because I am
  cleaning up and if I don't include them they will probably get lost.

  The original postings of these changes can be found at:
     https://lkml.kernel.org/r/87a6ha4zsd.fsf@email.froward.int.ebiederm.org
     https://lkml.kernel.org/r/87bl1kunjj.fsf@email.froward.int.ebiederm.org
     https://lkml.kernel.org/r/87r19opkx1.fsf_-_@email.froward.int.ebiederm.org

  I trimmed back the last set of changes to only the obviously correct
  once. Simply because there was less time for review than I had hoped"

* 'signal-for-v5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace: (44 commits)
  ptrace/m68k: Stop open coding ptrace_report_syscall
  ptrace: Remove unused regs argument from ptrace_report_syscall
  ptrace: Remove second setting of PT_SEIZED in ptrace_attach
  taskstats: Cleanup the use of task->exit_code
  exit: Use the correct exit_code in /proc/<pid>/stat
  exit: Fix the exit_code for wait_task_zombie
  exit: Coredumps reach do_group_exit
  exit: Remove profile_handoff_task
  exit: Remove profile_task_exit & profile_munmap
  signal: clean up kernel-doc comments
  signal: Remove the helper signal_group_exit
  signal: Rename group_exit_task group_exec_task
  coredump: Stop setting signal->group_exit_task
  signal: Remove SIGNAL_GROUP_COREDUMP
  signal: During coredumps set SIGNAL_GROUP_EXIT in zap_process
  signal: Make coredump handling explicit in complete_signal
  signal: Have prepare_signal detect coredumps using signal->core_state
  signal: Have the oom killer detect coredumps using signal->core_state
  exit: Move force_uaccess back into do_exit
  exit: Guarantee make_task_dead leaks the tsk when calling do_task_exit
  ...

36 files changed:
1  2 
arch/alpha/mm/fault.c
arch/arm/kernel/traps.c
arch/arm/mm/fault.c
arch/arm64/kernel/traps.c
arch/arm64/mm/fault.c
arch/csky/kernel/traps.c
arch/ia64/mm/fault.c
arch/m68k/mm/fault.c
arch/parisc/kernel/traps.c
arch/riscv/mm/fault.c
arch/s390/kernel/nmi.c
arch/x86/entry/entry_32.S
arch/x86/entry/entry_64.S
drivers/net/wireless/rsi/rsi_91x_main.c
fs/cifs/connect.c
fs/io-wq.c
fs/io-wq.h
fs/lockd/svc.c
fs/nfs/callback.c
fs/nfs/nfs4state.c
fs/nfsd/nfssvc.c
fs/signalfd.c
include/linux/kthread.h
include/linux/sched.h
include/linux/sched/task.h
include/linux/sunrpc/svc.h
kernel/fork.c
kernel/futex/core.c
kernel/kthread.c
kernel/module.c
kernel/sched/core.c
kernel/signal.c
mm/mmap.c
mm/oom_kill.c
net/bluetooth/cmtp/core.c
tools/objtool/check.c

Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc fs/io-wq.c
Simple merge
diff --cc fs/io-wq.h
Simple merge
diff --cc fs/lockd/svc.c
@@@ -180,12 -184,7 +180,12 @@@ lockd(void *vrqstp
        nlm_shutdown_hosts();
        cancel_delayed_work_sync(&ln->grace_period_end);
        locks_end_grace(&ln->lockd_manager);
 -      return 0;
 +
 +      dprintk("lockd_down: service stopped\n");
 +
 +      svc_exit_thread(rqstp);
 +
-       module_put_and_exit(0);
++      module_put_and_kthread_exit(0);
  }
  
  static int create_lockd_listener(struct svc_serv *serv, const char *name,
Simple merge
Simple merge
        /* Release the thread */
        svc_exit_thread(rqstp);
  
 -      nfsd_destroy(net);
 +      /* We need to drop a ref, but may not drop the last reference
 +       * without holding nfsd_mutex, and we cannot wait for nfsd_mutex as that
 +       * could deadlock with nfsd_shutdown_threads() waiting for us.
 +       * So three options are:
 +       * - drop a non-final reference,
 +       * - get the mutex without waiting
 +       * - sleep briefly andd try the above again
 +       */
 +      while (!svc_put_not_last(nn->nfsd_serv)) {
 +              if (mutex_trylock(&nfsd_mutex)) {
 +                      nfsd_put(net);
 +                      mutex_unlock(&nfsd_mutex);
 +                      break;
 +              }
 +              msleep(20);
 +      }
  
        /* Release module */
-       module_put_and_exit(0);
 -      mutex_unlock(&nfsd_mutex);
+       module_put_and_kthread_exit(0);
        return 0;
  }
  
diff --cc fs/signalfd.c
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -64,9 -64,10 +64,9 @@@ struct svc_serv_ops 
        /* queue up a transport for servicing */
        void            (*svo_enqueue_xprt)(struct svc_xprt *);
  
 -      /* set up thread (or whatever) execution context */
 -      int             (*svo_setup)(struct svc_serv *, struct svc_pool *, int);
 -
 -      /* optional module to count when adding threads (pooled svcs only) */
 +      /* optional module to count when adding threads.
-        * Thread function must call module_put_and_exit() to exit.
++       * Thread function must call module_put_and_kthread_exit() to exit.
 +       */
        struct module   *svo_module;
  };
  
diff --cc kernel/fork.c
Simple merge
Simple merge
Simple merge
diff --cc kernel/module.c
Simple merge
Simple merge
diff --cc kernel/signal.c
Simple merge
diff --cc mm/mmap.c
Simple merge
diff --cc mm/oom_kill.c
Simple merge
Simple merge
Simple merge