/usr/include/compel/asm/sigframe.h is in criu 3.6-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | #ifndef UAPI_COMPEL_ASM_SIGFRAME_H__
#define UAPI_COMPEL_ASM_SIGFRAME_H__
#include <stdint.h>
#include <stdbool.h>
#include <compel/asm/fpu.h>
#include <compel/plugins/std/syscall-codes.h>
#define SIGFRAME_MAX_OFFSET 8
struct rt_sigcontext {
unsigned long r8;
unsigned long r9;
unsigned long r10;
unsigned long r11;
unsigned long r12;
unsigned long r13;
unsigned long r14;
unsigned long r15;
unsigned long rdi;
unsigned long rsi;
unsigned long rbp;
unsigned long rbx;
unsigned long rdx;
unsigned long rax;
unsigned long rcx;
unsigned long rsp;
unsigned long rip;
unsigned long eflags;
unsigned short cs;
unsigned short gs;
unsigned short fs;
unsigned short ss;
unsigned long err;
unsigned long trapno;
unsigned long oldmask;
unsigned long cr2;
void *fpstate;
unsigned long reserved1[8];
};
struct rt_sigcontext_32 {
uint32_t gs;
uint32_t fs;
uint32_t es;
uint32_t ds;
uint32_t di;
uint32_t si;
uint32_t bp;
uint32_t sp;
uint32_t bx;
uint32_t dx;
uint32_t cx;
uint32_t ax;
uint32_t trapno;
uint32_t err;
uint32_t ip;
uint32_t cs;
uint32_t flags;
uint32_t sp_at_signal;
uint32_t ss;
uint32_t fpstate;
uint32_t oldmask;
uint32_t cr2;
};
#include <compel/sigframe-common.h>
/*
* XXX: move declarations to generic sigframe.h or sigframe-compat.h
* when (if) other architectures will support compatible C/R
*/
typedef uint32_t compat_uptr_t;
typedef uint32_t compat_size_t;
typedef struct compat_siginfo {
int si_signo;
int si_errno;
int si_code;
int _pad[128/sizeof(int) - 3];
} compat_siginfo_t;
typedef struct compat_sigaltstack {
compat_uptr_t ss_sp;
int ss_flags;
compat_size_t ss_size;
} compat_stack_t;
struct ucontext_ia32 {
unsigned int uc_flags;
unsigned int uc_link;
compat_stack_t uc_stack;
struct rt_sigcontext_32 uc_mcontext;
k_rtsigset_t uc_sigmask; /* mask last for extensibility */
} __packed;
struct rt_sigframe_ia32 {
uint32_t pretcode;
int32_t sig;
uint32_t pinfo;
uint32_t puc;
compat_siginfo_t info;
struct ucontext_ia32 uc;
char retcode[8];
/* fp state follows here */
fpu_state_t fpu_state;
};
struct rt_sigframe_64 {
char *pretcode;
struct rt_ucontext uc;
struct rt_siginfo info;
/* fp state follows here */
fpu_state_t fpu_state;
};
struct rt_sigframe {
union {
struct rt_sigframe_ia32 compat;
struct rt_sigframe_64 native;
};
bool is_native;
};
#define RT_SIGFRAME_UC_SIGMASK(rt_sigframe) \
((rt_sigframe->is_native) ? \
(&rt_sigframe->native.uc.uc_sigmask) : \
((k_rtsigset_t *)(void *)&rt_sigframe->compat.uc.uc_sigmask))
#define RT_SIGFRAME_REGIP(rt_sigframe) \
((rt_sigframe->is_native) ? \
(rt_sigframe)->native.uc.uc_mcontext.rip : \
(rt_sigframe)->compat.uc.uc_mcontext.ip)
#define RT_SIGFRAME_FPU(rt_sigframe) \
((rt_sigframe->is_native) ? \
(&(rt_sigframe)->native.fpu_state) : \
(&(rt_sigframe)->compat.fpu_state))
#define RT_SIGFRAME_HAS_FPU(rt_sigframe) (RT_SIGFRAME_FPU(rt_sigframe)->has_fpu)
/*
* Sigframe offset is different for native/compat tasks.
* Offsets calculations one may see at kernel:
* - compatible is in sys32_rt_sigreturn at arch/x86/ia32/ia32_signal.c
* - native is in sys_rt_sigreturn at arch/x86/kernel/signal.c
*/
#define RT_SIGFRAME_OFFSET(rt_sigframe) (((rt_sigframe)->is_native) ? 8 : 4 )
#define USER32_CS 0x23
#define ARCH_RT_SIGRETURN_NATIVE(new_sp) \
asm volatile( \
"movq %0, %%rax \n" \
"movq %%rax, %%rsp \n" \
"movl $"__stringify(__NR_rt_sigreturn)", %%eax \n" \
"syscall \n" \
: \
: "r"(new_sp) \
: "rax","rsp","memory")
#define ARCH_RT_SIGRETURN_COMPAT(new_sp) \
asm volatile( \
"pushq $"__stringify(USER32_CS)" \n" \
"pushq $1f \n" \
"lretq \n" \
"1: \n" \
".code32 \n" \
"movl %%edi, %%esp \n" \
"movl $"__stringify(__NR32_rt_sigreturn)",%%eax \n" \
"int $0x80 \n" \
".code64 \n" \
: \
: "rdi"(new_sp) \
: "eax","esp", "r8", "r9", "r10", "r11", "memory")
#define ARCH_RT_SIGRETURN(new_sp, rt_sigframe) \
do { \
if ((rt_sigframe)->is_native) \
ARCH_RT_SIGRETURN_NATIVE(new_sp); \
else \
ARCH_RT_SIGRETURN_COMPAT(new_sp); \
} while (0)
int sigreturn_prep_fpu_frame(struct rt_sigframe *sigframe,
struct rt_sigframe *rsigframe);
#endif /* UAPI_COMPEL_ASM_SIGFRAME_H__ */
|