Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3986848imm; Mon, 15 Oct 2018 07:23:46 -0700 (PDT) X-Google-Smtp-Source: ACcGV61Ii5QciklWt8F9oE+upHYmbZ983/LPppYMSKCMAYt/gDEedF1EbFdpXcPA40z8/7BqACzd X-Received: by 2002:a63:9e02:: with SMTP id s2-v6mr16556312pgd.302.1539613426267; Mon, 15 Oct 2018 07:23:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539613426; cv=none; d=google.com; s=arc-20160816; b=cChtPjub8tJ4mYOpK8/38a1NalriC1gf0yeetPNsbmBAqDrEMzU4yxAho4+ZALaHI2 YmIMhPZ1T6P0ETV5XlPXtb1EreAZXwA0de7L28Ua6i9DDORci9dMe0AHHMRVrtYM3eFq ONgA0V1GVZZEWuncTmxL2ilZjQq+TA+HJmKPCUF5PcFEobloYSsyHrl2J22MM3utSBIv KB7xn6IVvMY89w2EDgjGxDnECUc2vwTonanqXLAg9c0MZwqfo0vEADDOyKxuFtxOXtI7 sL2nPOSoUpt1OXymm1Y9cJWLJxH1V1JuAtKbBbGGwfOyKIoeiG6aH9li+T3W2AJVg5vT wLow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=9fhx9QLH16L7Bw68/0m03UNIEzZdL1UMnesU3GDD5pA=; b=VhJrMvv2cnN1VwlCyFYAdKHbgFoY0vkEpT3Yem5INC6zBdeuKPkJjPDziHfxYFQZny Ihu8ssHb3n0uAoiLCiCFlvYdd4gcON+xIbICmLDbKkA/9ztgvVl8vTxBWcHipjz8KFF9 yaTbPEmss7ewBnH5q80h6w22ltZrwmHNrYRAgXrLvQmCgBP4rMbEjj72xDQGoHTbSLqb p0vXjfFX67mdcxHVndTRytD7XhYQeQqna7ENckhA1dz0dROIY6dzecBXghHvzbT+pXm8 eoZRVNkfqKa+0yebLsKcSll8i8yIiXtCzJAStnq0GmFIHr1GAxhMLWQWs4tZstEWMQMd JgfQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h13-v6si9265722pgq.285.2018.10.15.07.23.31; Mon, 15 Oct 2018 07:23:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726841AbeJOWIb (ORCPT + 99 others); Mon, 15 Oct 2018 18:08:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37468 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726561AbeJOWIb (ORCPT ); Mon, 15 Oct 2018 18:08:31 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 501FAA82C; Mon, 15 Oct 2018 14:23:01 +0000 (UTC) Received: from treble (ovpn-125-6.rdu2.redhat.com [10.10.125.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DF3CB1057075; Mon, 15 Oct 2018 14:22:58 +0000 (UTC) Date: Mon, 15 Oct 2018 09:22:52 -0500 From: Josh Poimboeuf To: Nathan Chancellor Cc: Andy Lutomirski , nick.desaulniers@gmail.com, Dave Hansen , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , X86 ML , LKML Subject: Re: [PATCH] x86/mm: annotate no_context with UNWIND_HINTS Message-ID: <20181015142252.6p2zgkznj26jzdwl@treble> References: <20181015003726.29103-1-nick.desaulniers@gmail.com> <20181015051705.GA20687@flashbox> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20181015051705.GA20687@flashbox> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 15 Oct 2018 14:23:01 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > 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 > > > --- > > > 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