Received: by 10.223.176.5 with SMTP id f5csp3152235wra; Mon, 29 Jan 2018 09:32:13 -0800 (PST) X-Google-Smtp-Source: AH8x225eVlmlWtC39SKOpcL2uyTeR/Hu76H71+ZmrWlQv/EVEJvS+dKToPRofTdiuoYxCzipJgjE X-Received: by 10.98.82.68 with SMTP id g65mr27770776pfb.212.1517247133016; Mon, 29 Jan 2018 09:32:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517247132; cv=none; d=google.com; s=arc-20160816; b=K+B9gv/xqf6j312tC6IGTzdgGYreT0OrEBSt0gZwAuFmnmWkr4046mVYWAHz6Gvmq0 8azKczBZUUFv10mosGVTo0YokYqLyN9eM130CH38lvGUluVdRCQUS3nNH8fN5KhZ8VT1 Xmy23LLtX6eAm2LznByMxenM48QEM4Yy1HM4lf5HsfkICcM1lb3lSLQaPz7Khszzk/M3 EhwOFg5eoWT5UZJMExhXz/kCcZ8p19X/GQ9hYIHD0LdHsYJ7uU34w0zqgonv8l7DLLaJ oKv9KlUGrNku829ICoNAsAS6HGpATA4O/e427SOwiKC2aUZgO5aWlH6ZIt8QuXjvNmz0 1I2w== 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 :arc-authentication-results; bh=SQUFQgT/SLr9fJyqtTYoopMJ9Qq34VmzMPHvggr5dfs=; b=HDnBnNjUmEGSgvcWwS3Eav36GyBP9bbk5xDfgAroCEVHACdIA5fsrP1TasZDWhvyfn RgEDuzm8Eh7w8M3ZLobNGvX/53RtNpSlwnxTZG8mjzRSWOZ2X4EMobXkfz95QTBRnauv zjy6uCkSVPeJXOLybDn9hsCUH93MD0S+Jdn3jaJnHy3WnxCE0OQZdhOpYvck+O3+VFLd guy+cCPDaTE50ljeHQggDwQgoVjYOSZRbTkukQfDWBs/hhL7c36HgLjiEe0rNMwX0PYK sboC425ksVWaIsbgSDMBtZNwLDkdNoiavBvGgRoc6gtvs84WsAZ7z3LStdYSgi3+o+Ca /yNw== 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 5si18436pgj.750.2018.01.29.09.31.58; Mon, 29 Jan 2018 09:32:12 -0800 (PST) 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 S1751464AbeA2Ra3 (ORCPT + 99 others); Mon, 29 Jan 2018 12:30:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44174 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751296AbeA2Ra2 (ORCPT ); Mon, 29 Jan 2018 12:30:28 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B035E7F755; Mon, 29 Jan 2018 17:30:27 +0000 (UTC) Received: from treble (ovpn-120-158.rdu2.redhat.com [10.10.120.158]) by smtp.corp.redhat.com (Postfix) with ESMTP id C030D1815C; Mon, 29 Jan 2018 17:30:20 +0000 (UTC) Date: Mon, 29 Jan 2018 11:30:20 -0600 From: Josh Poimboeuf To: Guenter Roeck Cc: David Woodhouse , Andi Kleen , Paul Turner , LKML , Linus Torvalds , Greg Kroah-Hartman , Tim Chen , Dave Hansen , tglx@linutronix.de, Kees Cook , Rik van Riel , Peter Zijlstra , Andy Lutomirski , Jiri Kosina , gnomes@lxorguk.ukuu.org.uk, x86@kernel.org, thomas.lendacky@amd.com Subject: Re: [v8,02/12] objtool: Allow alternatives to be ignored Message-ID: <20180129173020.hm3fbgcwn6ioso4k@treble> References: <1515707194-20531-3-git-send-email-dwmw@amazon.co.uk> <20180118190931.GA27143@roeck-us.net> <20180118193315.zrrya7qo6kf7pmzp@treble> <20180118194112.GA28449@roeck-us.net> <1516649644.9521.61.camel@infradead.org> <20180122202522.GA29081@roeck-us.net> <20180128210642.xob2win53h2gztak@treble> <20180129171526.GA17121@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180129171526.GA17121@roeck-us.net> User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 29 Jan 2018 17:30:28 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 29, 2018 at 09:15:26AM -0800, Guenter Roeck wrote: > On Sun, Jan 28, 2018 at 03:06:42PM -0600, Josh Poimboeuf wrote: > > On Mon, Jan 22, 2018 at 12:25:22PM -0800, Guenter Roeck wrote: > > > Hi David, > > > > > > On Mon, Jan 22, 2018 at 07:34:04PM +0000, David Woodhouse wrote: > > > > On Thu, 2018-01-18 at 11:41 -0800, Guenter Roeck wrote: > > > > > > > > > > > Not sure, does your gcc have retpolines?  Give me your .o file and I can > > > > > > diagnose it. > > > > > >  > > > > > Yes, it does, only it is the gcc from the Google toolchain which may > > > > > generate different code than the upstream version. > > > > > > > > > > I attached an affected object file. Please let me know if there is anything else > > > > > I can do to help. > > > > Disassembly of section .text.__x86.indirect_thunk: > > > > > > > > 0000000000000000 <__x86.indirect_thunk>: > > > >    0: e8 04 00 00 00        callq  9 <__x86.indirect_thunk+0x9> > > > >    5: f3 90                 pause   > > > >    7: eb fc                 jmp    5 <__x86.indirect_thunk+0x5> > > > >    9: 48 8d 64 24 08        lea    0x8(%rsp),%rsp > > > >    e: c3                    retq    > > > > > > > > That has the old-style CET-incompatible retpoline in a COMDAT section > > > > in the .o file. What compiler options are being used for that? The > > > > kernel should only use retpoline if GCC supports both of > > > > -mindirect-branch=thunk-extern and -mindirect-branch-register, and this > > > > compiler is doing *neither* of those.  > > > > > > It uses "-mindirect-branch=thunk -mindirect-branch-loop=pause > > > -fno-jump-tables", though I don't know if that even exists in > > > upstream gcc (it is the gcc use for Chrome OS builds). I'll pass > > > your feedback to our compiler team. > > > > > > Either case, I think it is less than optimal that objtool crashes > > > with _any_ object code. > > > > I've got a pending fix for this, so that objtool doesn't seg fault, and > > instead prints out a warning: > > > > quirks.o: warning: objtool: efi_delete_dummy_variable()+0x99: unsupported intra-function call > > quirks.o: warning: objtool: If this is a retpoline, please patch it in with alternatives and annotate it with ANNOTATE_NOSPEC_ALTERNATIVE. > > > > The code is here, along with a few more fixes: > > > > https://git.kernel.org/pub/scm/linux/kernel/git/jpoimboe/linux.git/log/?h=TODO-objtool-seg-fault > > > > 'objtool: Improve retpoline alternative handling' works for me. Thanks! I'll give you a Reported-and-tested-by: Guenter Roeck -- Josh