From: Nathan Chancellor <natechancellor@gmail.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>,
Andrew Lutomirski <luto@kernel.org>,
nick.desaulniers@gmail.com,
Dave Hansen <dave.hansen@linux.intel.com>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
"H. Peter Anvin" <hpa@zytor.com>, X86 ML <x86@kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86/mm: annotate no_context with UNWIND_HINTS
Date: Mon, 15 Oct 2018 09:07:36 -0700 [thread overview]
Message-ID: <20181015160736.GA20997@flashbox> (raw)
In-Reply-To: <CALCETrWtgjxSZOg=hqGe3hDDvpuBDZtjptHFDAuHYOaxs1CO_w@mail.gmail.com>
On Mon, Oct 15, 2018 at 09:03:40AM -0700, Andy Lutomirski wrote:
> On Mon, Oct 15, 2018 at 8:31 AM Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> >
> > On Mon, Oct 15, 2018 at 08:22:21AM -0700, Nathan Chancellor wrote:
> > > > >>> @@ -760,9 +760,11 @@ no_context(struct pt_regs *regs, unsigned long error_code,
> > > > >>> * and then double-fault, though, because we're likely to
> > > > >>> * break the console driver and lose most of the stack dump.
> > > > >>> */
> > > > >>> - asm volatile ("movq %[stack], %%rsp\n\t"
> > > > >>> + asm volatile (UNWIND_HINT_SAVE
> > > > >>> + "movq %[stack], %%rsp\n\t"
> > > > >>> "call handle_stack_overflow\n\t"
> > > > >>> - "1: jmp 1b"
> > > > >>> + "1: jmp 1b\n\t"
> > > > >>> + UNWIND_HINT_RESTORE
> > > > >>> : ASM_CALL_CONSTRAINT
> > > > >>> : "D" ("kernel stack overflow (page fault)"),
> > > > >>> "S" (regs), "d" (address),
> > > > >>
> > > > >> NAK. Just below this snippet is unreachable();
> > > > >>
> > > > >> Can you reply with objtool -dr output on a problematic fault.o? Josh,
> > > > >> it *looks* like annotate_unreachable() should be doing the right
> > > > >> thing, but something is clearly busted.
> > > > >>
> > > > >> Also, shouldn't compiler-clang.h contain a reasonable definition of
> > > > >> unreachable()?
> > > > >>
> > > > >> --Andy
> > > > >
> > > > > Hi Andy,
> > > > >
> > > > > Did you mean 'objdump -dr'? If so, here you go (rather long, sorry if I
> > > > > should have pasted it here instead):
> > > > > https://gist.github.com/nathanchance/f038bb0a6653b975bb8a4e64fcd5503e
> > > > >
> > > > >
> > > >
> > > > Hmm, -dr wasn’t quite enough to dump the .discard bits, assuming they’re there at all. Can you just put the whole .o file somewhere?
> > >
> > > Here you go: https://nathanchance.me/downloads/.tmp/fault.o
> >
> > $ eu-readelf -S /tmp/fault.o |grep reachable
> > [12] .discard.reachable PROGBITS 0000000000000000 00002bc0 00000014 0 0 0 1
> > [13] .rela.discard.reachable RELA 0000000000000000 00002bd8 00000078 24 I 32 12 8
> >
> > That confirms that you need a clang version of the unreachable() macro.
> >
>
> Duh.
>
> That being said, the generic macro is:
>
> # define unreachable() do { annotate_reachable(); do { } while (1); } while (0)
>
> I'm probably missing some subtlety here, but shouldn't that be
> annotate_*un*reachable()?
>
> Of course, there are any number of reasons why there should be a real
> definition. Nathan and Nick, does adding something like:
>
> #define unreachable() \
> do { \
> annotate_unreachable(); \
> __builtin_unreachable(); \
> } while (0)
>
> to compiler-clang.h fix the problem?
>
> --Andy
Ha, I was just typing out a message summarizing that that exact
definition fixed this warning.
Nathan
next prev parent reply other threads:[~2018-10-15 16:07 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-15 0:37 [PATCH] x86/mm: annotate no_context with UNWIND_HINTS Nick Desaulniers
2018-10-15 3:43 ` Andy Lutomirski
2018-10-15 5:17 ` Nathan Chancellor
2018-10-15 14:22 ` Josh Poimboeuf
2018-10-15 14:34 ` Andy Lutomirski
2018-10-15 15:22 ` Nathan Chancellor
2018-10-15 15:31 ` Josh Poimboeuf
2018-10-15 16:03 ` Andy Lutomirski
2018-10-15 16:07 ` Nathan Chancellor [this message]
2018-10-15 16:20 ` Josh Poimboeuf
2018-10-15 16:57 ` Nick Desaulniers
2018-10-15 17:23 ` Nick Desaulniers
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=20181015160736.GA20997@flashbox \
--to=natechancellor@gmail.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=nick.desaulniers@gmail.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.