Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5120506pxj; Wed, 9 Jun 2021 09:34:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysFR6Efz0ephjzoei3Dj1ZCYqmtzdr9ECVUxFhljOY6QWrQYJsMS815NB9s1MC6ivjRpSY X-Received: by 2002:a17:906:3485:: with SMTP id g5mr745771ejb.174.1623256476330; Wed, 09 Jun 2021 09:34:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623256476; cv=none; d=google.com; s=arc-20160816; b=nzcjgYGiZb/oEIYPyeKfIMeJGcEabhfiIoLu4ZHqABPI49JSQamxjHhnmRiPXzkHWR t+XBx7dKzkKLwyVXaEi+Opvep3uWt4MgFdC9waPiM5kXYkYC8WBdiIWzrNqPC1aXeaDx M7WL3l4CjcYLXEB+FZhw2TIWaNZU4L0aywzmnr9ZXunheJ6Nsg92om1YWUEpUfqdGMUS zj5HTjCtn4wFwfsBSkooYGL+3NUUe0eX+Nzwm36Kh1iC2QPyqTGKPNBwXcHRtelO8hWI 5gwJBaamZ2YYXqD6Vu9u4YpClEw031+Lr7zxqp/mM3x6N9tFrm7KIwxFc9xWXkmOei+/ AFgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=g7BsolxgiPfxHCxc4J7uGo+erTnS2WKVGV6E003FUuE=; b=y1xVeusDg8Crnx5aW22pxH99Lmr3kGk8+FKgBZst3WTDZrS3un315HT1VhvSIqLKLq nc/hwYqWWk6fxzQrA6sNtsZDQzFZKwwovkSnyKppCfGgxnTTpWE6e1VMb/gl+lcGNDZ3 xYv1jF6IQ6BRCRuFw82DlEJVMht/C5+LJl1O98kPQwz4ZOstUoxkos+KWtll7n5ClfVP xf+smfDQHkwbt7Dk/MpC7QS43Rt/MQp+Uq7+jgb34n7JIuQTBxcIcVf152fb/gQTbGBl 8FIaIcY7uBbCZySnLq3Is/lvW7Yjak0pm0VjfE0w+F+y1vEkjpMZ71h54Qkgp8an4IHK NnSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=si0WHEUr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bv2si230409ejb.450.2021.06.09.09.34.12; Wed, 09 Jun 2021 09:34:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=si0WHEUr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234775AbhFIP6A (ORCPT + 99 others); Wed, 9 Jun 2021 11:58:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:41224 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230311AbhFIP6A (ORCPT ); Wed, 9 Jun 2021 11:58:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1EA7C61278; Wed, 9 Jun 2021 15:56:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1623254165; bh=Brj8Ps1D07lmJb6l+32gl6pseZbIS/xTqR+sZ9RrEqQ=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=si0WHEUraK33aa73XI62zclY1ZoTVBTXpVGjoHXZf5VcLR26D1Sm/dJ2hOENR+HH0 tzs+Rz8KxAZjpDuxO6mIYlNnAIXvDdK3uyeWZllSEuM+WlGDgN1uLTF/1rL0nvZFds Ql/DUmvvc1yQbTOvz9zayqj5lOXhJ+7ch2Ajdb6X+0FPgnWdW5y1BAm0PBnRJIXjEg Uk5rYyfM8oRkaz273VrGWPhBnr0yPhvc7CmT80Kts4fCRosNNYj9QoZhBGd07D7sM0 TLEzsjzpEbKmy/09EE+5AAn6j2ctbqI9scZIlEdY69i/ozqpU6B1IdJ2GmTJyQ5PW0 x88JdjLTJ7bqg== Subject: Re: [PATCH v3 16/16] objtool,x86: Rewrite retpoline thunk calls To: Peter Zijlstra , Lukasz Majczak Cc: Nick Desaulniers , =?UTF-8?B?RsSBbmctcnXDrCBTw7JuZw==?= , Josh Poimboeuf , Guenter Roeck , Juergen Gross , =?UTF-8?Q?=c5=81ukasz_Bartosik?= , LKML , mbenes@suse.com, =?UTF-8?Q?Rados=c5=82aw_Biernacki?= , upstream@semihalf.com, "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , clang-built-linux , Sami Tolvanen References: <5dd58dce-c3a7-39e5-8959-b858de95b72c@kernel.org> <20210609150804.GF68208@worktop.programming.kicks-ass.net> From: Nathan Chancellor Message-ID: <6caa3fa0-f71c-1a3f-b944-57b518645e74@kernel.org> Date: Wed, 9 Jun 2021 08:56:04 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210609150804.GF68208@worktop.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/9/2021 8:08 AM, Peter Zijlstra wrote: > On Wed, Jun 09, 2021 at 02:23:28PM +0200, Lukasz Majczak wrote: >> śr., 9 cze 2021 o 09:20 Peter Zijlstra napisał(a): >>> >>> On Wed, Jun 09, 2021 at 09:11:18AM +0200, Lukasz Majczak wrote: >>> >>>> I'm sorry I was on vacation last week - do you still need the requested debugs? >>> >>> If the patch here: >>> >>> https://lkml.kernel.org/r/YL3q1qFO9QIRL/BA@hirez.programming.kicks-ass.net >>> >>> does not fix things for you (don't think it actually will), then yes, >>> please send me the information requested. >> >> Ok, it didn't help. Peter, Josh I have sent you a private email with >> requested information. > > OK, I think I've found it. Check this one: > > 5d5: 0f 85 00 00 00 00 jne 5db 5d7: R_X86_64_PLT32 __x86_indirect_thunk_r11-0x4 > > > +Relocation section '.rela.altinstructions' at offset 0 contains 14 entries: > + Offset Info Type Symbol's Value Symbol's Name + Addend > > +0000000000000018 0000000200000002 R_X86_64_PC32 0000000000000000 .text + 5d5 > +000000000000001c 0000009200000002 R_X86_64_PC32 0000000000000000 __x86_indirect_alt_call_r11 + 0 > > Apparently we get conditional branches to retpoline thunks and objtool > completely messes that up. I'm betting this also explains the problems > Nathan is having. Yes, the below patch gets my kernel back to booting so it seems the root cause is the same. > *groan*,.. not sure what to do about this, except return to having > objtool generate code, which everybody hated on. For now I'll make it > skip the conditional branches. > > I wonder if the compiler will also generate conditional tail calls, and > what that does with static_call... now I have to check all that. > > --- Tested-by: Nathan Chancellor > diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c > index 24295d39713b..523aa4157f80 100644 > --- a/tools/objtool/arch/x86/decode.c > +++ b/tools/objtool/arch/x86/decode.c > @@ -747,6 +747,10 @@ int arch_rewrite_retpolines(struct objtool_file *file) > > list_for_each_entry(insn, &file->retpoline_call_list, call_node) { > > + if (insn->type != INSN_JUMP_DYNAMIC && > + insn->type != INSN_CALL_DYNAMIC) > + continue; > + > if (!strcmp(insn->sec->name, ".text.__x86.indirect_thunk")) > continue; > >