]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
signal: Use force_sig_fault_to_task for the two calls that don't deliver to current
authorEric W. Biederman <ebiederm@xmission.com>
Wed, 6 Feb 2019 22:39:13 +0000 (16:39 -0600)
committerEric W. Biederman <ebiederm@xmission.com>
Wed, 29 May 2019 14:31:43 +0000 (09:31 -0500)
In preparation for removing the task parameter from force_sig_fault
introduce force_sig_fault_to_task and use it for the two cases where
it matters.

On mips force_fcr31_sig calls force_sig_fault and is called on either
the current task, or a task that is suspended and is being switched to
by the scheduler.  This is safe because the task being switched to by
the scheduler is guaranteed to be suspended.  This ensures that
task->sighand is stable while the signal is delivered to it.

On parisc user_enable_single_step calls force_sig_fault and is in turn
called by ptrace_request.  The function ptrace_request always calls
user_enable_single_step on a child that is stopped for tracing.  The
child being traced and not reaped ensures that child->sighand is not
NULL, and that the child will not change child->sighand.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
arch/mips/kernel/traps.c
arch/parisc/kernel/ptrace.c
include/linux/sched/signal.h
kernel/signal.c

index a6031b045b95c904647e6169b5d14f5f412cce8f..62df48b6fb4622cb14b3c97ef3204bfdaf685fc7 100644 (file)
@@ -733,7 +733,7 @@ void force_fcr31_sig(unsigned long fcr31, void __user *fault_addr,
        else if (fcr31 & FPU_CSR_INE_X)
                si_code = FPE_FLTRES;
 
-       force_sig_fault(SIGFPE, si_code, fault_addr, tsk);
+       force_sig_fault_to_task(SIGFPE, si_code, fault_addr, tsk);
 }
 
 int process_fpemu_return(int sig, void __user *fault_addr, unsigned long fcr31)
index a3d2fb4e6dd2670f05639fc6e3598096611947c1..f642ba378ffa5fdbc827678e3ec2927ddd80ebf1 100644 (file)
@@ -88,9 +88,9 @@ void user_enable_single_step(struct task_struct *task)
                ptrace_disable(task);
                /* Don't wake up the task, but let the
                   parent know something happened. */
-               force_sig_fault(SIGTRAP, TRAP_TRACE,
-                               (void __user *) (task_regs(task)->iaoq[0] & ~3),
-                               task);
+               force_sig_fault_to_task(SIGTRAP, TRAP_TRACE,
+                                       (void __user *) (task_regs(task)->iaoq[0] & ~3),
+                                       task);
                /* notify_parent(task, SIGCHLD); */
                return;
        }
index 4178bb1f7709db9b91138336a5041d1529938bff..507af66a1fc8530f0a95842d212758df73a9223f 100644 (file)
@@ -307,6 +307,10 @@ static inline void kernel_signal_stop(void)
 # define ___ARCH_SI_IA64(_a1, _a2, _a3)
 #endif
 
+int force_sig_fault_to_task(int sig, int code, void __user *addr
+       ___ARCH_SI_TRAPNO(int trapno)
+       ___ARCH_SI_IA64(int imm, unsigned int flags, unsigned long isr)
+       , struct task_struct *t);
 int force_sig_fault(int sig, int code, void __user *addr
        ___ARCH_SI_TRAPNO(int trapno)
        ___ARCH_SI_IA64(int imm, unsigned int flags, unsigned long isr)
index 398489facf9fa0fe974b948429e43c406efc9563..e420489ac4c971c225dc4763f34f9ea3ec62c9ea 100644 (file)
@@ -1620,7 +1620,7 @@ void force_sigsegv(int sig)
        force_sig(SIGSEGV);
 }
 
-int force_sig_fault(int sig, int code, void __user *addr
+int force_sig_fault_to_task(int sig, int code, void __user *addr
        ___ARCH_SI_TRAPNO(int trapno)
        ___ARCH_SI_IA64(int imm, unsigned int flags, unsigned long isr)
        , struct task_struct *t)
@@ -1643,6 +1643,16 @@ int force_sig_fault(int sig, int code, void __user *addr
        return force_sig_info(info.si_signo, &info, t);
 }
 
+int force_sig_fault(int sig, int code, void __user *addr
+       ___ARCH_SI_TRAPNO(int trapno)
+       ___ARCH_SI_IA64(int imm, unsigned int flags, unsigned long isr)
+       , struct task_struct *t)
+{
+       return force_sig_fault_to_task(sig, code, addr
+                                      ___ARCH_SI_TRAPNO(trapno)
+                                      ___ARCH_SI_IA64(imm, flags, isr), t);
+}
+
 int send_sig_fault(int sig, int code, void __user *addr
        ___ARCH_SI_TRAPNO(int trapno)
        ___ARCH_SI_IA64(int imm, unsigned int flags, unsigned long isr)