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


Groups > linux.kernel > #1678071

Re: [PATCH v2 6/8] x86/entry: add unwind hint annotations

From Andy Lutomirski <luto@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2 6/8] x86/entry: add unwind hint annotations
Date 2017-06-29 21:00 +0200
Message-ID <tXMPw-2Ms-23@gated-at.bofh.it> (permalink)
References <tXmV4-8uj-15@gated-at.bofh.it> <tXmV4-8uj-23@gated-at.bofh.it> <tXLTs-2de-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Jun 29, 2017 at 10:53 AM, Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> There's a bug here that will need a small change to the entry code.
>
> Mike Galbraith reported:
>
>   WARNING: can't dereference registers at ffffc900089d7e08 for ip ffffffff81740bbb
>
> After some looking I found that it's caused by the following code
> snippet in the 'interrupt' macro in entry_64.S:
>
>         /*
>          * Save previous stack pointer, optionally switch to interrupt stack.
>          * irq_count is used to check if a CPU is already on an interrupt stack
>          * or not. While this is essentially redundant with preempt_count it is
>          * a little cheaper to use a separate counter in the PDA (short of
>          * moving irq_enter into assembly, which would be too much work)
>          */
>         movq    %rsp, %rdi
>         incl    PER_CPU_VAR(irq_count)
>         cmovzq  PER_CPU_VAR(irq_stack_ptr), %rsp
>         UNWIND_HINT_REGS base=rdi
>         pushq   %rdi
>         UNWIND_HINT_REGS indirect=1
>
> The problem is that it's changing the stack pointer *before* writing the
> previous stack pointer (push %rdi).  So when unwinding from an NMI which
> hit between the rsp write and the rdi push, the unwinder tries to access
> the regs on the previous stack (by reading rdi), but the previous stack
> pointer isn't there yet, so the access is considered out of bounds.

Ugh, that code.  Does this problem go away with this patch applied:

https://git.kernel.org/pub/scm/linux/kernel/git/luto/linux.git/commit/?h=x86/entry_ist&id=2231ec7e0bcc1a2bc94a17081511ab54cc6badd1

If so, want to update the patch for new kernels (shouldn't conflict
with anything except your unwind hints)?

--Andy

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


Thread

[PATCH v2 0/8] x86: undwarf unwinder Josh Poimboeuf <jpoimboe@redhat.com> - 2017-06-28 17:20 +0200
  [PATCH v2 4/8] objtool: add undwarf debuginfo generation Josh Poimboeuf <jpoimboe@redhat.com> - 2017-06-28 17:20 +0200
    Re: [PATCH v2 4/8] objtool: add undwarf debuginfo generation Ingo Molnar <mingo@kernel.org> - 2017-06-29 09:20 +0200
      Re: [PATCH v2 4/8] objtool: add undwarf debuginfo generation Josh Poimboeuf <jpoimboe@redhat.com> - 2017-06-29 15:50 +0200
    Re: [PATCH v2 4/8] objtool: add undwarf debuginfo generation Ingo Molnar <mingo@kernel.org> - 2017-06-29 09:30 +0200
      Re: [PATCH v2 4/8] objtool: add undwarf debuginfo generation Josh Poimboeuf <jpoimboe@redhat.com> - 2017-06-29 16:10 +0200
        Re: [PATCH v2 4/8] objtool: add undwarf debuginfo generation Ingo Molnar <mingo@kernel.org> - 2017-06-29 16:50 +0200
          Re: [PATCH v2 4/8] objtool: add undwarf debuginfo generation Josh Poimboeuf <jpoimboe@redhat.com> - 2017-06-29 17:10 +0200
  [PATCH v2 7/8] x86/asm: add unwind hint annotations to sync_core() Josh Poimboeuf <jpoimboe@redhat.com> - 2017-06-28 17:20 +0200
  [PATCH v2 2/8] objtool, x86: add several functions and files to the objtool whitelist Josh Poimboeuf <jpoimboe@redhat.com> - 2017-06-28 17:20 +0200
    [tip:core/objtool] objtool, x86: Add several functions and files to  the objtool whitelist tip-bot for Josh Poimboeuf <tipbot@zytor.com> - 2017-06-30 15:20 +0200
  [PATCH v2 6/8] x86/entry: add unwind hint annotations Josh Poimboeuf <jpoimboe@redhat.com> - 2017-06-28 17:20 +0200
    Re: [PATCH v2 6/8] x86/entry: add unwind hint annotations Josh Poimboeuf <jpoimboe@redhat.com> - 2017-06-29 20:00 +0200
      Re: [PATCH v2 6/8] x86/entry: add unwind hint annotations Andy Lutomirski <luto@kernel.org> - 2017-06-29 21:00 +0200
        Re: [PATCH v2 6/8] x86/entry: add unwind hint annotations Josh Poimboeuf <jpoimboe@redhat.com> - 2017-06-29 21:10 +0200
          Re: [PATCH v2 6/8] x86/entry: add unwind hint annotations Andy Lutomirski <luto@kernel.org> - 2017-06-29 23:20 +0200
            Re: [PATCH v2 6/8] x86/entry: add unwind hint annotations Josh Poimboeuf <jpoimboe@redhat.com> - 2017-06-29 23:50 +0200
              Re: [PATCH v2 6/8] x86/entry: add unwind hint annotations Andy Lutomirski <luto@amacapital.net> - 2017-06-30 01:00 +0200
                Re: [PATCH v2 6/8] x86/entry: add unwind hint annotations Josh Poimboeuf <jpoimboe@redhat.com> - 2017-06-30 04:20 +0200
                Re: [PATCH v2 6/8] x86/entry: add unwind hint annotations Andy Lutomirski <luto@kernel.org> - 2017-06-30 07:10 +0200
                Re: [PATCH v2 6/8] x86/entry: add unwind hint annotations Andy Lutomirski <luto@kernel.org> - 2017-06-30 07:50 +0200
                Re: [PATCH v2 6/8] x86/entry: add unwind hint annotations Josh Poimboeuf <jpoimboe@redhat.com> - 2017-06-30 15:20 +0200
                Re: [PATCH v2 6/8] x86/entry: add unwind hint annotations Andy Lutomirski <luto@kernel.org> - 2017-06-30 17:50 +0200
                Re: [PATCH v2 6/8] x86/entry: add unwind hint annotations Josh Poimboeuf <jpoimboe@redhat.com> - 2017-06-30 18:00 +0200
                Re: [PATCH v2 6/8] x86/entry: add unwind hint annotations Andy Lutomirski <luto@kernel.org> - 2017-06-30 18:00 +0200
                Re: [PATCH v2 6/8] x86/entry: add unwind hint annotations Josh Poimboeuf <jpoimboe@redhat.com> - 2017-06-30 18:20 +0200
  [PATCH v2 1/8] objtool: move checking code to check.c Josh Poimboeuf <jpoimboe@redhat.com> - 2017-06-28 17:20 +0200
  Re: [PATCH v2 0/8] x86: undwarf unwinder Ingo Molnar <mingo@kernel.org> - 2017-06-29 10:00 +0200
    Re: [PATCH v2 0/8] x86: undwarf unwinder Josh Poimboeuf <jpoimboe@redhat.com> - 2017-06-29 16:20 +0200
      Re: [PATCH v2 0/8] x86: undwarf unwinder Josh Poimboeuf <jpoimboe@redhat.com> - 2017-06-29 21:20 +0200
  Re: [PATCH v2 3/8] objtool: stack validation 2.0 Ingo Molnar <mingo@kernel.org> - 2017-06-30 10:40 +0200
    Re: [PATCH v2 3/8] objtool: stack validation 2.0 Josh Poimboeuf <jpoimboe@redhat.com> - 2017-06-30 15:30 +0200
      Re: [PATCH v2 3/8] objtool: stack validation 2.0 Josh Poimboeuf <jpoimboe@redhat.com> - 2017-06-30 15:30 +0200
    [PATCH] objtool: silence warnings for functions which use iret Josh Poimboeuf <jpoimboe@redhat.com> - 2017-06-30 16:10 +0200
      [tip:core/objtool] objtool: Silence warnings for functions which  use IRET tip-bot for Josh Poimboeuf <tipbot@zytor.com> - 2017-06-30 20:00 +0200

csiph-web