Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4104459imm; Mon, 15 Oct 2018 09:10:09 -0700 (PDT) X-Google-Smtp-Source: ACcGV61x6OAsF9MpO6NLKcWhqST752GiP0uScNiQx/6AryIsJ/6vB5dyiE4HzRAS9XxQioPAdXEl X-Received: by 2002:a63:3f07:: with SMTP id m7-v6mr16989321pga.115.1539619809762; Mon, 15 Oct 2018 09:10:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539619809; cv=none; d=google.com; s=arc-20160816; b=dAdNBbVhQxL8mGhaP+Xr3bcC0BQLE4OovTsu+3ja2fEJ2GdDeQPkfbYL0TuVM2uTJE SO1H+xstnlHusxpRcri6ey+3FhJZF0Fw7VS+Uax0p+8mwwszF+xs85U3T1mk8ApNNTTD ibDMz6g/910HvHDf9CctulFpleaTDRA+4Am7Ko4HqzU6J8h6mp+/LFS0VdbquyWq5OqS pSlilLRMV2KqL2mg9+AjOo8VLCPPMYhkKvlWj6kCrdTcYDp5fD1sBwAoqHrl9NmmuV+P vYeW5pfkUpDvf0uXttI6igkB3EsrMVWZfBOEdTzNEYNcjnDtTOLq/X3QEmTeWHXmgBM+ GWDw== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=4xyGCUgRtTRSPXV7Q4n7nLnDvP62TxhiFCNIh1ZlZyA=; b=neSBuVPgLICA0t1LaNLXKnmKAW7fpdoyyjB8G5ngAgM9Vs+LaY+TEt+21fvRiaFIWS 02Z4P+sHhwxKgCMBpbdoQlY8iksB4vEpn/0ak5Oe7sTlh0S+x+Mn/b+emH1hNGnSONJp 9l6YCZFgCoZyNchBf27S5ZhZE2xJyxwoF3p0cZEnmlqMgKXrNYc4iN8xi/AbYxEXA0hT tUZHh+zgIaqV99n4uHoBlxxMjtF06yRwXiOemdFDCZ0WF21oRXw12ErMzqfJAhOnRk/k MFrz5U1dGhqNXQJenJ7kLJmbZcXakKwde0syZR+IdbiBIPgZuTJxwn5H+9nCxMHll0/d k6ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=h80M5mmy; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a9-v6si11131089pfe.29.2018.10.15.09.09.53; Mon, 15 Oct 2018 09:10:09 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=h80M5mmy; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726715AbeJOXxd (ORCPT + 99 others); Mon, 15 Oct 2018 19:53:33 -0400 Received: from mail-wr1-f51.google.com ([209.85.221.51]:43103 "EHLO mail-wr1-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726651AbeJOXxd (ORCPT ); Mon, 15 Oct 2018 19:53:33 -0400 Received: by mail-wr1-f51.google.com with SMTP id n1-v6so22004282wrt.10 for ; Mon, 15 Oct 2018 09:07:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=4xyGCUgRtTRSPXV7Q4n7nLnDvP62TxhiFCNIh1ZlZyA=; b=h80M5mmyHy9GSyFgcuEkYV0Fuv7Jk306wwMhhgyA40ddRBXLoLEmMJYas+hjfB2Tvt UOf7c2Ty+twEvZF1UbBHjJ7GYm5j4+i3qq4P0cQFNn2MLblz/BfopXE/zJSvXn3bwaSm QayPL1gdVM14a3qO6QRTJ1GqxEkfs7vGDUt5v+1XmlWWK8ptRQQ0ETdeRSRmrIcOufCF RvblfMYgTUloVEtPlDqKkHCohUtCHni5jqEGkxOYy0ZidwNNnfzVGjTUii61Ko8JCBTH Fu7IU/pviZkFq7IJquuz0XpwLjkY2MAtvwY65qNYCTbvjtkVo4wuA0QWl8FIsll012/W XPCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=4xyGCUgRtTRSPXV7Q4n7nLnDvP62TxhiFCNIh1ZlZyA=; b=OG551sdGu8r3MAeLdwKhJ56bYUWgnwBfuooHec+MfMa6SSqM0s+Bph8uoMFzbP+VTE yf1tQ950vRGBl63jXfy7wLa69z10WvR7ecFdHJOXnMCoILA+H/IekFmdkDMR0ye1K0qo BSt6UhvEgiln3xM8Upr4zSYWbwJXG7jlaIwSXYhOE6/vRZpOusjIg2fav9hIH9NB2WaE eczwL1tHCyOxk15EoRQj+ZBMTsmUuj80h4ueqwPfdmedouAo8nc1VPSGW55h/+BtVLUb Q/Nun2YrYXjegmTph2vYJAkEMV8+3HWS+WBuy6RlJGSVXf2q+yr3aqi+nwxhncACtKjP Qx2Q== X-Gm-Message-State: ABuFfoiRZHYRjnlh4MHtQ1V+/CqLnd+l5KikxJukcbzzDaaOfPk7waZX ekujbfgzqtGNZzx/ubp4vj8= X-Received: by 2002:adf:bf11:: with SMTP id p17-v6mr2440514wrh.235.1539619659256; Mon, 15 Oct 2018 09:07:39 -0700 (PDT) Received: from flashbox ([2a01:4f8:10b:24a5::2]) by smtp.gmail.com with ESMTPSA id z185-v6sm16361347wmz.47.2018.10.15.09.07.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 15 Oct 2018 09:07:38 -0700 (PDT) Date: Mon, 15 Oct 2018 09:07:36 -0700 From: Nathan Chancellor To: Andy Lutomirski Cc: Josh Poimboeuf , Andrew 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: <20181015160736.GA20997@flashbox> References: <20181015003726.29103-1-nick.desaulniers@gmail.com> <20181015051705.GA20687@flashbox> <2CCAF5D3-1B11-43BF-93E4-72C2603A184F@amacapital.net> <20181015152221.GA16375@flashbox> <20181015153144.buuow3yof2njjzjm@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 15, 2018 at 09:03:40AM -0700, Andy Lutomirski wrote: > On Mon, Oct 15, 2018 at 8:31 AM Josh Poimboeuf 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