Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4381048ybb; Tue, 7 Apr 2020 06:28:43 -0700 (PDT) X-Google-Smtp-Source: APiQypJyp3DXVVEBGdBUTpo93TDr4kqpCBsyDL/WuZRaVgZizDo09gJwAfxwLGSothka5ZqbbM35 X-Received: by 2002:aca:3889:: with SMTP id f131mr1600218oia.154.1586266123073; Tue, 07 Apr 2020 06:28:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586266123; cv=none; d=google.com; s=arc-20160816; b=kai5D1qNcggsfJJGkKNKXhMD9BU5zaw9cC/G98Tk5ho3dLv9pIkBdA6jpFgJRyt8d3 9jw/7uLLE8v3F5hV66826XVOrWXPa2x8IoV8S2u9Y69F9aP3ahFvIX2iysSjClHXp3Zv ezN0muwPrPvG3UvxyU1uFuEje7z7HGAoS8dazdX763zK1gUQMPtloR+WQ5fZlBuC7waw 4z9o9qvWAKIM8hLv4yNOiZSU/pEj0FQP8uuaDNk2DRjwKm9k1fNzqGYYZ3Q9tZjettct mS1Cea+ROmNW1LJlvFVMifAvc5+5rS1VGrQnzDPNoFVhHjSYI5WqmM/d4qbfcGtJSRiA A4mg== 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=XbhhpaH/SFh6E99OqnskVI1bse12C1UUsZMwShUxJYc=; b=i6A0bm0mr3XrqfifP8ljQQGO+GcjqYG4RNgW6HINiIApoh6OjLDZc1Nsl+VielCJ8g dWdtD93JEqqaWqxMFcYKVBu/bZneTo2M2OsVQ7UvUZc3IKw09frsZ5yj9Mt+URwKP7mM kKXXam7vlrUetOUhgjY9hXOrAl9C2tEwlBTPsHju6vy0/HkUazIgRWHQ7sx9gwrKn0f7 c1/cRBAyTJCkJja7XtifxgnETk9dY6d+LfTqQw+AguodgrcnqkeB2aKA2FWxQoMErgQI RZL8poC1wLcqQgeOw32NzfBMro6J5PSd4SrVFRWi5QIppz+BJafZpX89zyURttoCXG9h tKKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Z5jZnoc2; 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 d185si687997oif.234.2020.04.07.06.28.30; Tue, 07 Apr 2020 06:28:43 -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=Z5jZnoc2; 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 S1728652AbgDGN1z (ORCPT + 99 others); Tue, 7 Apr 2020 09:27:55 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:37241 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728482AbgDGN1z (ORCPT ); Tue, 7 Apr 2020 09:27:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586266074; 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=XbhhpaH/SFh6E99OqnskVI1bse12C1UUsZMwShUxJYc=; b=Z5jZnoc2UOqK8Aby7ru2nFwImerM3xnztdQ1Gk//C32d9MM9TM+ve4QnDHHbLsmPLxKCot TM2vYgI9XHrvrjSXjfB7ebWnmHPypK5ApBOKct8zUAkODJ/INtNjx6uqDjJDf2u6JZPHS2 ncOU8vYXLLuKG7OkYM0Rmx81oMUiUrw= 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-399-UsDFAZpXOSCwoiO2FQ8XBQ-1; Tue, 07 Apr 2020 09:27:50 -0400 X-MC-Unique: UsDFAZpXOSCwoiO2FQ8XBQ-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3C87CA0CCB; Tue, 7 Apr 2020 13:27:49 +0000 (UTC) Received: from treble (ovpn-116-24.rdu2.redhat.com [10.10.116.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 647B35DF2A; Tue, 7 Apr 2020 13:27:47 +0000 (UTC) Date: Tue, 7 Apr 2020 08:27:45 -0500 From: Josh Poimboeuf To: Alexandre Chartre Cc: x86@kernel.org, linux-kernel@vger.kernel.org, peterz@infradead.org, jthierry@redhat.com, tglx@linutronix.de Subject: Re: [PATCH V2 6/9] x86/speculation: Change __FILL_RETURN_BUFFER to work with objtool Message-ID: <20200407132745.iieggolloidvdiwu@treble> References: <20200407073142.20659-1-alexandre.chartre@oracle.com> <20200407073142.20659-7-alexandre.chartre@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200407073142.20659-7-alexandre.chartre@oracle.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 07, 2020 at 09:31:39AM +0200, Alexandre Chartre wrote: > Change __FILL_RETURN_BUFFER so that the stack state is deterministically > defined for each iteration and that objtool can have an accurate view > of the stack. > > Signed-off-by: Alexandre Chartre > --- > arch/x86/include/asm/nospec-branch.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h > index 5c24a7b35166..9a946fd5e824 100644 > --- a/arch/x86/include/asm/nospec-branch.h > +++ b/arch/x86/include/asm/nospec-branch.h > @@ -60,8 +60,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__ This still isn't a complete fix because the macro is used in an alternative. So in the !X86_FEATURE_RSB_CTXSW case, this code isn't patched in and the ORC data which refers to it is wrong. As I said before I think the easiest fix would be to convert RSB and retpolines to use static branches instead of alternatives. -- Josh