From: Borislav Petkov <bp@alien8.de>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: "Richard W.M. Jones" <rjones@redhat.com>,
Chuck Ebbert <cebbert.lkml@gmail.com>,
linux-kernel@vger.kernel.org, x86@kernel.org,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [BUG 4.2-rc8] Interrupt occurs while apply_alternatives() is patching the handler
Date: Thu, 3 Sep 2015 10:50:46 +0200 [thread overview]
Message-ID: <20150903085046.GA19397@nazgul.tnic> (raw)
In-Reply-To: <alpine.DEB.2.11.1509021108570.15006@nanos>
On Wed, Sep 02, 2015 at 11:11:55AM +0200, Thomas Gleixner wrote:
> 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) {
I guess you want to optimize the len==0 case to not disable interrupts
needlessly:
if (!len)
return;
local_irq_save(flags);
while (len > 0)
...
Other than that, good catch!
Thanks.
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--
next prev parent reply other threads:[~2015-09-03 8:50 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-31 2:37 Chuck Ebbert
2015-09-01 6:20 ` Richard W.M. Jones
2015-09-02 9:11 ` Thomas Gleixner
2015-09-02 19:05 ` Richard W.M. Jones
2015-09-03 7:53 ` Richard W.M. Jones
2015-09-03 8:50 ` Borislav Petkov [this message]
2015-09-03 10:41 ` Thomas Gleixner
2015-09-03 12:43 ` Josh Boyer
2015-09-03 13:01 ` Thomas Gleixner
2015-09-03 15:48 ` Richard W.M. Jones
2015-09-03 19:30 ` [tip:x86/urgent] x86/alternatives: Make optimize_nops() interrupt safe and synced tip-bot for Thomas Gleixner
2015-09-04 7:40 ` [BUG 4.2-rc8] Interrupt occurs while apply_alternatives() is patching the handler Richard W.M. Jones
2015-09-04 12:02 ` Borislav Petkov
2015-09-04 13:37 ` Thomas Gleixner
2015-09-05 15:25 ` Borislav Petkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150903085046.GA19397@nazgul.tnic \
--to=bp@alien8.de \
--cc=cebbert.lkml@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rjones@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--subject='Re: [BUG 4.2-rc8] Interrupt occurs while apply_alternatives() is patching the handler' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.