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


Groups > linux.kernel > #1451571

Re: Fwd: [Bug 150021] New: kernel panic: "kernel tried to execute NX-protected page" when resuming from hibernate to disk

From "Rafael J. Wysocki" <rjw@rjwysocki.net>
Newsgroups linux.kernel
Subject Re: Fwd: [Bug 150021] New: kernel panic: "kernel tried to execute NX-protected page" when resuming from hibernate to disk
Date 2016-07-28 01:20 +0200
Message-ID <rZGhj-667-1@gated-at.bofh.it> (permalink)
References <rZ8IF-1jB-3@gated-at.bofh.it> <rZFbA-5js-1@gated-at.bofh.it> <rZFlg-5mX-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wednesday, July 27, 2016 05:17:38 PM Josh Poimboeuf wrote:
> On Thu, Jul 28, 2016 at 12:12:15AM +0200, Rafael J. Wysocki wrote:
> > On Wednesday, July 27, 2016 12:59:18 PM Josh Poimboeuf wrote:
> > > Hm... I have a theory, but I'm not sure about it.  I noticed that
> > > x86_acpi_enter_sleep_state(),
> > 
> > I think you mean x86_acpi_suspend_lowlevel().
> 
> Oops!
> 
> > > which is involved in suspend, overwrites
> > > several global variables (e.g, initial_code) which are used by the CPU
> > > boot code in head_64.S.  But surprisingly, it doesn't restore those
> > > variables to their original values after it resumes.
> > 
> > Is the head_64.S code also used to bring up offline CPUs?
> 
> Yes.

OK

So it is really interesting why and how that stuff works for everybody.

Basically, CPU online should fail after a suspend-resume cycle, but it
doesn't most of the time AFAICS.

> > If not, then this is not the problem, because hibernation doesn't use it
> > for the boot CPU anyway.
> > 
> > > So if a suspend and resume were done before the hibernate, those
> > > variables would presumably have suspend-centric values, and the first
> > > time a CPU is brought up during the hibernation restore operation, it
> > > would jump to wakeup_long64() (the suspend resume function) instead of
> > > start_secondary (which is the normal CPU boot function).
> > > 
> > > So, if true, that would explain why my patch triggers a bug:
> > > wakeup_long64() always[*] jumps to .Lresume_point, which my patch
> > > affected.  Because of the FRAME_END, it would pop an extra value off the
> > > stack.  So when restore_processor_state() returns, it would return to
> > > whatever random address is on the stack after the real RIP.  Which is
> > > consistent with the oops from the bug.  It had a bad instruction
> > > pointer, which looked like a stack address.
> > 
> > OK, so why doesn't it break resume from suspend to RAM?
> 
> Because for suspend to RAM, it enters suspend through
> do_suspend_lowlevel(), which has the FRAME_BEGIN which corresponds to
> .Lresume_point's FRAME_END.
> 
> > wakeup_long64 is invoked by the CPU startup code then and doesn't the
> > FRAME_END affect that too?
> 
> Yes, I would imagine that any CPU startup operation (after
> suspend/resume to RAM) would be affected.

That would mean that your patch is needed anyway, wouldn't it?

Thanks,
Rafael

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


Thread

Fwd: [Bug 150021] New: kernel panic: "kernel tried to execute NX-protected page" when resuming from hibernate to disk "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-07-26 13:30 +0200
  Re: Fwd: [Bug 150021] New: kernel panic: "kernel tried to execute  NX-protected page" when resuming from hibernate to disk Borislav Petkov <bp@suse.de> - 2016-07-26 16:10 +0200
    Re: Fwd: [Bug 150021] New: kernel panic: "kernel tried to execute NX-protected page" when resuming from hibernate to disk "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-07-26 22:20 +0200
      Re: Fwd: [Bug 150021] New: kernel panic: "kernel tried to execute  NX-protected page" when resuming from hibernate to disk Kees Cook <keescook@chromium.org> - 2016-07-26 22:40 +0200
        Re: Fwd: [Bug 150021] New: kernel panic: "kernel tried to execute NX-protected page" when resuming from hibernate to disk "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-07-26 22:50 +0200
          Re: Fwd: [Bug 150021] New: kernel panic: "kernel tried to execute  NX-protected page" when resuming from hibernate to disk Kees Cook <keescook@chromium.org> - 2016-07-26 23:10 +0200
            Re: Fwd: [Bug 150021] New: kernel panic: "kernel tried to execute  NX-protected page" when resuming from hibernate to disk Thomas Garnier <thgarnie@google.com> - 2016-07-26 23:20 +0200
              Re: Fwd: [Bug 150021] New: kernel panic: "kernel tried to execute  NX-protected page" when resuming from hibernate to disk Borislav Petkov <bp@suse.de> - 2016-07-27 07:40 +0200
  Re: Fwd: [Bug 150021] New: kernel panic: "kernel tried to execute  NX-protected page" when resuming from hibernate to disk Josh Poimboeuf <jpoimboe@redhat.com> - 2016-07-26 16:40 +0200
    Re: Fwd: [Bug 150021] New: kernel panic: "kernel tried to execute NX-protected page" when resuming from hibernate to disk "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-07-26 22:20 +0200
      Re: Fwd: [Bug 150021] New: kernel panic: "kernel tried to execute  NX-protected page" when resuming from hibernate to disk Kees Cook <keescook@chromium.org> - 2016-07-26 22:40 +0200
        Re: Fwd: [Bug 150021] New: kernel panic: "kernel tried to execute NX-protected page" when resuming from hibernate to disk "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-07-26 22:40 +0200
      Re: Fwd: [Bug 150021] New: kernel panic: "kernel tried to execute  NX-protected page" when resuming from hibernate to disk Josh Poimboeuf <jpoimboe@redhat.com> - 2016-07-27 00:00 +0200
        Re: Fwd: [Bug 150021] New: kernel panic: "kernel tried to execute NX-protected page" when resuming from hibernate to disk "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-07-27 00:40 +0200
          Re: Fwd: [Bug 150021] New: kernel panic: "kernel tried to execute  NX-protected page" when resuming from hibernate to disk "Rafael J. Wysocki" <rafael@kernel.org> - 2016-07-27 01:10 +0200
            Re: Fwd: [Bug 150021] New: kernel panic: "kernel tried to execute  NX-protected page" when resuming from hibernate to disk Josh Poimboeuf <jpoimboe@redhat.com> - 2016-07-27 20:00 +0200
              Re: Fwd: [Bug 150021] New: kernel panic: "kernel tried to execute NX-protected page" when resuming from hibernate to disk "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-07-28 00:10 +0200
                Re: Fwd: [Bug 150021] New: kernel panic: "kernel tried to execute  NX-protected page" when resuming from hibernate to disk Josh Poimboeuf <jpoimboe@redhat.com> - 2016-07-28 00:20 +0200
                Re: Fwd: [Bug 150021] New: kernel panic: "kernel tried to execute NX-protected page" when resuming from hibernate to disk "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-07-28 01:20 +0200
                Re: Fwd: [Bug 150021] New: kernel panic: "kernel tried to execute NX-protected page" when resuming from hibernate to disk "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-07-28 01:30 +0200
                [PATCH] x86/asm/power: Fix hibernation return address corruption Josh Poimboeuf <jpoimboe@redhat.com> - 2016-07-28 17:20 +0200
                Re: [PATCH] x86/asm/power: Fix hibernation return address corruption Josh Poimboeuf <jpoimboe@redhat.com> - 2016-07-28 17:40 +0200
                Re: [PATCH] x86/asm/power: Fix hibernation return address corruption "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-07-28 23:40 +0200
                Re: [PATCH] x86/asm/power: Fix hibernation return address corruption Ingo Molnar <mingo@kernel.org> - 2016-07-29 09:20 +0200
                Re: Fwd: [Bug 150021] New: kernel panic: "kernel tried to execute NX-protected page" when resuming from hibernate to disk "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-07-28 00:20 +0200

csiph-web