Received: by 10.223.185.116 with SMTP id b49csp6389924wrg; Wed, 28 Feb 2018 08:37:24 -0800 (PST) X-Google-Smtp-Source: AH8x227IGh1u/pVYqwgP7RtBZb0Gh8hYjUEVmG82pmHa4qYmSb+UhyuVAdK25XDh5+wwG+Yjhg2e X-Received: by 2002:a17:902:34f:: with SMTP id 73-v6mr18032419pld.55.1519835844310; Wed, 28 Feb 2018 08:37:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519835844; cv=none; d=google.com; s=arc-20160816; b=fZUkfSdrRN0FYXVzvAmVS/8dBN/NF5f8Jl6T6TNoZxAic2aLhlcxnntZtG4aaE1IHc +fD+gqXYAa+m0ZfIj/J9SOfQpW4oUyRQIBnjQRIMSRQep4oI1NvWuFMlf1oag4a4rNG5 Vm7Nw9WqhC4+g09GJ60ZKq4BHr7Uc0uBpF8nrUPChRrA3Fh+mBIzdA4qMTN1rKRU6Gnu +cdvPYBx3aH/zZ8ZNyYShBppmuLASq6xxF72cA8mBpRN0qL7P+M3bIYR7WMiZOdC9VGe KITrbgpgm8eR0bTaYYoaqLlh0e2SK6DHTionl2JzORCXuIBH6kiZrP8QeQyIckYTFfLz fokw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=fXE6QcMBwJmfaaTpeEsrsoGPnO9ScnOF/SgUqMe4i1Q=; b=mF/IrdaIlomDBem2bZ28Nb5TTRzYstFRYCfgOm0qlPcq3Ni0lemmOcF9dVOqymQG/P x+zWeNALwFqOElCCWJp806T19gGUEm8hHPHEF6dE3PbtnilQDtQRhf0PMz8jKbl+owX2 H81BeF5V/p6WEwdqtzTD2G1L3lDko8ca3kbznHvSzspNVGsbR80tDddxAFpNKBPMzVxA f10XJ9iRXUIbxgrCG1v5PGEV1SXnsCFFRlLp8T1vq2Gm3Z/xMNs+407GngWcoOxIoUEY VIYNwhntX/gDsGJeb7flQLw9feKVUwyZGsbG5enqbuIUFcUS1+kcfXZWS+n0RTN49ECm E87w== 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 70-v6si1521643ple.147.2018.02.28.08.37.09; Wed, 28 Feb 2018 08:37:24 -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 S933649AbeB1Qge (ORCPT + 99 others); Wed, 28 Feb 2018 11:36:34 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:34847 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932842AbeB1QEt (ORCPT ); Wed, 28 Feb 2018 11:04:49 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1er3Yt-0006Xh-HI; Wed, 28 Feb 2018 15:22:31 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Yg-0008W5-4U; Wed, 28 Feb 2018 15:22:18 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Ralf Baechle" , "Paul Burton" , linux-mips@linux-mips.org, "James Hogan" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 095/254] MIPS: lose_fpu(): Disable FPU when MSA enabled In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.55-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: James Hogan commit acaf6a97d623af123314c2f8ce4cf7254f6b2fc1 upstream. The lose_fpu() function only disables the FPU in CP0_Status.CU1 if the FPU is in use and MSA isn't enabled. This isn't necessarily a problem because KSTK_STATUS(current), the version of CP0_Status stored on the kernel stack on entry from user mode, does always get updated and gets restored when returning to user mode, but I don't think it was intended, and it is inconsistent with the case of only the FPU being in use. Sometimes leaving the FPU enabled may also mask kernel bugs where FPU operations are executed when the FPU might not be enabled. So lets disable the FPU in the MSA case too. Fixes: 33c771ba5c5d ("MIPS: save/disable MSA in lose_fpu") Signed-off-by: James Hogan Cc: Ralf Baechle Cc: Paul Burton Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/9323/ Signed-off-by: Ralf Baechle Signed-off-by: Ben Hutchings --- arch/mips/include/asm/fpu.h | 1 + 1 file changed, 1 insertion(+) --- a/arch/mips/include/asm/fpu.h +++ b/arch/mips/include/asm/fpu.h @@ -150,6 +150,7 @@ static inline void lose_fpu(int save) } disable_msa(); clear_thread_flag(TIF_USEDMSA); + __disable_fpu(); } else if (is_fpu_owner()) { if (save) _save_fp(current);