File Index
Files and directories
Sign in
FILE

sighandling.h

File preview with syntax highlighting.

linux-6.19.14/arch/x86/include/asm/sighandling.h C
 1/* SPDX-License-Identifier: GPL-2.0 */
 2#ifndef _ASM_X86_SIGHANDLING_H
 3#define _ASM_X86_SIGHANDLING_H
 4
 5#include <linux/compiler.h>
 6#include <linux/ptrace.h>
 7#include <linux/signal.h>
 8
 9#include <asm/processor-flags.h>
10
11#define FIX_EFLAGS	(X86_EFLAGS_AC | X86_EFLAGS_OF | \
12			 X86_EFLAGS_DF | X86_EFLAGS_TF | X86_EFLAGS_SF | \
13			 X86_EFLAGS_ZF | X86_EFLAGS_AF | X86_EFLAGS_PF | \
14			 X86_EFLAGS_CF | X86_EFLAGS_RF)
15
16void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
17
18void __user *
19get_sigframe(struct ksignal *ksig, struct pt_regs *regs, size_t frame_size,
20	     void __user **fpstate);
21
22int ia32_setup_frame(struct ksignal *ksig, struct pt_regs *regs);
23int ia32_setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs);
24int x64_setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs);
25int x32_setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs);
26
27/*
28 * To prevent immediate repeat of single step trap on return from SIGTRAP
29 * handler if the trap flag (TF) is set without an external debugger attached,
30 * clear the software event flag in the augmented SS, ensuring no single-step
31 * trap is pending upon ERETU completion.
32 *
33 * Note, this function should be called in sigreturn() before the original
34 * state is restored to make sure the TF is read from the entry frame.
35 */
36static __always_inline void prevent_single_step_upon_eretu(struct pt_regs *regs)
37{
38	/*
39	 * If the trap flag (TF) is set, i.e., the sigreturn() SYSCALL instruction
40	 * is being single-stepped, do not clear the software event flag in the
41	 * augmented SS, thus a debugger won't skip over the following instruction.
42	 */
43#ifdef CONFIG_X86_FRED
44	if (!(regs->flags & X86_EFLAGS_TF))
45		regs->fred_ss.swevent = 0;
46#endif
47}
48
49#endif /* _ASM_X86_SIGHANDLING_H */
~/ Read-only file preview.