Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3129163ybb; Mon, 6 Apr 2020 02:42:14 -0700 (PDT) X-Google-Smtp-Source: APiQypKYKrVqcPTRzKYDyd+i5GAPlWsVta3VPurkOlshFyR34dMDJBHl/ym1Vc2I/g9XkqlVL3Jh X-Received: by 2002:aca:da8b:: with SMTP id r133mr12323148oig.81.1586166134114; Mon, 06 Apr 2020 02:42:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586166134; cv=none; d=google.com; s=arc-20160816; b=mVVgSa6zNttaauDI6b4wGiQfAPir+t52okpaM4M1RGESdRcBKH5L0Kha1hPdoocaD+ JZ/u4L3FnLPupKYUDbo79sCVTZAnLMY07CZJ4sgfKOBcVM85WbY8csJpnLVQxz8xoY5R e7bgtrqybNqoFWdtZ1aHYHIuSGtCkkLG+71xMXjoS3BPUbyeyWK2dFHyG6EqiwYTxFt3 4dW8cuvlCh5fjDCfJiZ+HbEwf3XewWpd3xiCaziYnWNTFo2Hk709y0fNM0zqtTLydAMC 0jAubG/G5N0x1Nc1SVIiMkoPDseGVW8SUeBQsn2cliTfLgQcu/ak3LqMK3pde2UGN0q1 Hd9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=eWD0h4HDJIC+j23RjV+nLrsJjqGzLhXKvD7tRceWp/E=; b=j9aex6+ANhDhaqc+zteUgZHEI8OoBUwCyNyyRdwQQXSQo4Xf13xFi8lnV9HyTrxHvz T2FI5uRFkqDWbXoop1H+NYHDkdX7b2cMXG4Cqsy3T8YonYXm3Nf44gmtY/V1rw+KFWha e0t7SdB5/BwiK6H12ydflPLbG/VHE3bNr8b/XfSxpSSomY74ECaMoESB9XW5zVTtyiBs V1ZN3pQmFGw9+HNjhdeSArJ49TcOZCywNVDFhfg+H/RZRjXltvASB5LNLPdaf7/ngSAb RArqehgpou1l1+ctekF35qOmpGVgtfevATiAsIjUrufxieAcyBEGjwVzp/9HNG8rpclv Wyiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=QMMEHPi1; 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 7si7105586ooy.80.2020.04.06.02.42.02; Mon, 06 Apr 2020 02:42:14 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=QMMEHPi1; 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 S1726788AbgDFJlj (ORCPT + 99 others); Mon, 6 Apr 2020 05:41:39 -0400 Received: from merlin.infradead.org ([205.233.59.134]:33350 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726675AbgDFJlj (ORCPT ); Mon, 6 Apr 2020 05:41:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=eWD0h4HDJIC+j23RjV+nLrsJjqGzLhXKvD7tRceWp/E=; b=QMMEHPi1bthngWf2yz1q7kCfRJ FFhLDiGBJGLO175iwcsz0ES6qU5SeUEhqWiMyc7o3OdQn5Zhmz30HemWzCLsXfRir/JoUdUmfax7F YIQt5vQMBk3yrKnCLW3xd2/NeBdQi8D6EZPXfTEOhCnu0wwJVNXkfxfzae3AO2/VQWi5CpqgDvbv+ 8R8qNwmsA1prUXlUjj/5XbIfDiktpBjw7PlE/ziVJD1BqojXBA3CUv9ps7f7TVdP+Ci+spR5lL/ke vTitP1swSSvUJvEMZpBOk/w/A4IPk45m9+k6p4tkizSJJw2abRG4z8UnunmQYF/kGvMXFLC1dR6jn p2CKvipw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jLOG3-0000Ak-5Y; Mon, 06 Apr 2020 09:41:31 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 980D0300478; Mon, 6 Apr 2020 11:31:43 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 81C312BAC6A6B; Mon, 6 Apr 2020 11:31:43 +0200 (CEST) Date: Mon, 6 Apr 2020 11:31:43 +0200 From: Peter Zijlstra To: Alexandre Chartre Cc: Josh Poimboeuf , Julien Thierry , x86@kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de Subject: Re: [PATCH 4/7] objtool: Add support for return trampoline call Message-ID: <20200406093143.GH20730@hirez.programming.kicks-ass.net> References: <20200402154022.GG20730@hirez.programming.kicks-ass.net> <20200403151757.lhhia7pzqptvlqz5@treble> <20200403154620.GS20730@hirez.programming.kicks-ass.net> <20200404133218.GL20760@hirez.programming.kicks-ass.net> <20200404142232.wpn7estahnabfy3z@treble> <20200404155126.GF20730@hirez.programming.kicks-ass.net> <27f433a3-6109-9831-5292-3df4155e10fb@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <27f433a3-6109-9831-5292-3df4155e10fb@oracle.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 06, 2020 at 10:19:56AM +0200, Alexandre Chartre wrote: > > On 4/4/20 5:51 PM, Peter Zijlstra wrote: > > On Sat, Apr 04, 2020 at 09:22:32AM -0500, Josh Poimboeuf wrote: > > > On Sat, Apr 04, 2020 at 03:32:18PM +0200, Peter Zijlstra wrote: > > > > On Fri, Apr 03, 2020 at 05:46:20PM +0200, Peter Zijlstra wrote: > > > > > On Fri, Apr 03, 2020 at 10:17:57AM -0500, Josh Poimboeuf wrote: > > > > > > Peter, I think my previous idea for UNWIND_HINT_ADJUST stack_add=8 would > > > > > > work here? > > > > > > > > > > Yes, it would. > > > > > > > > Sorry, I have reconsidered. While it will shut up objtool, it will not > > > > 'work'. That is, the ORC data generated will not correctly unwind. > > > > > > > > I'll try and write a longer email tonight. > > > > > > Right, that's what I've been trying to say. The ORC data will be > > > non-deterministic unless we unroll the loop. Or did you mean something > > > else? > > > > The below should result in deterministic code. > > > > diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h > > index 07e95dcb40ad..109ee65f4a11 100644 > > --- a/arch/x86/include/asm/nospec-branch.h > > +++ b/arch/x86/include/asm/nospec-branch.h > > @@ -59,8 +59,8 @@ > > jmp 775b; \ > > 774: \ > > dec reg; \ > > - jnz 771b; \ > > - add $(BITS_PER_LONG/8) * nr, sp; > > + add $(BITS_PER_LONG/8) * $2, sp; \ > > + jnz 771b; > > #ifdef __ASSEMBLY__ > > Nice. This works fine and allows to remove ANNOTATE_NOSPEC_ALTERNATIVE when > using __FILL_RETURN_BUFFER. However this is probably less performant because > we now have nr/2 add instructions instead of just 1. Does it actually matter though? That is, can you measure the difference?