.. | .. |
---|
10 | 10 | #include <asm/ptrace.h> |
---|
11 | 11 | #include <asm/user.h> |
---|
12 | 12 | #include <asm/auxvec.h> |
---|
| 13 | +#include <asm/fsgsbase.h> |
---|
13 | 14 | |
---|
14 | 15 | typedef unsigned long elf_greg_t; |
---|
15 | 16 | |
---|
.. | .. |
---|
19 | 20 | typedef struct user_i387_struct elf_fpregset_t; |
---|
20 | 21 | |
---|
21 | 22 | #ifdef __i386__ |
---|
22 | | - |
---|
23 | | -typedef struct user_fxsr_struct elf_fpxregset_t; |
---|
24 | 23 | |
---|
25 | 24 | #define R_386_NONE 0 |
---|
26 | 25 | #define R_386_32 1 |
---|
.. | .. |
---|
62 | 61 | #define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */ |
---|
63 | 62 | #define R_X86_64_8 14 /* Direct 8 bit sign extended */ |
---|
64 | 63 | #define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */ |
---|
65 | | - |
---|
66 | | -#define R_X86_64_NUM 16 |
---|
| 64 | +#define R_X86_64_PC64 24 /* Place relative 64-bit signed */ |
---|
67 | 65 | |
---|
68 | 66 | /* |
---|
69 | 67 | * These are used to set parameters in the core dumps. |
---|
.. | .. |
---|
205 | 203 | |
---|
206 | 204 | #define ELF_CORE_COPY_REGS(pr_reg, regs) \ |
---|
207 | 205 | do { \ |
---|
208 | | - unsigned long base; \ |
---|
209 | 206 | unsigned v; \ |
---|
210 | 207 | (pr_reg)[0] = (regs)->r15; \ |
---|
211 | 208 | (pr_reg)[1] = (regs)->r14; \ |
---|
.. | .. |
---|
228 | 225 | (pr_reg)[18] = (regs)->flags; \ |
---|
229 | 226 | (pr_reg)[19] = (regs)->sp; \ |
---|
230 | 227 | (pr_reg)[20] = (regs)->ss; \ |
---|
231 | | - rdmsrl(MSR_FS_BASE, base); (pr_reg)[21] = base; \ |
---|
232 | | - rdmsrl(MSR_KERNEL_GS_BASE, base); (pr_reg)[22] = base; \ |
---|
| 228 | + (pr_reg)[21] = x86_fsbase_read_cpu(); \ |
---|
| 229 | + (pr_reg)[22] = x86_gsbase_read_cpu_inactive(); \ |
---|
233 | 230 | asm("movl %%ds,%0" : "=r" (v)); (pr_reg)[23] = v; \ |
---|
234 | 231 | asm("movl %%es,%0" : "=r" (v)); (pr_reg)[24] = v; \ |
---|
235 | 232 | asm("movl %%fs,%0" : "=r" (v)); (pr_reg)[25] = v; \ |
---|
.. | .. |
---|
282 | 279 | /* |
---|
283 | 280 | * An executable for which elf_read_implies_exec() returns TRUE will |
---|
284 | 281 | * have the READ_IMPLIES_EXEC personality flag set automatically. |
---|
| 282 | + * |
---|
| 283 | + * The decision process for determining the results are: |
---|
| 284 | + * |
---|
| 285 | + * CPU: | lacks NX* | has NX, ia32 | has NX, x86_64 | |
---|
| 286 | + * ELF: | | | | |
---|
| 287 | + * ---------------------|------------|------------------|----------------| |
---|
| 288 | + * missing PT_GNU_STACK | exec-all | exec-all | exec-none | |
---|
| 289 | + * PT_GNU_STACK == RWX | exec-stack | exec-stack | exec-stack | |
---|
| 290 | + * PT_GNU_STACK == RW | exec-none | exec-none | exec-none | |
---|
| 291 | + * |
---|
| 292 | + * exec-all : all PROT_READ user mappings are executable, except when |
---|
| 293 | + * backed by files on a noexec-filesystem. |
---|
| 294 | + * exec-none : only PROT_EXEC user mappings are executable. |
---|
| 295 | + * exec-stack: only the stack and PROT_EXEC user mappings are executable. |
---|
| 296 | + * |
---|
| 297 | + * *this column has no architectural effect: NX markings are ignored by |
---|
| 298 | + * hardware, but may have behavioral effects when "wants X" collides with |
---|
| 299 | + * "cannot be X" constraints in memory permission flags, as in |
---|
| 300 | + * https://lkml.kernel.org/r/20190418055759.GA3155@mellanox.com |
---|
| 301 | + * |
---|
285 | 302 | */ |
---|
286 | 303 | #define elf_read_implies_exec(ex, executable_stack) \ |
---|
287 | | - (executable_stack != EXSTACK_DISABLE_X) |
---|
| 304 | + (mmap_is_ia32() && executable_stack == EXSTACK_DEFAULT) |
---|
288 | 305 | |
---|
289 | 306 | struct task_struct; |
---|
290 | 307 | |
---|