linux/arch/x86/kernel/signal_32.c

// SPDX-License-Identifier: GPL-2.0
/*
 *  Copyright (C) 1991, 1992  Linus Torvalds
 *
 *  1997-11-28  Modified for POSIX.1b signals by Richard Henderson
 *  2000-06-20  Pentium III FXSR, SSE support by Gareth Hughes
 *  2000-12-*   x86-64 compatibility mode signal handling by Andi Kleen
 */

#include <linux/sched.h>
#include <linux/sched/task_stack.h>
#include <linux/mm.h>
#include <linux/smp.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/wait.h>
#include <linux/unistd.h>
#include <linux/stddef.h>
#include <linux/personality.h>
#include <linux/compat.h>
#include <linux/binfmts.h>
#include <linux/syscalls.h>
#include <asm/ucontext.h>
#include <linux/uaccess.h>
#include <asm/fpu/signal.h>
#include <asm/ptrace.h>
#include <asm/user32.h>
#include <uapi/asm/sigcontext.h>
#include <asm/proto.h>
#include <asm/vdso.h>
#include <asm/sigframe.h>
#include <asm/sighandling.h>
#include <asm/smap.h>
#include <asm/gsseg.h>

#ifdef CONFIG_IA32_EMULATION
#include <asm/unistd_32_ia32.h>

static inline void reload_segments(struct sigcontext_32 *sc)
{}

#define sigset32_t
#define siginfo32_t
#define restore_altstack32
#define unsafe_save_altstack32

#else

#define sigset32_t
#define siginfo32_t
#define __NR_ia32_sigreturn
#define __NR_ia32_rt_sigreturn
#define restore_altstack32
#define unsafe_save_altstack32
#define __copy_siginfo_to_user32

#endif

/*
 * Do a signal return; undo the signal stack.
 */
static bool ia32_restore_sigcontext(struct pt_regs *regs,
				    struct sigcontext_32 __user *usc)
{}

SYSCALL32_DEFINE0(sigreturn)
{}

SYSCALL32_DEFINE0(rt_sigreturn)
{}

/*
 * Set up a signal frame.
 */

#define get_user_seg(seg)

static __always_inline int
__unsafe_setup_sigcontext32(struct sigcontext_32 __user *sc,
			    void __user *fpstate,
			    struct pt_regs *regs, unsigned int mask)
{}

#define unsafe_put_sigcontext32(sc, fp, regs, set, label)

int ia32_setup_frame(struct ksignal *ksig, struct pt_regs *regs)
{}

int ia32_setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs)
{}

/*
 * The siginfo_t structure and handing code is very easy
 * to break in several ways.  It must always be updated when new
 * updates are made to the main siginfo_t, and
 * copy_siginfo_to_user32() must be updated when the
 * (arch-independent) copy_siginfo_to_user() is updated.
 *
 * It is also easy to put a new member in the siginfo_t
 * which has implicit alignment which can move internal structure
 * alignment around breaking the ABI.  This can happen if you,
 * for instance, put a plain 64-bit value in there.
 */

/*
* If adding a new si_code, there is probably new data in
* the siginfo.  Make sure folks bumping the si_code
* limits also have to look at this code.  Make sure any
* new fields are handled in copy_siginfo_to_user32()!
*/
static_assert();
static_assert();
static_assert();
static_assert();
static_assert();
static_assert();
static_assert();

/* This is part of the ABI and can never change in size: */
static_assert();

/* This is a part of the ABI and can never change in alignment */
static_assert();

/*
* The offsets of all the (unioned) si_fields are fixed
* in the ABI, of course.  Make sure none of them ever
* move and are always at the beginning:
*/
static_assert();

static_assert();
static_assert();
static_assert();

/*
* Ensure that the size of each si_field never changes.
* If it does, it is a sign that the
* copy_siginfo_to_user32() code below needs to updated
* along with the size in the CHECK_SI_SIZE().
*
* We repeat this check for both the generic and compat
* siginfos.
*
* Note: it is OK for these to grow as long as the whole
* structure stays within the padding size (checked
* above).
*/

#define CHECK_SI_OFFSET(name)

#define CHECK_SI_SIZE(name, size)

CHECK_SI_OFFSET();
CHECK_SI_SIZE();
static_assert();
static_assert();

CHECK_SI_OFFSET();
#ifdef CONFIG_COMPAT
/* compat_siginfo_t doesn't have si_sys_private */
CHECK_SI_SIZE();
#else
CHECK_SI_SIZE  (_timer, 4*sizeof(int));
#endif
static_assert();
static_assert();
static_assert();

CHECK_SI_OFFSET();
CHECK_SI_SIZE();
static_assert();
static_assert();
static_assert();

CHECK_SI_OFFSET();
CHECK_SI_SIZE();
static_assert();
static_assert();
static_assert();
static_assert();
static_assert();

CHECK_SI_OFFSET();
CHECK_SI_SIZE();
static_assert();

static_assert();

static_assert();

static_assert();
static_assert();

static_assert();

static_assert();
static_assert();
static_assert();

CHECK_SI_OFFSET();
CHECK_SI_SIZE();
static_assert();
static_assert();

CHECK_SI_OFFSET();
CHECK_SI_SIZE();
static_assert();
static_assert();
static_assert();

/* any new si_fields should be added here */