Merge tag 'ptrace-cleanups-for-v5.18' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 29 Mar 2022 00:29:53 +0000 (17:29 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 29 Mar 2022 00:29:53 +0000 (17:29 -0700)
Pull ptrace cleanups from Eric Biederman:
 "This set of changes removes tracehook.h, moves modification of all of
  the ptrace fields inside of siglock to remove races, adds a missing
  permission check to ptrace.c

  The removal of tracehook.h is quite significant as it has been a major
  source of confusion in recent years. Much of that confusion was around
  task_work and TIF_NOTIFY_SIGNAL (which I have now decoupled making the
  semantics clearer).

  For people who don't know tracehook.h is a vestiage of an attempt to
  implement uprobes like functionality that was never fully merged, and
  was later superseeded by uprobes when uprobes was merged. For many
  years now we have been removing what tracehook functionaly a little
  bit at a time. To the point where anything left in tracehook.h was
  some weird strange thing that was difficult to understand"

* tag 'ptrace-cleanups-for-v5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace:
  ptrace: Remove duplicated include in ptrace.c
  ptrace: Check PTRACE_O_SUSPEND_SECCOMP permission on PTRACE_SEIZE
  ptrace: Return the signal to continue with from ptrace_stop
  ptrace: Move setting/clearing ptrace_message into ptrace_stop
  tracehook: Remove tracehook.h
  resume_user_mode: Move to resume_user_mode.h
  resume_user_mode: Remove #ifdef TIF_NOTIFY_RESUME in set_notify_resume
  signal: Move set_notify_signal and clear_notify_signal into sched/signal.h
  task_work: Decouple TIF_NOTIFY_SIGNAL and task_work
  task_work: Call tracehook_notify_signal from get_signal on all architectures
  task_work: Introduce task_work_pending
  task_work: Remove unnecessary include from posix_timers.h
  ptrace: Remove tracehook_signal_handler
  ptrace: Remove arch_syscall_{enter,exit}_tracehook
  ptrace: Create ptrace_report_syscall_{entry,exit} in ptrace.h
  ptrace/arm: Rename tracehook_report_syscall report_syscall
  ptrace: Move ptrace_report_syscall into ptrace.h

32 files changed:
1  2 
MAINTAINERS
arch/Kconfig
arch/arm64/kernel/signal.c
arch/csky/kernel/signal.c
arch/hexagon/kernel/process.c
arch/microblaze/kernel/signal.c
arch/mips/kernel/signal.c
arch/nios2/kernel/signal.c
arch/parisc/kernel/signal.c
arch/powerpc/kernel/ptrace/ptrace.c
arch/riscv/kernel/signal.c
arch/s390/kernel/ptrace.c
arch/s390/kernel/signal.c
arch/sparc/kernel/signal_32.c
arch/x86/kernel/ptrace.c
block/blk-cgroup.c
fs/coredump.c
fs/exec.c
fs/io-wq.c
fs/io_uring.c
fs/proc/base.c
include/linux/entry-common.h
include/linux/posix-timers.h
kernel/entry/common.c
kernel/exit.c
kernel/livepatch/transition.c
kernel/sched/fair.c
kernel/seccomp.c
kernel/signal.c
kernel/time/posix-cpu-timers.c
mm/memcontrol.c
security/selinux/hooks.c

diff --cc MAINTAINERS
Simple merge
diff --cc arch/Kconfig
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
@@@ -26,7 -26,9 +26,7 @@@
  #include <linux/delay.h>
  #include <linux/atomic.h>
  #include <linux/ctype.h>
- #include <linux/tracehook.h>
 -#include <linux/blk-cgroup.h>
+ #include <linux/resume_user_mode.h>
  #include <linux/psi.h>
  #include <linux/part_stat.h>
  #include "blk.h"
diff --cc fs/coredump.c
Simple merge
diff --cc fs/exec.c
Simple merge
diff --cc fs/io-wq.c
Simple merge
diff --cc fs/io_uring.c
Simple merge
diff --cc fs/proc/base.c
Simple merge
Simple merge
Simple merge
@@@ -2,8 -2,8 +2,9 @@@
  
  #include <linux/context_tracking.h>
  #include <linux/entry-common.h>
+ #include <linux/resume_user_mode.h>
  #include <linux/highmem.h>
 +#include <linux/jump_label.h>
  #include <linux/livepatch.h>
  #include <linux/audit.h>
  #include <linux/tick.h>
@@@ -139,28 -139,8 +140,20 @@@ void noinstr exit_to_user_mode(void
  }
  
  /* Workaround to allow gradual conversion of architecture code */
- void __weak arch_do_signal_or_restart(struct pt_regs *regs, bool has_signal) { }
- static void handle_signal_work(struct pt_regs *regs, unsigned long ti_work)
- {
-       if (ti_work & _TIF_NOTIFY_SIGNAL)
-               tracehook_notify_signal();
-       arch_do_signal_or_restart(regs, ti_work & _TIF_SIGPENDING);
- }
+ void __weak arch_do_signal_or_restart(struct pt_regs *regs) { }
  
 +#ifdef CONFIG_RT_DELAYED_SIGNALS
 +static inline void raise_delayed_signal(void)
 +{
 +      if (unlikely(current->forced_info.si_signo)) {
 +              force_sig_info(&current->forced_info);
 +              current->forced_info.si_signo = 0;
 +      }
 +}
 +#else
 +static inline void raise_delayed_signal(void) { }
 +#endif
 +
  static unsigned long exit_to_user_mode_loop(struct pt_regs *regs,
                                            unsigned long ti_work)
  {
diff --cc kernel/exit.c
Simple merge
Simple merge
   *  Adaptive scheduling granularity, math enhancements by Peter Zijlstra
   *  Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra
   */
 +#include <linux/energy_model.h>
 +#include <linux/mmap_lock.h>
 +#include <linux/hugetlb_inline.h>
 +#include <linux/jiffies.h>
 +#include <linux/mm_api.h>
 +#include <linux/highmem.h>
 +#include <linux/spinlock_api.h>
 +#include <linux/cpumask_api.h>
 +#include <linux/lockdep_api.h>
 +#include <linux/softirq.h>
 +#include <linux/refcount_api.h>
 +#include <linux/topology.h>
 +#include <linux/sched/clock.h>
 +#include <linux/sched/cond_resched.h>
 +#include <linux/sched/cputime.h>
 +#include <linux/sched/isolation.h>
 +
 +#include <linux/cpuidle.h>
 +#include <linux/interrupt.h>
 +#include <linux/mempolicy.h>
 +#include <linux/mutex_api.h>
 +#include <linux/profile.h>
 +#include <linux/psi.h>
 +#include <linux/ratelimit.h>
++#include <linux/task_work.h>
 +
 +#include <asm/switch_to.h>
 +
 +#include <linux/sched/cond_resched.h>
 +
  #include "sched.h"
 +#include "stats.h"
 +#include "autogroup.h"
  
  /*
   * Targeted preemption latency for CPU-bound tasks:
Simple merge
diff --cc kernel/signal.c
Simple merge
Simple merge
diff --cc mm/memcontrol.c
Simple merge
Simple merge