Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp589332ybb; Fri, 3 Apr 2020 08:18:55 -0700 (PDT) X-Google-Smtp-Source: APiQypLBIF7xtBHMrensZAIIgR4Upl2ip1z2XaR9oJ6L/OI2GQaPFNjFF+Kzy9uST8DCBlwx8byP X-Received: by 2002:a9d:6950:: with SMTP id p16mr6727253oto.199.1585927135412; Fri, 03 Apr 2020 08:18:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585927135; cv=none; d=google.com; s=arc-20160816; b=Zs+4gXnu/ONzS7kUBeEWDRQHEEPHAUQJ3tUJ0NZYRfyUORCQwZt3xBYvfDk1TSZ9G1 GYa3TmUfgYPJkksQNTkPLkVaAC5daFmp5kh5bab+6dNXfoFMtrxv5L9y9cOVwgfmhVGU dcnA4Pp2saWA73p2FoMWUfJRLCu8dmrrp8AeVN7M3d+mLXrPGt7Zrse4sF0qe7kHc0gW wsT+PnaS4KP5cTNMl+vP723L3US6EKIA4wCrFPouLrsmM+oKDYnGRDrDkhtH4gsolqAT EDgYhKscYW1TlZJ3+SPcicPgr7lAvwgkzrdeHaTXkU5ysF7i3bqctAmS8feHbnHK3LHl wMgQ== 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=etiNrC6SF+z4dhOkBjuavSdV/C9Y+UgseJ5rH+u2MOc=; b=Bg0nD9nPXu7PjGv3/1FewGnr8hlIo4C9qzb2A0w/n+QTtshYEcJtTTk9O7oRPTLsrd xosgOeVALDy7qFbXnk/E+uH710AKuvpX7YzrtWfQpO3Q3Q7YhoLHAdtaCwwhVaE0tV8c H9PpT+stD/cGAfCF5mfFPGz8OtAv81W3GwEJf7ybub901nPrbjl83TguqXS+bbgGcBk4 9vyYmUIO9HdBK5S17/hky8a4Ir4TaFRHPI+eo1KPbgSmHqUm7l8fgJOxXMFCaAQFoF0/ t9r7kZ9vYrrvc3LwG7zP89ewoXIc7/7YKednEHabyIUAcZszgnx71QkgDFQ0/SX0aTjO kAOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eKTGWXwr; 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=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 i11si3938190otj.33.2020.04.03.08.18.41; Fri, 03 Apr 2020 08:18:55 -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=@redhat.com header.s=mimecast20190719 header.b=eKTGWXwr; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404164AbgDCPSG (ORCPT + 99 others); Fri, 3 Apr 2020 11:18:06 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:33512 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2404080AbgDCPSG (ORCPT ); Fri, 3 Apr 2020 11:18:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585927085; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=etiNrC6SF+z4dhOkBjuavSdV/C9Y+UgseJ5rH+u2MOc=; b=eKTGWXwrvKPNBCPhtJt7a5ouSDU7N2eMbDvBt8cKLpuMbR96YgCy6HU2R2rFLKkwzQBh1F e8YYsET+BUvk2+pv6OmozHf2JpuxCtvy/oG8x2DHf7ZUI1ePX2sauRFou1IzvcLL1h+ZqT L7m33o+7MieTtDuo1mTmd2LkdCw1oek= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-412-qPb-2X7BME-03Ix2DbOnUA-1; Fri, 03 Apr 2020 11:18:03 -0400 X-MC-Unique: qPb-2X7BME-03Ix2DbOnUA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2700218C35A2; Fri, 3 Apr 2020 15:18:02 +0000 (UTC) Received: from treble (ovpn-118-100.rdu2.redhat.com [10.10.118.100]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A6D6226DC4; Fri, 3 Apr 2020 15:18:00 +0000 (UTC) Date: Fri, 3 Apr 2020 10:17:57 -0500 From: Josh Poimboeuf To: Julien Thierry Cc: Peter Zijlstra , Alexandre Chartre , 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: <20200403151757.lhhia7pzqptvlqz5@treble> References: <20200402082220.808-1-alexandre.chartre@oracle.com> <20200402082220.808-5-alexandre.chartre@oracle.com> <20200402154022.GG20730@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 03, 2020 at 09:11:55AM +0100, Julien Thierry wrote: > > > On 4/2/20 4:40 PM, Peter Zijlstra wrote: > > On Thu, Apr 02, 2020 at 04:31:05PM +0100, Julien Thierry wrote: > > > My understanding is that once you find an intra-function call, either you > > > hit a return, ending the branch, so the return should undo the modification > > > the intra-function call did (whether is it a retpoline return or not). > > > Otherwise, the intra-function call branch will need to reach an end in some > > > way (e.g. hitting a CONTEXT_SWITCH instruction, calling a > > > dead_end_function). > > > > > > Am I missing something? > > > > The thing is basically doing: > > > > mov $n, cx > > 1: call 2f > > 2: dec cx > > jnz 1b > > add 8*n, sp > > > > So it does N calls to self, then subtracts N words from the stack. > > > > The reason being that the CPU has a return-stack-buffer for predicting > > returns, and call/ret being naturally paired, that works. The above > > is a software flush of the RSB. > > > > Ah, lovely... Maybe that's where SAVE/RESTORE unwind hints could be nice ;) > . > > Otherwise, I don't really have a good suggestion for this... Peter, I think my previous idea for UNWIND_HINT_ADJUST stack_add=8 would work here? -- Josh