linux/arch/x86/kernel/signal_64.c

// SPDX-License-Identifier: GPL-2.0
/*
 *  Copyright (C) 1991, 1992  Linus Torvalds
 *  Copyright (C) 2000, 2001, 2002 Andi Kleen SuSE Labs
 */

#define pr_fmt(fmt)

#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/unistd.h>
#include <linux/uaccess.h>
#include <linux/syscalls.h>

#include <asm/ucontext.h>
#include <asm/fpu/signal.h>
#include <asm/sighandling.h>

#include <asm/syscall.h>
#include <asm/sigframe.h>
#include <asm/signal.h>

/*
 * If regs->ss will cause an IRET fault, change it.  Otherwise leave it
 * alone.  Using this generally makes no sense unless
 * user_64bit_mode(regs) would return true.
 */
static void force_valid_ss(struct pt_regs *regs)
{}

static bool restore_sigcontext(struct pt_regs *regs,
			       struct sigcontext __user *usc,
			       unsigned long uc_flags)
{}

static __always_inline int
__unsafe_setup_sigcontext(struct sigcontext __user *sc, void __user *fpstate,
		     struct pt_regs *regs, unsigned long mask)
{}

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

#define unsafe_put_sigmask(set, frame, label)

static unsigned long frame_uc_flags(struct pt_regs *regs)
{}

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

/*
 * Do a signal return; undo the signal stack.
 */
SYSCALL_DEFINE0(rt_sigreturn)
{}

#ifdef CONFIG_X86_X32_ABI
static int x32_copy_siginfo_to_user(struct compat_siginfo __user *to,
		const struct kernel_siginfo *from)
{}

int copy_siginfo_to_user32(struct compat_siginfo __user *to,
			   const struct kernel_siginfo *from)
{}

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

COMPAT_SYSCALL_DEFINE0(x32_rt_sigreturn)
{}
#endif /* CONFIG_X86_X32_ABI */

#ifdef CONFIG_COMPAT
void sigaction_compat_abi(struct k_sigaction *act, struct k_sigaction *oact)
{}
#endif /* CONFIG_COMPAT */

/*
* 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();

/*
* 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();
CHECK_SI_SIZE();
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();

#ifdef CONFIG_X86_X32_ABI
/* no _sigchld_x32 in the generic siginfo_t */
static_assert();
static_assert();
static_assert();
static_assert();
#endif

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 */