Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1370031
| From | Borislav Petkov <bp@alien8.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v5 3/9] x86/head: Move early exception panic code into early_fixup_exception |
| Date | 2016-04-02 20:40 +0200 |
| Message-ID | <rjyCJ-7Ut-7@gated-at.bofh.it> (permalink) |
| References | <rjups-4TG-5@gated-at.bofh.it> <rjupu-4TG-23@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Sat, Apr 02, 2016 at 07:01:34AM -0700, Andy Lutomirski wrote:
> This removes a bunch of assembly and adds some C code instead. It
> changes the actual printouts on both 32-bit and 64-bit kernels, but
> they still seem okay.
>
> Signed-off-by: Andy Lutomirski <luto@kernel.org>
> ---
> arch/x86/include/asm/uaccess.h | 2 +-
> arch/x86/kernel/head_32.S | 49 +++++-------------------------------------
> arch/x86/kernel/head_64.S | 45 ++------------------------------------
> arch/x86/mm/extable.c | 29 ++++++++++++++++++++-----
> 4 files changed, 32 insertions(+), 93 deletions(-)
...
> @@ -99,21 +101,38 @@ int __init early_fixup_exception(struct pt_regs *regs, int trapnr)
>
> /* Ignore early NMIs. */
> if (trapnr == X86_TRAP_NMI)
> - return 1;
> + return;
> +
> + if (early_recursion_flag > 2)
> + goto halt_loop;
> +
> + if (regs->cs != __KERNEL_CS)
> + goto fail;
>
> e = search_exception_tables(regs->ip);
> if (!e)
> - return 0;
> + goto fail;
>
> new_ip = ex_fixup_addr(e);
> handler = ex_fixup_handler(e);
>
> /* special handling not supported during early boot */
> if (handler != ex_handler_default)
> - return 0;
> + goto fail;
>
> regs->ip = new_ip;
> - return 1;
> + return;
> +
> +fail:
> + early_printk("PANIC: early exception 0x%02x IP %lx:%lx error %lx cr2 0x%lx\n",
> + (unsigned)trapnr, (unsigned long)regs->cs, regs->ip,
> + regs->orig_ax, read_cr2());
> +
> + show_regs(regs);
To make this even better, it could be something called early_show_regs()
or so and be a simplified version of __show_regs() on both bitness but
which calls early_printk().
This way you'll be able to get out stuff to the console as early as
possible.
Btw, you don't need to dump rIP, CR2, etc in the PANIC message above
since you're going to early_show_regs() anyway.
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v5 0/9] Improve non-"safe" MSR access failure handling Andy Lutomirski <luto@kernel.org> - 2016-04-02 16:10 +0200
[PATCH v5 5/9] x86/paravirt: Add _safe to the read_msr and write_msr PV hooks Andy Lutomirski <luto@kernel.org> - 2016-04-02 16:10 +0200
Re: [PATCH v5 5/9] x86/paravirt: Add _safe to the read_msr and write_msr PV hooks Borislav Petkov <bp@alien8.de> - 2016-04-03 10:50 +0200
Re: [PATCH v5 5/9] x86/paravirt: Add _safe to the read_msr and write_msr PV hooks Andy Lutomirski <luto@amacapital.net> - 2016-04-03 15:30 +0200
Re: [PATCH v5 5/9] x86/paravirt: Add _safe to the read_msr and write_msr PV hooks Borislav Petkov <bp@alien8.de> - 2016-04-03 16:10 +0200
[tip:x86/asm] x86/paravirt: Add _safe to the read_ms()r and write_msr() PV callbacks tip-bot for Andy Lutomirski <tipbot@zytor.com> - 2016-04-13 13:50 +0200
[PATCH v5 8/9] x86/paravirt: Make "unsafe" MSR accesses unsafe even if PARAVIRT=y Andy Lutomirski <luto@kernel.org> - 2016-04-02 16:10 +0200
[tip:x86/asm] x86/paravirt: Make "unsafe" MSR accesses unsafe even if PARAVIRT=y tip-bot for Andy Lutomirski <tipbot@zytor.com> - 2016-04-13 13:50 +0200
[PATCH v5 2/9] x86/head: Move the early NMI fixup into C Andy Lutomirski <luto@kernel.org> - 2016-04-02 16:10 +0200
[tip:x86/asm] x86/head: Move the early NMI fixup into C tip-bot for Andy Lutomirski <tipbot@zytor.com> - 2016-04-13 13:50 +0200
[PATCH v5 3/9] x86/head: Move early exception panic code into early_fixup_exception Andy Lutomirski <luto@kernel.org> - 2016-04-02 16:10 +0200
Re: [PATCH v5 3/9] x86/head: Move early exception panic code into early_fixup_exception Borislav Petkov <bp@alien8.de> - 2016-04-02 20:40 +0200
Re: [PATCH v5 3/9] x86/head: Move early exception panic code into early_fixup_exception Andy Lutomirski <luto@amacapital.net> - 2016-04-02 22:20 +0200
Re: [PATCH v5 3/9] x86/head: Move early exception panic code into early_fixup_exception Borislav Petkov <bp@alien8.de> - 2016-04-02 22:50 +0200
Re: [PATCH v5 3/9] x86/head: Move early exception panic code into early_fixup_exception Andy Lutomirski <luto@amacapital.net> - 2016-04-02 23:00 +0200
Re: [PATCH v5 3/9] x86/head: Move early exception panic code into early_fixup_exception Jan Kara <jack@suse.cz> - 2016-04-04 14:00 +0200
Re: [PATCH v5 3/9] x86/head: Move early exception panic code into early_fixup_exception Peter Zijlstra <peterz@infradead.org> - 2016-04-04 14:50 +0200
Re: [PATCH v5 3/9] x86/head: Move early exception panic code into early_fixup_exception Arjan van de Ven <arjan@linux.intel.com> - 2016-04-04 17:40 +0200
Re: [PATCH v5 3/9] x86/head: Move early exception panic code into early_fixup_exception Andy Lutomirski <luto@amacapital.net> - 2016-04-04 17:40 +0200
Re: [PATCH v5 3/9] x86/head: Move early exception panic code into early_fixup_exception Peter Zijlstra <peterz@infradead.org> - 2016-04-04 18:10 +0200
Re: [PATCH v5 3/9] x86/head: Move early exception panic code into early_fixup_exception Borislav Petkov <bp@alien8.de> - 2016-04-04 21:40 +0200
Re: [PATCH v5 3/9] x86/head: Move early exception panic code into early_fixup_exception Andy Lutomirski <luto@amacapital.net> - 2016-04-04 23:40 +0200
Re: [PATCH v5 3/9] x86/head: Move early exception panic code into early_fixup_exception Borislav Petkov <bp@alien8.de> - 2016-04-04 23:50 +0200
[tip:x86/asm] x86/head: Move early exception panic code into early_fixup_exception() tip-bot for Andy Lutomirski <tipbot@zytor.com> - 2016-04-13 13:50 +0200
[PATCH v5 7/9] x86/paravirt: Add paravirt_{read,write}_msr Andy Lutomirski <luto@kernel.org> - 2016-04-02 16:10 +0200
Re: [Xen-devel] [PATCH v5 7/9] x86/paravirt: Add paravirt_{read, write}_msr David Vrabel <david.vrabel@citrix.com> - 2016-04-04 18:40 +0200
Re: [Xen-devel] [PATCH v5 7/9] x86/paravirt: Add paravirt_{read, write}_msr Andy Lutomirski <luto@amacapital.net> - 2016-04-04 18:50 +0200
[tip:x86/asm] x86/paravirt: Add paravirt_{read,write}_msr() tip-bot for Andy Lutomirski <tipbot@zytor.com> - 2016-04-13 13:50 +0200
[PATCH v5 1/9] x86/head: Pass a real pt_regs and trapnr to early_fixup_exception Andy Lutomirski <luto@kernel.org> - 2016-04-02 16:10 +0200
[tip:x86/asm] x86/head: Pass a real pt_regs and trapnr to early_fixup_exception() tip-bot for Andy Lutomirski <tipbot@zytor.com> - 2016-04-13 13:50 +0200
[PATCH v5 6/9] x86/msr: Carry on after a non-"safe" MSR access fails Andy Lutomirski <luto@kernel.org> - 2016-04-02 16:10 +0200
[tip:x86/asm] x86/msr: Carry on after a non-"safe" MSR access fails tip-bot for Andy Lutomirski <tipbot@zytor.com> - 2016-04-13 13:50 +0200
[PATCH v5 9/9] x86/msr: Set the return value to zero when native_rdmsr_safe fails Andy Lutomirski <luto@kernel.org> - 2016-04-02 16:10 +0200
[tip:x86/asm] x86/msr: Set the return value to zero when native_rdmsr_safe() fails tip-bot for Andy Lutomirski <tipbot@zytor.com> - 2016-04-13 13:50 +0200
Re: [PATCH v5 0/9] Improve non-"safe" MSR access failure handling Linus Torvalds <torvalds@linux-foundation.org> - 2016-04-02 16:30 +0200
Re: [PATCH v5 0/9] Improve non-"safe" MSR access failure handling Andy Lutomirski <luto@amacapital.net> - 2016-04-02 17:20 +0200
Re: [PATCH v5 0/9] Improve non-"safe" MSR access failure handling Linus Torvalds <torvalds@linux-foundation.org> - 2016-04-02 17:30 +0200
Re: [PATCH v5 0/9] Improve non-"safe" MSR access failure handling Borislav Petkov <bp@alien8.de> - 2016-04-04 18:30 +0200
Re: [Xen-devel] [PATCH v5 0/9] Improve non-"safe" MSR access failure handling Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2016-04-05 17:40 +0200
csiph-web