From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Nathan Chancellor <natechancellor@gmail.com>
Cc: Andy 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:22:52 -0500 [thread overview]
Message-ID: <20181015142252.6p2zgkznj26jzdwl@treble> (raw)
In-Reply-To: <20181015051705.GA20687@flashbox>
On Sun, Oct 14, 2018 at 10:17:05PM -0700, Nathan Chancellor wrote:
> On Sun, Oct 14, 2018 at 08:43:18PM -0700, Andy Lutomirski wrote:
> > On Sun, Oct 14, 2018 at 5:37 PM Nick Desaulniers
> > <nick.desaulniers@gmail.com> wrote:
> > >
> > > Fixes the objtool warning:
> > > arch/x86/mm/fault.o: warning: objtool: no_context()+0x220: unreachable
> > > instruction
> > >
> > > Link: https://github.com/ClangBuiltLinux/linux/issues/204
> > > Signed-off-by: Nick Desaulniers <nick.desaulniers@gmail.com>
> > > ---
> > > arch/x86/mm/fault.c | 6 ++++--
> > > 1 file changed, 4 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
> > > index 47bebfe6efa7..057d2178fa19 100644
> > > --- a/arch/x86/mm/fault.c
> > > +++ b/arch/x86/mm/fault.c
> > > @@ -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
As Andy said, I think compiler-clang.h needs an unreachable()
definition. Without that, I'm guessing you're getting this:
#ifndef unreachable
# define unreachable() do { annotate_reachable(); do { } while (1); } while (0)
#endif
which converts "unreachable" to "reachable". That used to be needed for
pre-4.5 versions of GCC when we supported them, but it's the wrong
behavior for this piece of code (and I should remove all those old GCC
hacks soon...)
--
Josh
next prev parent reply other threads:[~2018-10-15 14:23 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 [this message]
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
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=20181015142252.6p2zgkznj26jzdwl@treble \
--to=jpoimboe@redhat.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=natechancellor@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).