mirror of https://gitee.com/openkylin/linux.git
x86/oops: Show the correct CS value in show_regs()
show_regs() shows the CS in the CPU register instead of the value in regs. This means that we'll probably print "CS: 0010" almost all the time regardless of what was actually in CS when the kernel malfunctioned. This gives a particularly confusing result if we OOPSed due to an implicit supervisor access from user mode. Signed-off-by: Andy Lutomirski <luto@kernel.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Rik van Riel <riel@surriel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Yu-cheng Yu <yu-cheng.yu@intel.com> Link: http://lkml.kernel.org/r/4e36812b6e1e95236a812021d35cbf22746b5af6.1542841400.git.luto@kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
parent
ebb53e2597
commit
d38bc89c72
|
@ -66,7 +66,7 @@ void __show_regs(struct pt_regs *regs, enum show_regs_mode mode)
|
||||||
unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L, fs, gs, shadowgs;
|
unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L, fs, gs, shadowgs;
|
||||||
unsigned long d0, d1, d2, d3, d6, d7;
|
unsigned long d0, d1, d2, d3, d6, d7;
|
||||||
unsigned int fsindex, gsindex;
|
unsigned int fsindex, gsindex;
|
||||||
unsigned int ds, cs, es;
|
unsigned int ds, es;
|
||||||
|
|
||||||
show_iret_regs(regs);
|
show_iret_regs(regs);
|
||||||
|
|
||||||
|
@ -98,7 +98,6 @@ void __show_regs(struct pt_regs *regs, enum show_regs_mode mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
asm("movl %%ds,%0" : "=r" (ds));
|
asm("movl %%ds,%0" : "=r" (ds));
|
||||||
asm("movl %%cs,%0" : "=r" (cs));
|
|
||||||
asm("movl %%es,%0" : "=r" (es));
|
asm("movl %%es,%0" : "=r" (es));
|
||||||
asm("movl %%fs,%0" : "=r" (fsindex));
|
asm("movl %%fs,%0" : "=r" (fsindex));
|
||||||
asm("movl %%gs,%0" : "=r" (gsindex));
|
asm("movl %%gs,%0" : "=r" (gsindex));
|
||||||
|
@ -114,7 +113,7 @@ void __show_regs(struct pt_regs *regs, enum show_regs_mode mode)
|
||||||
|
|
||||||
printk(KERN_DEFAULT "FS: %016lx(%04x) GS:%016lx(%04x) knlGS:%016lx\n",
|
printk(KERN_DEFAULT "FS: %016lx(%04x) GS:%016lx(%04x) knlGS:%016lx\n",
|
||||||
fs, fsindex, gs, gsindex, shadowgs);
|
fs, fsindex, gs, gsindex, shadowgs);
|
||||||
printk(KERN_DEFAULT "CS: %04x DS: %04x ES: %04x CR0: %016lx\n", cs, ds,
|
printk(KERN_DEFAULT "CS: %04lx DS: %04x ES: %04x CR0: %016lx\n", regs->cs, ds,
|
||||||
es, cr0);
|
es, cr0);
|
||||||
printk(KERN_DEFAULT "CR2: %016lx CR3: %016lx CR4: %016lx\n", cr2, cr3,
|
printk(KERN_DEFAULT "CR2: %016lx CR3: %016lx CR4: %016lx\n", cr2, cr3,
|
||||||
cr4);
|
cr4);
|
||||||
|
|
Loading…
Reference in New Issue