Received: by 10.223.176.5 with SMTP id f5csp714435wra; Fri, 9 Feb 2018 06:07:15 -0800 (PST) X-Google-Smtp-Source: AH8x226x60nOpvkvwN9fjMK0siR1rayQpsYTUF+HtjgSJ/2A8vlAOKIlFJSKBFxT2PeQajDzl0Zs X-Received: by 2002:a17:902:208:: with SMTP id 8-v6mr2712135plc.359.1518185234937; Fri, 09 Feb 2018 06:07:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518185234; cv=none; d=google.com; s=arc-20160816; b=jVvKZtpfLxgc1yCdJAUCGKBDrhgupTMG7Z07hNjMwfLRs5it1ACL0LAPJrKRApKtAf QdcD9wBUISbQMopEFwnTP7h3NB2DeOcgHDflprZgEBmbb0kRyADCKJcO4M1IC0OCU3zv cmRBvqplFl9S7H9XpSVpSiFyR/2ETzouofNCh6XkJEaceoxCgx9vdQ/EmJRNntAoiZdI CblKpidKupR6OS4jpw9ZmRu5gmLDptpwAvyO4OeEdmt6gDAuLmrBv1Faklm2vACVZJeC B9s78+WBVlV5m3LmedtMEBgyW1ghSDxBFttw3BULF4UjRykyB2UGs6CGc2HyuA+WYIhZ EWQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=GzHCwOGol16E7FqMYrR1t5H6EblQ5WlxBNzWDdae2+Q=; b=GmXQxCabtKNWRk58JWggO9N9oACF0m+iKqFWOtHWgc4mcXgtOnUockcnxvvcOQxqzb lx+gd0+xvqvByW+ZwdNS6rUbjQ/+1cqQfyOVei3Og/e/DSVa6VdPC+FwU8AezWpN/zfj Ef0Fb4O7qRoi93vYRqo6cJV9hSHASp/c1ePGEYGgXYsiCyOJ8WdUolL1/LVZn1TdgRcb dfYV08rTuH4KZtsUDeOcNuKMh2c1xAgJRYU5B6nRpS4tO0fTy7iwZYOzBllQSJSrdG7Z vV0cid1KlMz2sXTlCF3d+rv3dHGfK2nBV/2AtP6ekwDCzXQ15gj8pbinO1BOivMSuZBE 1GgA== ARC-Authentication-Results: i=1; mx.google.com; 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 o61-v6si1567845pld.259.2018.02.09.06.07.00; Fri, 09 Feb 2018 06:07:14 -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; 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 S1753327AbeBIOFU (ORCPT + 99 others); Fri, 9 Feb 2018 09:05:20 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:50142 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753159AbeBINnC (ORCPT ); Fri, 9 Feb 2018 08:43:02 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 7FEE9FB6; Fri, 9 Feb 2018 13:43:01 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ingo Molnar , Dan Williams , Thomas Gleixner , linux-arch@vger.kernel.org, Tom Lendacky , Kees Cook , kernel-hardening@lists.openwall.com, Al Viro , torvalds@linux-foundation.org, alan@linux.intel.com, David Woodhouse Subject: [PATCH 4.9 61/92] x86/usercopy: Replace open coded stac/clac with __uaccess_{begin, end} Date: Fri, 9 Feb 2018 14:39:30 +0100 Message-Id: <20180209133935.649625001@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180209133931.211869118@linuxfoundation.org> References: <20180209133931.211869118@linuxfoundation.org> User-Agent: quilt/0.65 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 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Williams (cherry picked from commit b5c4ae4f35325d520b230bab6eb3310613b72ac1) In preparation for converting some __uaccess_begin() instances to __uacess_begin_nospec(), make sure all 'from user' uaccess paths are using the _begin(), _end() helpers rather than open-coded stac() and clac(). No functional changes. Suggested-by: Ingo Molnar Signed-off-by: Dan Williams Signed-off-by: Thomas Gleixner Cc: linux-arch@vger.kernel.org Cc: Tom Lendacky Cc: Kees Cook Cc: kernel-hardening@lists.openwall.com Cc: gregkh@linuxfoundation.org Cc: Al Viro Cc: torvalds@linux-foundation.org Cc: alan@linux.intel.com Link: https://lkml.kernel.org/r/151727416438.33451.17309465232057176966.stgit@dwillia2-desk3.amr.corp.intel.com Signed-off-by: David Woodhouse Signed-off-by: Greg Kroah-Hartman --- arch/x86/lib/usercopy_32.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/arch/x86/lib/usercopy_32.c +++ b/arch/x86/lib/usercopy_32.c @@ -570,12 +570,12 @@ do { \ unsigned long __copy_to_user_ll(void __user *to, const void *from, unsigned long n) { - stac(); + __uaccess_begin(); if (movsl_is_ok(to, from, n)) __copy_user(to, from, n); else n = __copy_user_intel(to, from, n); - clac(); + __uaccess_end(); return n; } EXPORT_SYMBOL(__copy_to_user_ll); @@ -627,7 +627,7 @@ EXPORT_SYMBOL(__copy_from_user_ll_nocach unsigned long __copy_from_user_ll_nocache_nozero(void *to, const void __user *from, unsigned long n) { - stac(); + __uaccess_begin(); #ifdef CONFIG_X86_INTEL_USERCOPY if (n > 64 && static_cpu_has(X86_FEATURE_XMM2)) n = __copy_user_intel_nocache(to, from, n); @@ -636,7 +636,7 @@ unsigned long __copy_from_user_ll_nocach #else __copy_user(to, from, n); #endif - clac(); + __uaccess_end(); return n; } EXPORT_SYMBOL(__copy_from_user_ll_nocache_nozero);