Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp4427220imc; Mon, 25 Feb 2019 04:54:05 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia1Z6wqmZ8vj100snkARAF7UR8AEBpnK4f6U1MVT/0fnuYbKNwi+aKXVwnrhpj8DisFq+VP X-Received: by 2002:a62:e204:: with SMTP id a4mr19198568pfi.225.1551099245706; Mon, 25 Feb 2019 04:54:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551099245; cv=none; d=google.com; s=arc-20160816; b=zkpQA1QCUPK89dgq0KPqebfSSG3IDmVwCc8Z5fXlwqUmq+EM/0tsWLK48nSYXCe1im 59KQOwWh6Tf/LIz+2meSudJyIAqPKwmdPwojpryN3TPsVHH+ub9n2UMWk9UlYo3Ap0Ai s8g0bxRMTBRXSH/ldkNpfxXnffjdlugVhZ6ijdDKCF4FKwANUYsYL86e8Kv5EA3zyqBf F1ZtLP2yx/XOG/v9ozoQYCwP6NgeiPo9swlDuAtL30uAB73do9izCBPWe5CweNgGvPxv O7hAH6UKMnlEotrIgKvUJYigc/H789bXBk4RKVDV6+f55PdouaOabs0OeBUosjzj/LYo jOvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:subject:cc:to :from:date:user-agent:message-id:dkim-signature; bh=PRswsRkkODz5hjbqO9yT9YXrBykXNq9Oiz0pisqRrqE=; b=KeefoOIeaARLx55IebmkG7mSkAMXoS4sbz9pNE4LDClbq8gKJKK8+iDj92tiHOfNCD dC9EvnKEodzjHv/JuTpPxgYcXlB8IJHyZnWqaSzJdkHqzOzL45vzi9/oMzrCv7b2NCNB LdD+cT30IXTTkVruxHRGh/f5rmanVE9lsTlIw2z0HmDup/3xcdRyCQg9kJfaUnX2Awex t5crU+mPkvULSFTplH4t7dcZuxm03nS5oxKhtXgVekxambWjNkZBgCSucESXdV3MW/MK qIj7Vk+CqLP7VShrFeg5Qm89rPmO3lRKCHveOGsg2F0xTW+nFwQ3UMC7o2Hhb0tgW2Pc ZNoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=ypnd8Pqm; 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 x14si9473202pgh.98.2019.02.25.04.53.50; Mon, 25 Feb 2019 04:54:05 -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=ypnd8Pqm; 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 S1727093AbfBYMxX (ORCPT + 99 others); Mon, 25 Feb 2019 07:53:23 -0500 Received: from merlin.infradead.org ([205.233.59.134]:39428 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727037AbfBYMxQ (ORCPT ); Mon, 25 Feb 2019 07:53:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-Id:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=PRswsRkkODz5hjbqO9yT9YXrBykXNq9Oiz0pisqRrqE=; b=ypnd8PqmTUB0pEdlbkhTldSQPz QtKQWSOzO+ugjmZE2/nuhT9CbU1+HXOG/F/sbrxKV4TO3ZgBQ2su0kiIdP5TDXe+RDOmuywnmkeNS FqOYLUejgo9epDbaKzkFFtwrcl6okQkQgtpYGF2LUGJrzbi8iqkBettJZz/vqWh+0lr5HC4aOnC6r 5CBVcBAV7KbZ+6E7Iz82OAx3WhtFelkAATgAcIOYFyo79Y+23p+WBKFOMxt2Knv8zdUlBLQOVIA9w 7pvCYNCyIxNuA6wIlO0VINyGfL4kSNlNRlGsotUfz4lYnk07TPR4V9Oep5yxTYKNQcXd3kCOvNSCJ MvSZOPSw==; 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 1gyFkm-0006MN-5B; Mon, 25 Feb 2019 12:53:04 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id 992F220277F83; Mon, 25 Feb 2019 13:53:02 +0100 (CET) Message-Id: <20190225125231.845656645@infradead.org> User-Agent: quilt/0.65 Date: Mon, 25 Feb 2019 13:43:31 +0100 From: Peter Zijlstra To: torvalds@linux-foundation.org, tglx@linutronix.de, hpa@zytor.com, julien.thierry@arm.com, will.deacon@arm.com, luto@amacapital.net, mingo@kernel.org, catalin.marinas@arm.com, james.morse@arm.com, valentin.schneider@arm.com, brgerst@gmail.com, jpoimboe@redhat.com, luto@kernel.org, bp@alien8.de, dvlasenk@redhat.com Cc: linux-kernel@vger.kernel.org, peterz@infradead.org Subject: [PATCH 1/6] x86/uaccess: Dont evaluate argument inside AC region References: <20190225124330.613028745@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org AC regions are special, make sure we don't do possibly complex evaluations there. Probably-Signed-off-by: Andy Lutomirski Signed-off-by: Peter Zijlstra (Intel) --- arch/x86/include/asm/uaccess.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/arch/x86/include/asm/uaccess.h +++ b/arch/x86/include/asm/uaccess.h @@ -431,8 +431,10 @@ do { \ ({ \ __label__ __pu_label; \ int __pu_err = -EFAULT; \ + __typeof__(*(ptr)) __pu_val; \ + __pu_val = x; \ __uaccess_begin(); \ - __put_user_size((x), (ptr), (size), __pu_label); \ + __put_user_size(__pu_val, (ptr), (size), __pu_label); \ __pu_err = 0; \ __pu_label: \ __uaccess_end(); \