Received: by 10.223.176.5 with SMTP id f5csp2368337wra; Sun, 28 Jan 2018 19:03:10 -0800 (PST) X-Google-Smtp-Source: AH8x225nUS3E/PACdnTJHn2TlMSmlAMznmGSjUC2Ywbqwyjy/SGx6laR9W1L3/oNaDk/scMrZGe1 X-Received: by 2002:a17:902:6c0c:: with SMTP id q12-v6mr12599941plk.51.1517194990315; Sun, 28 Jan 2018 19:03:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517194990; cv=none; d=google.com; s=arc-20160816; b=mCHHQBgM8kWKZf/5A77OkjKsD7QGO+X23oIICg11jeYhRr678OeDScuOss+7IgN28Z hgYNKSFpkjjc2TYI1zSiB0GKqcC067r6cuI2OsKCjcV9wv4Gv8XlwrSFnxIZ641EP6Tr tZx2BbKpDkZYfrqLrtigcRTgtYA897UXRZ4niBVgFStcDPf9kBwZj6+z5P8kx1Spl4vO nBUdqj7f1qzHNAC90+6/FxUZB3o1QAeCH3Rxpcl9qB7sjiroWRmPlTpVC7UC8rshENii pn4v+NDDt+WqyZ0DBk4/BCg1XAJ+/3q+V4R7noNuV9hgOS55Tc2NzZRko0kpP+H/z2wR hoqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=cWB5OxBhTHqTRGPqLpOPkBM0+odljJSdaxoj3AaJAxw=; b=uaa6fj3/Nzvi6B0x1GwvY1B5jvZ0VR/TErXpobIktmBvNRKowLERqQCRGV6frx4oTE uf8JDwpl1PVL5C3rCMi0zrUEE0FhwBaFN3VUNHafHzko8YZLz/SCcDagjN0WjIaQywKb lj2+6mvsiFPpzJGQr2zMSQ3s4fOYl1O2uPGsBz8YEgVlLM8O5bGdZnM0o7EBUI6L8/iz Tn6qzXITpGt3vdH2V9lA7Bcwp4dU+Cr9zyOzkJMaYzvExuolZFfQ0QWW31bILNegAuLZ C2Cmr2c48dQ2PXGRJzHxhuA1GBIKFSTuMnEf8MRg+GD0mq8fc7R5aVp4S1wzfU6/+Zi4 t9UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=RWDWJrsj; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v70si305681pfa.405.2018.01.28.19.02.56; Sun, 28 Jan 2018 19:03:10 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=RWDWJrsj; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754634AbeA2B0K (ORCPT + 99 others); Sun, 28 Jan 2018 20:26:10 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:32774 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753651AbeA2B0J (ORCPT ); Sun, 28 Jan 2018 20:26:09 -0500 Received: by mail-pf0-f193.google.com with SMTP id t5so3480146pfi.0 for ; Sun, 28 Jan 2018 17:26:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=cWB5OxBhTHqTRGPqLpOPkBM0+odljJSdaxoj3AaJAxw=; b=RWDWJrsj82TqB20AQN+q4ZUr6ssFGaacDZcGTgBtotCCzJY9j4++UNbTmZ6VOkgsk5 nfDqmZMzkh+RHs6kMFI9EQaHLtQ+etQ4ULZuHrfGeJoKZuQClCdbgOsNoygpQHfOaO+3 P4MRNuZzxL26ReftZHy+jXm0nxyMU6Zb09G7xQ5IKBJ6RjqKgejqkbvQA0ynFFF4+Yw4 6YcveiRtFXLL1ho3tQGvS5sduj2bU1zPOYfkgcGk1yd2E6QfzKlZn+MyuMohrDfv7x8U u6koKEcHy7zNDYCle++uSD8hSasMkAvljWgjX/gx2npD05UxtzPAVGw7SoUbiXlLW7eH uFZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=cWB5OxBhTHqTRGPqLpOPkBM0+odljJSdaxoj3AaJAxw=; b=AvIYxA9OuCcVHLe1m8JopVAVamHzTHfVIvLn8LZq7DvExw31wa+VloKlnGs+F/6yst TzYLrIWx8FFuFYozImTKwyfS9zySHcJIbD5ojFDVkDg413/uTGhIToPZ+/ZPOgf0TC2M YyXCMBE6N+aXvcMsWsEmTo/dXR7l2QD2GfLLZX3rCr06d68EhIOsrJoNgQKYuVjGkLPP ISqPs7ZZFVa8hClKI7+ote8Z5lsFdhcptHTARYWEivrhcmk5rJGTWjhMzKIpDvzfl7D/ agnbXa6fnbb4NxM52xCoZ30x5INOwYwT5OorWrh2mzXtiwdsZGy0QgxBf+KjExJ/43zH DT7g== X-Gm-Message-State: AKwxytctez98wqIwRjn+CoNSH3MsToWFkROw+BQa+BiHLuLQvWzoVptM iwbPN8m48GZInbw5bVE2xA4= X-Received: by 10.98.65.193 with SMTP id g62mr25193213pfd.60.1517189168460; Sun, 28 Jan 2018 17:26:08 -0800 (PST) Received: from server.roeck-us.net (108-223-40-66.lightspeed.sntcca.sbcglobal.net. [108.223.40.66]) by smtp.gmail.com with ESMTPSA id g13sm35370833pfe.50.2018.01.28.17.26.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 Jan 2018 17:26:07 -0800 (PST) Subject: Re: [v8,02/12] objtool: Allow alternatives to be ignored To: Josh Poimboeuf 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 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> From: Guenter Roeck Message-ID: <0a35672a-5bec-d4b2-732b-805b09d7b39b@roeck-us.net> Date: Sun, 28 Jan 2018 17:26:05 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20180128210642.xob2win53h2gztak@treble> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/28/2018 01:06 PM, 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 > Excellent. I'll give it a try tomorrow. Thanks for looking into this! Guenter