Re: [PATCH 3/3] signal: Use dedicated helpers to send signals with si_trapno set

From: Marco Elver
Date: Sat May 01 2021 - 06:34:14 EST


On Sat, 1 May 2021 at 00:55, Eric W. Biederman <ebiederm@xxxxxxxxxxxx> wrote:
>
> Now that si_trapno is no longer expected to be present for every fault
> reported using siginfo on alpha and sparc remove the trapno parameter
> from force_sig_fault, force_sig_fault_to_task and send_sig_fault.
>
> Add two new helpers force_sig_fault_trapno and send_sig_fault_trapno
> for those signals where trapno is expected to be set.
>
> Signed-off-by: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx>
> ---
> arch/alpha/kernel/osf_sys.c | 2 +-
> arch/alpha/kernel/signal.c | 4 +--
> arch/alpha/kernel/traps.c | 24 ++++++++---------
> arch/alpha/mm/fault.c | 4 +--
> arch/sparc/kernel/process_64.c | 2 +-
> arch/sparc/kernel/sys_sparc_32.c | 2 +-
> arch/sparc/kernel/sys_sparc_64.c | 2 +-
> arch/sparc/kernel/traps_32.c | 22 ++++++++--------
> arch/sparc/kernel/traps_64.c | 44 ++++++++++++++------------------
> arch/sparc/kernel/unaligned_32.c | 2 +-
> arch/sparc/mm/fault_32.c | 2 +-
> arch/sparc/mm/fault_64.c | 2 +-
> include/linux/sched/signal.h | 12 +++------
> kernel/signal.c | 41 +++++++++++++++++++++--------
> 14 files changed, 88 insertions(+), 77 deletions(-)

This still breaks sparc64:

> sparc64-linux-gnu-ld: arch/sparc/kernel/traps_64.o: in function `bad_trap':
> (.text+0x2a4): undefined reference to `force_sig_fault_trapno'

[...]
> +#if IS_ENABLED(SPARC)

This should be 'IS_ENABLED(CONFIG_SPARC)'.

> +int force_sig_fault_trapno(int sig, int code, void __user *addr, int trapno)
> +{
> + struct kernel_siginfo info;
> +
> + clear_siginfo(&info);
> + info.si_signo = sig;
> + info.si_errno = 0;
> + info.si_code = code;
> + info.si_addr = addr;
> + info.si_trapno = trapno;
> + return force_sig_info(&info);
> +}
> +#endif
> +
> +#if IS_ENABLED(ALPHA)

CONFIG_ALPHA


> +int send_sig_fault_trapno(int sig, int code, void __user *addr, int trapno,
> + struct task_struct *t)
> +{
> + struct kernel_siginfo info;
> +
> + clear_siginfo(&info);
> + info.si_signo = sig;
> + info.si_errno = 0;
> + info.si_code = code;
> + info.si_addr = addr;
> + info.si_trapno = trapno;
> + return send_sig_info(info.si_signo, &info, t);
> +}
> +#endif
> +
> /* For the crazy architectures that include trap information in
> * the errno field, instead of an actual errno value.
> */
> --
> 2.30.1
>