From patchwork Thu Jan 10 17:51:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Long X-Patchwork-Id: 155251 Delivered-To: patches@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2176131jaa; Thu, 10 Jan 2019 09:52:03 -0800 (PST) X-Received: by 2002:ac8:3ae5:: with SMTP id x92mr10937298qte.370.1547142723070; Thu, 10 Jan 2019 09:52:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547142723; cv=none; d=google.com; s=arc-20160816; b=m05rAgbhViV1hnjmTg5N+273MvoQVLMKjENnIM8ohg+LIj94q5I3UW0580vkYBBugy WnJhoYHrDxVt6MasCWPHz6sZTYsmnRZCsYxFTVnBvTKlj4gUlzOIsFvTQC/JXQYpOIEw bJwyUU5iu88+VjJ+zlP1dnO5E5njBTxvjmDGjUK6gm5FVqULRiFkD4zmPWsLwFVKqUSZ eOPyzVe0NRzaTsyQcU23mUz4RUrhRHTBaQNWq6v55KmN3+Q2u7/RG7qC/20zIf8w7R7P 6IoKAdz05zSkshqfcBC2twaSRkfiKGKYSoLMfzChS9MbZSnkoVxjyRZw+MO6WDaudBp6 Lf/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GrDWcqvz4w1IZM4bLnbt43ZL+fuuyvY4dihBlBpjGL0=; b=Wm3kmpHCnVNqQwFNXbmGk2/DSHdmShvRtkl+8DC2407h31JbpAbdDzBuDmPEBZoktD pzavkmPezaBYEzX5lvpkoAPPNXOY9Znxm7qJ3f+gU3xxYQaZJgNxbNvUaQ1qoBv32gJX 2Gk9NxU3qYUBnt7ngg3+0Mj+RIu72PNB2jciSSSp4Vk5o+C5o2RPJgGr/NDqF8VGjyiQ Qb/QZXTqtZCk1IdelXOsPPEWdYGGxcSy5QboVCjiQWQhfWWnbfKoJ2kL+86V+PsS4hb+ keYs8RECTyX5zf86tCNxzGZtsXkfzMdRM/Vgz+q79TBDjDfhFZZqo4cIW2HUeVAVycwP 4y5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V7CT7YZV; spf=pass (google.com: domain of dave.long@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=dave.long@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id m34sor71819247qtc.65.2019.01.10.09.52.03 for (Google Transport Security); Thu, 10 Jan 2019 09:52:03 -0800 (PST) Received-SPF: pass (google.com: domain of dave.long@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V7CT7YZV; spf=pass (google.com: domain of dave.long@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=dave.long@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GrDWcqvz4w1IZM4bLnbt43ZL+fuuyvY4dihBlBpjGL0=; b=V7CT7YZVqJwT7KawAlSte1rU4wkBeTBI45PKWaYqng+i+5CJnWwFUqTCq6Re/emZoA Hq3thIUPjwiW+cyQT+XIJ6PLVPfBJAOyWntt0ANyEkS+jm72EuGjCGySpyH5iDVsYPyJ A1kClvbOhApBH485aAhAcGJDxZeaiFIYoRHJY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GrDWcqvz4w1IZM4bLnbt43ZL+fuuyvY4dihBlBpjGL0=; b=MSK/W8CTtxT+fpb+H7hjQwCWlTmMi5Qv3drzHcLoxZ0nvvcpMUPHrMo8PQyHFLXSEo j4zCTf2eEvGFYVN+HByF+oCh6PekXbb0nxMbSdMH5ro2bnu98Mu1tSlW5CI2avBaFCwa j13ksP3rif0zasaGFQGHTAjuCmHL+6gACX7mQG4qIQFxB6wugDzXtcajiF/L3TCvIDSL vnqDLpFbsZ7UnC6D5tIyaK/ZjwdDMlW25kXbTPrWRIBUwrJRjZ7HTVTc+DWoqcBPoX+F 9c3uLUTu+T1ZBNRhL/d8rungZH2dG1JCMei7DWZH5ghGTZ9O+cjIBAlHT2whTjxwds91 iSzA== X-Gm-Message-State: AJcUukf3hvqtpzzfkgcsbi70svzFCfXamDp4LGdODyihIv4f85u9QnAc 9znSxNle2g/BdmV8j6z3OAMZZ4oo X-Google-Smtp-Source: ALg8bN6+iw0fnRKxN9HLxu4TQyua5G2QNN647vrgOU7B6RWgK2LXomJOGSMRJczeD4Szvhy2O6vbIA== X-Received: by 2002:ac8:2281:: with SMTP id f1mr10541942qta.197.1547142722843; Thu, 10 Jan 2019 09:52:02 -0800 (PST) Return-Path: Received: from localhost.localdomain (pool-72-71-243-63.cncdnh.fast00.myfairpoint.net. [72.71.243.63]) by smtp.googlemail.com with ESMTPSA id b8sm41815904qka.79.2019.01.10.09.52.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Jan 2019 09:52:01 -0800 (PST) From: David Long To: stable@vger.kernel.org, Russell King - ARM Linux , Florian Fainelli , Julien Thierry , Tony Lindgren , Marc Zyngier , Mark Rutland Cc: Greg KH , Mark Brown Subject: [PATCH 4.14 07/17] ARM: 8795/1: spectre-v1.1: use put_user() for __put_user() Date: Thu, 10 Jan 2019 12:51:40 -0500 Message-Id: <20190110175150.5239-8-dave.long@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190110175150.5239-1-dave.long@linaro.org> References: <20190110175150.5239-1-dave.long@linaro.org> From: Julien Thierry Commit e3aa6243434fd9a82e84bb79ab1abd14f2d9a5a7 upstream. When Spectre mitigation is required, __put_user() needs to include check_uaccess. This is already the case for put_user(), so just make __put_user() an alias of put_user(). Signed-off-by: Julien Thierry Signed-off-by: Russell King Signed-off-by: David A. Long --- arch/arm/include/asm/uaccess.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) -- 2.17.1 diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h index 7d19584f5c39..cf50b030c62c 100644 --- a/arch/arm/include/asm/uaccess.h +++ b/arch/arm/include/asm/uaccess.h @@ -370,6 +370,14 @@ do { \ __pu_err; \ }) +#ifdef CONFIG_CPU_SPECTRE +/* + * When mitigating Spectre variant 1.1, all accessors need to include + * verification of the address space. + */ +#define __put_user(x, ptr) put_user(x, ptr) + +#else #define __put_user(x, ptr) \ ({ \ long __pu_err = 0; \ @@ -377,12 +385,6 @@ do { \ __pu_err; \ }) -#define __put_user_error(x, ptr, err) \ -({ \ - __put_user_switch((x), (ptr), (err), __put_user_nocheck); \ - (void) 0; \ -}) - #define __put_user_nocheck(x, __pu_ptr, __err, __size) \ do { \ unsigned long __pu_addr = (unsigned long)__pu_ptr; \ @@ -462,6 +464,7 @@ do { \ : "r" (x), "i" (-EFAULT) \ : "cc") +#endif /* !CONFIG_CPU_SPECTRE */ #ifdef CONFIG_MMU extern unsigned long __must_check