Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp986828img; Thu, 28 Feb 2019 11:03:34 -0800 (PST) X-Google-Smtp-Source: APXvYqwHrHwWyPPFKBT7gsputHL4qa2AwQTz0fH9kM7br8oteG5hbactf1+bto4OKUOcczqzoyZb X-Received: by 2002:a17:902:b20e:: with SMTP id t14mr882526plr.97.1551380613947; Thu, 28 Feb 2019 11:03:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551380613; cv=none; d=google.com; s=arc-20160816; b=tG3NfFX4r9UyBUiBLB9EJXpghdQnhW0qFDzwfg1QE5OqT2YRh8rsewKjZcwJYwvHqV fN+KgB489VUpu9Mm1UAiBCtDcvrjmBHEnVL09bkZoMzYg9SImRSKe0APyMIU+om1bnUG bJilVnPYFTrb/KL/dhwPSD1j8WfeSRYyNV16/FilWPrFTCKLqMKmbMDl66gsEERDUM4v xnLkjhr4CbRswhvC1wxO3YzzCZFTiEr7/Abj8mYUoYl1UFQcJId8WD9ewSOAWGc24I44 ZZgwuUCQPtPMPFwwfsy5AlgQoBSzGluZBpJw6ohH834gGbl+OPJR/NDl0K418FTO/75Y tBRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=kGIstRIPMaHHmUX9ti2AYr78dKS9FrMpFqBae+rMp+A=; b=VGKW7h6L7xZXmmpgDFC8sORhmhCQO8UsmJ6bLbCEbQcnqUN/M0MJhglsLuir6wKIhi 8g5X5NpCt0r5gXEC8me/qlq+BOYgfamsJjNC49WXdj2cv/NYuRcKUjZ0EonKU/7NFNlw woD083bj8oWz8ohsvyRYYeeacLubmkU+iFrlLDom1OGnIPlMKijAb9qdvPRzLdPGJ4AC ublleRMBgYechdMQH5LqNAlDK69XRsMTMCVPKaTPrBgRMVAc/pZvWfzf5Xudft7ShPko 9KAvw11t4HbY2p1kDAVlc7jC5MOk1nKdUH5zw1EPkIsn+P9T3c4fzE9oAYmsbPWWnTzP sF0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=MAb08vz9; 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 76si18678341pfs.104.2019.02.28.11.03.18; Thu, 28 Feb 2019 11:03:33 -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=@infradead.org header.s=bombadil.20170209 header.b=MAb08vz9; 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 S1727754AbfB1TB1 (ORCPT + 99 others); Thu, 28 Feb 2019 14:01:27 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:47262 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726093AbfB1TB1 (ORCPT ); Thu, 28 Feb 2019 14:01:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=kGIstRIPMaHHmUX9ti2AYr78dKS9FrMpFqBae+rMp+A=; b=MAb08vz95D76HXImRKhdfzqiG SFYSCliWvLeXuNmGBAAXqvKTr82QiTK1WiULljgYubrN+6vYxB49UDB7GE5VKmDBvhaUFybGE5tCv v0nVpJDcqyF52lEoOHhNovhs9CqA9+tfVnYKnrK/Rb78UVxVXd4t7XkxWH1NpmppMm5yHSoWFEcYt XmoMbDxhyZa7y2CthggE3/6MNSku3aK97anSXinNoND3PM/MCL7bl6PwzltpLVvHlMQSj+QoawAHg uDOrrIZYBlyeZvrZ8eNsScGQ0BmDQ/l0jEllqcP8k96REb2YxF/vDEfGNH4Am/17fgkLb6uDdw+7A lihCX4Myg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzQvi-0006AW-Cf; Thu, 28 Feb 2019 19:01:14 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id F28D3202C2DAC; Thu, 28 Feb 2019 20:01:11 +0100 (CET) Date: Thu, 28 Feb 2019 20:01:11 +0100 From: Peter Zijlstra To: Linus Torvalds Cc: Thomas Gleixner , Peter Anvin , Julien Thierry , Will Deacon , Andy Lutomirski , Ingo Molnar , Catalin Marinas , James Morse , valentin.schneider@arm.com, Brian Gerst , Josh Poimboeuf , Andrew Lutomirski , Borislav Petkov , Denys Vlasenko , Linux List Kernel Mailing , Chris Wilson Subject: Re: [PATCH 6/8] i915,uaccess: Fix redundant CLAC Message-ID: <20190228190111.GI32494@hirez.programming.kicks-ass.net> References: <20190228145450.289603901@infradead.org> <20190228150152.540038736@infradead.org> <20190228175114.GG32494@hirez.programming.kicks-ass.net> <20190228180154.GO32534@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 28, 2019 at 10:29:25AM -0800, Linus Torvalds wrote: > On Thu, Feb 28, 2019 at 10:02 AM Peter Zijlstra wrote: > > > > Weird, that jump is from C, not from a .fixup table. objtool _should_ > > see that and complain if there is a AC=1 path that reaches RET. > > No, unsafe_put_user() actually does the "asm goto" thing, so the jump > is literally hidden as an exception entry. And apparently objtool > doesn't follow exceptions (which *normally* doesn't matter for code > liveness analysis since they normally jump back to right after the > excepting instruction, but maybe it misses some exception handling > code because of it?). > > You may have looked at unsafe_get_user(), which does indeed make the > branch as C code, because gcc currently does not allow outputs from > "asm goto" statements (which "get" obviously needs). Indeed I did. But it looks like objtool actually does parse .fixup. What appears to go wrong is the 'visited' marker for backward jumps. If we've been there with AC=0 first, and then backjump with AC=1, things go missing. I've also now confused myself on how it branches from alternatives. It looks like it now considers paths that take the STAC alternative, and exit through the NOP alternative (which should be CLAC) and then hit RET with AC=1. I'll get this sorted, eventually..