Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1217440

Re: [BUG 4.2-rc8] Interrupt occurs while apply_alternatives() is patching the handler

From Thomas Gleixner <tglx@linutronix.de>
Newsgroups linux.kernel
Subject Re: [BUG 4.2-rc8] Interrupt occurs while apply_alternatives() is patching the handler
Date 2015-09-02 11:20 +0200
Message-ID <q4cn1-KF-21@gated-at.bofh.it> (permalink)
References <q3naN-2LJ-5@gated-at.bofh.it> <q3NeV-6Rp-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, 1 Sep 2015, Richard W.M. Jones wrote:
> On Sun, Aug 30, 2015 at 10:37:57PM -0400, Chuck Ebbert wrote:
> > This is from https://bugzilla.redhat.com/show_bug.cgi?id=1258223
> > 
> > [    0.036000] BUG: unable to handle kernel paging request at 55501e06
> [...]
> > [    0.036000]  [<c0409c80>] ? add_nops+0x90/0xa0
> > [    0.036000]  [<c040a054>] apply_alternatives+0x274/0x630
> > [    0.036000]  [<c07f1cf0>] ? wait_for_xmitr+0xa0/0xa0
> > [    0.036000]  [<c071a6fc>] ? sprintf+0x1c/0x20
> > [    0.036000]  [<c0aae480>] ? irq_entries_start+0x698/0x698
> > [    0.036000]  [<c071be4b>] ? memcpy+0xb/0x30
> > [    0.036000]  [<c07f3950>] ? serial8250_set_termios+0x20/0x20
> [...]
> > Interrupt 0x30 occurred while the alternatives code was replacing the
> > initial 0x90,0x90,0x90 NOPs (from the ASM_CLAC macro) with the optimized
> > version, 0x8d,0x76,0x00. Only the first byte has been replaced so far,
> > and it makes a mess out of the insn decoding.

apply_alternatives() has two ways to modify the code:

1) text_poke_early()

2) optimize_nops()

The former disables interrupts, the latter not. The patch below should
fix the issue.

Thanks,

	tglx

diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index c42827eb86cf..6a2f93e029f4 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -257,6 +257,9 @@ void __init arch_init_ideal_nops(void)
 /* Use this to add nops to a buffer, then text_poke the whole buffer. */
 static void __init_or_module add_nops(void *insns, unsigned int len)
 {
+	unsigned long flags;
+
+	local_irq_save(flags);
 	while (len > 0) {
 		unsigned int noplen = len;
 		if (noplen > ASM_NOP_MAX)
@@ -265,6 +268,7 @@ static void __init_or_module add_nops(void *insns, unsigned int len)
 		insns += noplen;
 		len -= noplen;
 	}
+	local_irq_restore(flags);
 }
 
 extern struct alt_instr __alt_instructions[], __alt_instructions_end[];




--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[BUG 4.2-rc8] Interrupt occurs while apply_alternatives() is  patching the handler Chuck Ebbert <cebbert.lkml@gmail.com> - 2015-08-31 04:40 +0200
  Re: [BUG 4.2-rc8] Interrupt occurs while apply_alternatives() is  patching the handler "Richard W.M. Jones" <rjones@redhat.com> - 2015-09-01 08:30 +0200
    Re: [BUG 4.2-rc8] Interrupt occurs while apply_alternatives() is  patching the handler Thomas Gleixner <tglx@linutronix.de> - 2015-09-02 11:20 +0200
      Re: [BUG 4.2-rc8] Interrupt occurs while apply_alternatives() is  patching the handler "Richard W.M. Jones" <rjones@redhat.com> - 2015-09-02 21:10 +0200
        Re: [BUG 4.2-rc8] Interrupt occurs while apply_alternatives() is  patching the handler "Richard W.M. Jones" <rjones@redhat.com> - 2015-09-03 10:00 +0200
      Re: [BUG 4.2-rc8] Interrupt occurs while apply_alternatives() is  patching the handler Borislav Petkov <bp@alien8.de> - 2015-09-03 11:00 +0200
        Re: [BUG 4.2-rc8] Interrupt occurs while apply_alternatives() is  patching the handler Thomas Gleixner <tglx@linutronix.de> - 2015-09-03 12:50 +0200
          Re: [BUG 4.2-rc8] Interrupt occurs while apply_alternatives() is  patching the handler Josh Boyer <jwboyer@fedoraproject.org> - 2015-09-03 14:50 +0200
            Re: [BUG 4.2-rc8] Interrupt occurs while apply_alternatives() is  patching the handler Thomas Gleixner <tglx@linutronix.de> - 2015-09-03 15:10 +0200
          Re: [BUG 4.2-rc8] Interrupt occurs while apply_alternatives() is  patching the handler "Richard W.M. Jones" <rjones@redhat.com> - 2015-09-03 18:00 +0200
          [tip:x86/urgent] x86/alternatives: Make optimize_nops()   interrupt safe and synced tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2015-09-03 21:40 +0200
          Re: [BUG 4.2-rc8] Interrupt occurs while apply_alternatives() is  patching the handler "Richard W.M. Jones" <rjones@redhat.com> - 2015-09-04 09:50 +0200
          Re: [BUG 4.2-rc8] Interrupt occurs while apply_alternatives() is  patching the handler Borislav Petkov <bp@alien8.de> - 2015-09-04 14:10 +0200
            Re: [BUG 4.2-rc8] Interrupt occurs while apply_alternatives() is  patching the handler Thomas Gleixner <tglx@linutronix.de> - 2015-09-04 15:40 +0200
              Re: [BUG 4.2-rc8] Interrupt occurs while apply_alternatives() is  patching the handler Borislav Petkov <bp@alien8.de> - 2015-09-05 17:30 +0200

csiph-web