Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3029767pxb; Mon, 18 Oct 2021 06:56:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAyElIic6jjHSdxYDTfwR3uTjNfVjCbbmJqaRZ+wHlf5iY30G4f2RpmKEjIm8Bzw5aSt5c X-Received: by 2002:a17:90a:c688:: with SMTP id n8mr46909573pjt.131.1634565416983; Mon, 18 Oct 2021 06:56:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634565416; cv=none; d=google.com; s=arc-20160816; b=LkNDLC9Fx7Ziu6F+aEwoI2aiQvncufhgq0Dt27UHlY0FfwgXnWQigekaUn88Fgpvhg sK/XNJ2/1g6Ebv+d/w3FGZX5ybrWPT5WVSgvKo12G7nvkhKeQ7Pn5ReKfq1Ap6SPZoQy /yvgAomUg92WaGz7aei8O44pWiX6GjoB8ZJwuntR99b9VM0epGVhpb7fzAkmVC3j8/vl JTDggL7pngkn3SkeWxTV6Y+iiyggYJXGhJSpfq7mqhDLMLLFDn9yVoj3pDfyDWov6GJJ Ikulf/jmZU31JnPLqP0/5N1kWe82vW1q6fKy3LUOf5qGWxf2k0GfeTKtjIwFHpktgKBk bX4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VtloGq+rsN/w7Nb/meZgfWe5cBAcBgjHYmI7UbxQHVc=; b=A8/+6MLYtE5ODRQ/ApgNI/8NnrpjHoQV0nH69fILQKlshVKnke0KuyMhBzc5aXWfjb Owock7/zQBFYiK1RbJUaVjIjy8HR8yZCHMWLcENuYmNH86HvcGMZoTfWdGJXyCwj6JMw vrmLPRCus2P1SQNtuXYSvbFCptGylIZmocqCqwxz+VI/iSaWth+A4yGNld/8yDkvxhPI wDJwUl8WlMPjMNVUtVTNghpQ9ryI3mDRSmVB1fu3uobug1lBnYr6G+pBWCYQFyBO8Pfm mI3GlTsbKdkjpKZ9Ah58a/JlihHPzUOUReenp7G0TdWMJ5Ag7fnOznOhYG3D/R1i88H5 HDwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VjlDNaCt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i2si1594415plr.41.2021.10.18.06.56.42; Mon, 18 Oct 2021 06:56:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VjlDNaCt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233285AbhJRN4Q (ORCPT + 99 others); Mon, 18 Oct 2021 09:56:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:56110 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234487AbhJRNx5 (ORCPT ); Mon, 18 Oct 2021 09:53:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id ED291619F8; Mon, 18 Oct 2021 13:39:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634564369; bh=dzqWgEgr5HFi1i3QRGceWJ6s6UTKBiP3TXHj47l8gXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VjlDNaCtVOclaOKVKebAk9MjyYTctU41a3Y74Rb89wSVBwHZNAPn9q/NvoVTQa0d/ 9jYS51PEq4lQAU5qTM4LygjEtzwOHzdWZDnrHWkXqA7L2al2K49Ejl4ndlo08nDYYI 6hRXhbt7pynCCWVtgZ8J46x8nDuK2E5az9KGLJ5g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Borislav Petkov , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Ser Olmy Subject: [PATCH 5.14 062/151] x86/fpu: Mask out the invalid MXCSR bits properly Date: Mon, 18 Oct 2021 15:24:01 +0200 Message-Id: <20211018132342.713052446@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211018132340.682786018@linuxfoundation.org> References: <20211018132340.682786018@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Borislav Petkov commit b2381acd3fd9bacd2c63f53b2c610c89959b31cc upstream. This is a fix for the fix (yeah, /facepalm). The correct mask to use is not the negation of the MXCSR_MASK but the actual mask which contains the supported bits in the MXCSR register. Reported and debugged by Ville Syrjälä Fixes: d298b03506d3 ("x86/fpu: Restore the masking out of reserved MXCSR bits") Signed-off-by: Borislav Petkov Tested-by: Ville Syrjälä Tested-by: Ser Olmy Cc: Link: https://lore.kernel.org/r/YWgYIYXLriayyezv@intel.com Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/fpu/signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/kernel/fpu/signal.c +++ b/arch/x86/kernel/fpu/signal.c @@ -385,7 +385,7 @@ static int __fpu_restore_sig(void __user return -EINVAL; } else { /* Mask invalid bits out for historical reasons (broken hardware). */ - fpu->state.fxsave.mxcsr &= ~mxcsr_feature_mask; + fpu->state.fxsave.mxcsr &= mxcsr_feature_mask; } /* Enforce XFEATURE_MASK_FPSSE when XSAVE is enabled */