Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1361972
| From | Andi Kleen <andi@firstfloor.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 9/9] x86: Save FS/GS base in core dump |
| Date | 2016-03-21 17:20 +0100 |
| Message-ID | <rfaIG-8aj-29@gated-at.bofh.it> (permalink) |
| References | <rfaIF-8aj-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Andi Kleen <ak@linux.intel.com>
Add FS/GS base dumping to the standard ELF_CORE_COPY_REGS macro
I think this is only used in some special cases, the majority
of core dumps seem to go through the getregs interface also
used by ptrace.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
arch/x86/include/asm/elf.h | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h
index 0df9c95..f57cc17 100644
--- a/arch/x86/include/asm/elf.h
+++ b/arch/x86/include/asm/elf.h
@@ -9,6 +9,8 @@
#include <asm/ptrace.h>
#include <asm/user.h>
#include <asm/auxvec.h>
+#include <asm/proto.h>
+#include <asm/fsgs.h>
typedef unsigned long elf_greg_t;
@@ -226,8 +228,13 @@ do { \
(pr_reg)[18] = (regs)->flags; \
(pr_reg)[19] = (regs)->sp; \
(pr_reg)[20] = (regs)->ss; \
- (pr_reg)[21] = current->thread.fs; \
- (pr_reg)[22] = current->thread.gs; \
+ if (boot_cpu_has(X86_FEATURE_FSGSBASE)) { \
+ (pr_reg)[21] = rdfsbase(); \
+ (pr_reg)[22] = read_user_gsbase(); \
+ } else { \
+ (pr_reg)[21] = current->thread.fs; \
+ (pr_reg)[22] = current->thread.gs; \
+ } \
asm("movl %%ds,%0" : "=r" (v)); (pr_reg)[23] = v; \
asm("movl %%es,%0" : "=r" (v)); (pr_reg)[24] = v; \
asm("movl %%fs,%0" : "=r" (v)); (pr_reg)[25] = v; \
--
2.5.5
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 9/9] x86: Save FS/GS base in core dump Andi Kleen <andi@firstfloor.org> - 2016-03-21 17:20 +0100
csiph-web