Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp358896imb; Fri, 1 Mar 2019 02:36:39 -0800 (PST) X-Google-Smtp-Source: APXvYqx/yAi3LG/+9YWw39SZ/hvr8DMKnVKoyd9JRqxVAjjvm3PFueIflW3ctuXH0sdLj5Xo8mOe X-Received: by 2002:a63:d54f:: with SMTP id v15mr4164927pgi.318.1551436599858; Fri, 01 Mar 2019 02:36:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551436599; cv=none; d=google.com; s=arc-20160816; b=Bm/dI0fag6HzMJEgnL9QnI75haTqRS3dvn6dLUjCKl136bZ2df/Y29dA7agbwYP1yL cYI1qZwhx8mnM8vrL3hVoZ0YtzgknoU57lMOa038sCuYF7vTbOEzz2gU2glaaNHZNM8R QQbu8YBWvEBY6Yv+D0Dqmf18yBJLSnuhwBgDvG5XQv/8RIYNXobJCI0KS+FgHwuPLOyd 5/f3orbfkmOsf2lJ3YrXgmX7DRcu3RkMSyxdOrv57dpmnidvT2yFvdgqx3U2UHrRFjCO y4lOABy8Pqr5DEoYNU5jA2OONEnSOwJRdx87qQNdp7gY2gWx1wkCvpNcDlfaxz9aaQ3N 6HGA== 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=3Rw/cbOesAa6oP4mwjsqfUjsIumr/hIqFPOBQRbLEiI=; b=X/E1eMUaGVOZ/ZzWUxswI+lm5ZXu3wyHSqL997inWbRjD0tEnnxMZq7Dz3Pjr/Jr8B b9nq0qZXzwfRi/BFzvWX0qGHlRFtxdT3umy3nAZZMey9lR/G6dV1P7ID2e8KTzAnJDQs Toqxu38OsS5bg+7ulbBUx6BGqDfabqMG1JKHYHlOMqeCdkNVMoOAtYfq7qyRVibTAKkc qVioFJKe/7YikAjWC1SlcYvlviHm/S9JvEmc76JxZhBbLNWzSelaLG8X+d3PEQaKNtPc ilPqLaA76h26Qlm8//rCZvhRfhkYB50Luz2sCMEs/VR+ec0bXqnxbx3AX7Y0OBPk9n8L 5opw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=LkTOTtHf; 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 l192si19640912pge.280.2019.03.01.02.36.24; Fri, 01 Mar 2019 02:36:39 -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=merlin.20170209 header.b=LkTOTtHf; 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 S1728665AbfCAKfP (ORCPT + 99 others); Fri, 1 Mar 2019 05:35:15 -0500 Received: from merlin.infradead.org ([205.233.59.134]:55330 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725978AbfCAKfP (ORCPT ); Fri, 1 Mar 2019 05:35:15 -0500 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: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=3Rw/cbOesAa6oP4mwjsqfUjsIumr/hIqFPOBQRbLEiI=; b=LkTOTtHf3ETbZTHtnCwJPu5UW P+aDKWWdo/Agg0PyfuQq/SFuM2kI7oLn0Ca3KWk2bkg1o1fyPFKNkGwC6pZ9QIHSLqTF4YLibjGTJ fNEFEAKai8eCKC+hzs317YOwJQ+DZp9yT0r3lagendJnyfI5v19fPpd4/Z6A2/1NjfB1C/zito8ag JZpc8Xuil1YY0gNukSKWF7NAovgWoH9UcteVqAtBBa5z+wrHRIdF4bfHTtHle5y10fRixDhTPRwIT X1kmhyLe7eX9qAL9axJnk8PmohRgORvap/Y44cPWWJL9JzVjGwiFrleLj2rxQjwFdTs5SJ71lm6gF aGaDqRF4g==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzfVI-0006Uh-Ag; Fri, 01 Mar 2019 10:34:56 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id A53562025BA4C; Fri, 1 Mar 2019 11:34:52 +0100 (CET) Date: Fri, 1 Mar 2019 11:34:52 +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: <20190301103452.GQ32534@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> <20190228190111.GI32494@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190228190111.GI32494@hirez.programming.kicks-ass.net> 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 08:01:11PM +0100, Peter Zijlstra wrote: > 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.. Ha! Original file: CC drivers/gpu/drm/i915/i915_gem_execbuffer.o drivers/gpu/drm/i915/i915_gem_execbuffer.o: warning: objtool: .altinstr_replacement+0x3c: redundant UACCESS disable drivers/gpu/drm/i915/i915_gem_execbuffer.o: warning: objtool: .altinstr_replacement+0x66: redundant UACCESS disable With the dodgy patch: CC drivers/gpu/drm/i915/i915_gem_execbuffer.o drivers/gpu/drm/i915/i915_gem_execbuffer.o: warning: objtool: eb_relocate_slow()+0x1f9: call to kvfree() with UACCESS enabled drivers/gpu/drm/i915/i915_gem_execbuffer.o: warning: objtool: i915_gem_execbuffer2_ioctl()+0x315: call to kvfree() with UACCESS enabled Let me do an allmodconfig build to see how much pain is caused by that redundant CLAC warning.