Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

signal: Remove the generic __ARCH_SI_TRAPNO support

Now that __ARCH_SI_TRAPNO is no longer set by any architecture remove
all of the code it enabled from the kernel.

On alpha and sparc a more explict approach of using
send_sig_fault_trapno or force_sig_fault_trapno in the very limited
circumstances where si_trapno was set to a non-zero value.

The generic support that is being removed always set si_trapno on all
fault signals. With only SIGILL ILL_ILLTRAP on sparc and SIGFPE and
SIGTRAP TRAP_UNK on alpla providing si_trapno values asking all senders
of fault signals to provide an si_trapno value does not make sense.

Making si_trapno an ordinary extension of the fault siginfo layout has
enabled the architecture generic implementation of SIGTRAP TRAP_PERF,
and enables other faulting signals to grow architecture generic
senders as well.

v1: https://lkml.kernel.org/r/m18s4zs7nu.fsf_-_@fess.ebiederm.org
v2: https://lkml.kernel.org/r/20210505141101.11519-8-ebiederm@xmission.com
Link: https://lkml.kernel.org/r/87bl73xx6x.fsf_-_@disp2133
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>

-24
-2
arch/mips/include/uapi/asm/siginfo.h
··· 10 10 #ifndef _UAPI_ASM_SIGINFO_H 11 11 #define _UAPI_ASM_SIGINFO_H 12 12 13 - 14 13 #define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(long) + 2*sizeof(int)) 15 - #undef __ARCH_SI_TRAPNO /* exception code needs to fill this ... */ 16 14 17 15 #define __ARCH_HAS_SWAPPED_SIGINFO 18 16
-8
include/linux/sched/signal.h
··· 298 298 299 299 schedule(); 300 300 } 301 - #ifdef __ARCH_SI_TRAPNO 302 - # define ___ARCH_SI_TRAPNO(_a1) , _a1 303 - #else 304 - # define ___ARCH_SI_TRAPNO(_a1) 305 - #endif 306 301 #ifdef __ia64__ 307 302 # define ___ARCH_SI_IA64(_a1, _a2, _a3) , _a1, _a2, _a3 308 303 #else ··· 305 310 #endif 306 311 307 312 int force_sig_fault_to_task(int sig, int code, void __user *addr 308 - ___ARCH_SI_TRAPNO(int trapno) 309 313 ___ARCH_SI_IA64(int imm, unsigned int flags, unsigned long isr) 310 314 , struct task_struct *t); 311 315 int force_sig_fault(int sig, int code, void __user *addr 312 - ___ARCH_SI_TRAPNO(int trapno) 313 316 ___ARCH_SI_IA64(int imm, unsigned int flags, unsigned long isr)); 314 317 int send_sig_fault(int sig, int code, void __user *addr 315 - ___ARCH_SI_TRAPNO(int trapno) 316 318 ___ARCH_SI_IA64(int imm, unsigned int flags, unsigned long isr) 317 319 , struct task_struct *t); 318 320
-14
kernel/signal.c
··· 1666 1666 } 1667 1667 1668 1668 int force_sig_fault_to_task(int sig, int code, void __user *addr 1669 - ___ARCH_SI_TRAPNO(int trapno) 1670 1669 ___ARCH_SI_IA64(int imm, unsigned int flags, unsigned long isr) 1671 1670 , struct task_struct *t) 1672 1671 { ··· 1676 1677 info.si_errno = 0; 1677 1678 info.si_code = code; 1678 1679 info.si_addr = addr; 1679 - #ifdef __ARCH_SI_TRAPNO 1680 - info.si_trapno = trapno; 1681 - #endif 1682 1680 #ifdef __ia64__ 1683 1681 info.si_imm = imm; 1684 1682 info.si_flags = flags; ··· 1685 1689 } 1686 1690 1687 1691 int force_sig_fault(int sig, int code, void __user *addr 1688 - ___ARCH_SI_TRAPNO(int trapno) 1689 1692 ___ARCH_SI_IA64(int imm, unsigned int flags, unsigned long isr)) 1690 1693 { 1691 1694 return force_sig_fault_to_task(sig, code, addr 1692 - ___ARCH_SI_TRAPNO(trapno) 1693 1695 ___ARCH_SI_IA64(imm, flags, isr), current); 1694 1696 } 1695 1697 1696 1698 int send_sig_fault(int sig, int code, void __user *addr 1697 - ___ARCH_SI_TRAPNO(int trapno) 1698 1699 ___ARCH_SI_IA64(int imm, unsigned int flags, unsigned long isr) 1699 1700 , struct task_struct *t) 1700 1701 { ··· 1702 1709 info.si_errno = 0; 1703 1710 info.si_code = code; 1704 1711 info.si_addr = addr; 1705 - #ifdef __ARCH_SI_TRAPNO 1706 - info.si_trapno = trapno; 1707 - #endif 1708 1712 #ifdef __ia64__ 1709 1713 info.si_imm = imm; 1710 1714 info.si_flags = flags; ··· 3273 3283 ((sig == SIGFPE) || 3274 3284 ((sig == SIGTRAP) && (si_code == TRAP_UNK)))) 3275 3285 layout = SIL_FAULT_TRAPNO; 3276 - #ifdef __ARCH_SI_TRAPNO 3277 - else if (layout == SIL_FAULT) 3278 - layout = SIL_FAULT_TRAPNO; 3279 - #endif 3280 3286 } 3281 3287 else if (si_code <= NSIGPOLL) 3282 3288 layout = SIL_POLL;