Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp517203imb; Fri, 1 Mar 2019 06:53:50 -0800 (PST) X-Google-Smtp-Source: APXvYqwU4SerVccfzmLLWmFRexMjA7B2OI65ftqyCkt0uzmdMhtIpET7uxHIgSqcIysl99fZxGGi X-Received: by 2002:a63:4607:: with SMTP id t7mr5137850pga.306.1551452029991; Fri, 01 Mar 2019 06:53:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551452029; cv=none; d=google.com; s=arc-20160816; b=JlCT1QSYFPO0Wy8rotoXehyGI+RTCYlU9LGMdaVqrfylqGcJoNX6MhRyF98iSPEh70 kc/P31PpQs5emdwfpmk/thZBkzZl8y+tOFkY+vv5VB23bcz7FeYA+9thXqY9SE5+Xsh8 4gVLB5FFMZU0ncUVGNCpXC2EDLhyMLaL2bPo/iH4E2Oh7y/pGwE8s8wszLzUya8bSpz2 Rc6B8xckfIzezRmWhOkBsCbTR8anZPSYeCkooyfqRJm2zOEqM6Albr86/TfVa0KfTGtZ pPUHcexVLIgYJwMQs1+my2IxQ4Me1Y9Iwkut6fjhFY0iRkg5krE3ensMZYIQFwodE+bD 3pVg== 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=D20FS/b3C+Uzm8zEFff2tzX0CzvSgkdyaf9/2GVvBys=; b=fzI9i2RwDIGITAOivVqi3/0y4/anoO10MZxCvCj3yBsVWhxETEe16+SMRqHMp5wlmr GIF6C343tdGowC+LCBfDmzrNxwf73XPXIre7r3PhwGWRpMzoOHCIo2aAtkMDBK7T8hew /4rjOnCaTIzPdePhXyqcsc79o4oGLLEX2REC9W2vjEqZLnlo/IVOqy2LeczY6Q/4IF+u lwa/ktM/VDv7HbDYDHMCd73ZFbtrMiZC6PTORnLwrfCqhxeMskiwWmn2TzOnNgRaGxiO jq++pT8RGgGsXeOtZgctPnzzSKQIITkShIoe1OfUl6Cr0zVqekrK8Y7KaIH7nb11BbrM VNAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=btq4ZZXH; 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 c136si14466275pfb.89.2019.03.01.06.53.34; Fri, 01 Mar 2019 06:53:49 -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=btq4ZZXH; 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 S2388714AbfCAOiV (ORCPT + 99 others); Fri, 1 Mar 2019 09:38:21 -0500 Received: from merlin.infradead.org ([205.233.59.134]:57054 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728357AbfCAOiU (ORCPT ); Fri, 1 Mar 2019 09:38:20 -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=D20FS/b3C+Uzm8zEFff2tzX0CzvSgkdyaf9/2GVvBys=; b=btq4ZZXHkJ41xA7TUZ3ii55LR S6VqS3rmxwXXcjW58IAaWPomDiCVk6nTKEVEp28XJ9dcrx9SOfXqwbBu2gr3HbR2+5Q0zL1TQMh2N oKP3uVTrHLnPAxf1IAP8OazXFH7/5DOZdl/CxP2Gnz9dEx6OG6g76Kg1jBe0Tb/AUxaK610uQ1yzG BOcC6O77mtPf6/n4OfL26lEdTvyS/uJnAG22LdoK4ieca3ZZm9RLjD8SYlwG7FcfYamWRp5FvLfwP F/olqGHu+akZqSty5F9gtXVosOU/2qfx3q6yTs8u6zAJQUuUmnPyKm8e06VWphyh0eCZf8s1I6Q1R d9kln29Qg==; 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 1gzjIY-0000E3-9a; Fri, 01 Mar 2019 14:38:02 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id F414F29AAFFEA; Fri, 1 Mar 2019 15:38:00 +0100 (CET) Date: Fri, 1 Mar 2019 15:38:00 +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: <20190301143800.GT32534@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> <20190301103452.GQ32534@hirez.programming.kicks-ass.net> <20190301122745.GR32534@hirez.programming.kicks-ass.net> <20190301125718.GS32534@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190301125718.GS32534@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 Fri, Mar 01, 2019 at 01:57:18PM +0100, Peter Zijlstra wrote: > On Fri, Mar 01, 2019 at 01:27:45PM +0100, Peter Zijlstra wrote: > > arch/x86/lib/usercopy_64.o: warning: objtool: .altinstr_replacement+0x30: redundant UACCESS disable > > > The usercopy one is difficult, that's copy_user_handle_tail(), it is > > buggered though, because that lacks notrace and thus has a __fentry__ > > call in. > > > > Also, afaict all exception jumps into copy_user_handle_tail() will have > > AC=1, but the __{get,put}_user_nocheck() things do STAC/CLAC all over > > again. > > > > So what do we do? Annotate that we start with AC=1 and then immediately > > do the clac, and then let __{get,put}_user_nocheck() do their own thing? > > or make it use the unsafe stuff? > > Or.. we move the thing to assembly. Of course, I suck at (writing) asm, > so the below is probably broken in various ways. The advantage is that it now all lives in the same .o file and objtool can actually follow and find the complete control flow. I've made it ENDPROC() such that it becomes STT_FUNC and objtool does all the normal things. I've also moved the ALIGN_DESTINATION macro into the .S file. Andy, do we have a sensible self-test for this path?