From patchwork Tue Apr 5 07:30:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 557829 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C266C47094 for ; Tue, 5 Apr 2022 08:56:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231571AbiDEIxS (ORCPT ); Tue, 5 Apr 2022 04:53:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241117AbiDEIcv (ORCPT ); Tue, 5 Apr 2022 04:32:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30EA61582B; Tue, 5 Apr 2022 01:27:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D58FAB81B13; Tue, 5 Apr 2022 08:27:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AE09C385A2; Tue, 5 Apr 2022 08:27:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649147274; bh=5kDp6e7Af4lDs7gh7RHYJ0kx3NY8l0227+nMc47kasA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mk/Zc0hSGJDkmcJ871VaP2Q2gyiAH3JqyxbSnYdh+qtJs32DUa6hVp2Yh8Y0BWIF3 pg7kgkM9nAhVW25oVNQoR7Jpd53f0Q0DSsytSP96TLODf1QLsD3SzVffSRf0h+X3XS /zXWRTfuchVvktUNDdKaQWXxiHSfcuJDlkxNZkzU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yang Zhong , "Chang S. Bae" , Thomas Gleixner , Paolo Bonzini Subject: [PATCH 5.17 1065/1126] x86/fpu/xstate: Fix the ARCH_REQ_XCOMP_PERM implementation Date: Tue, 5 Apr 2022 09:30:12 +0200 Message-Id: <20220405070438.719098440@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070407.513532867@linuxfoundation.org> References: <20220405070407.513532867@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Yang Zhong commit 063452fd94d153d4eb38ad58f210f3d37a09cca4 upstream. ARCH_REQ_XCOMP_PERM is supposed to add the requested feature to the permission bitmap of thread_group_leader()->fpu. But the code overwrites the bitmap with the requested feature bit only rather than adding it. Fix the code to add the requested feature bit to the master bitmask. Fixes: db8268df0983 ("x86/arch_prctl: Add controls for dynamic XSTATE components") Signed-off-by: Yang Zhong Signed-off-by: Chang S. Bae Signed-off-by: Thomas Gleixner Cc: Paolo Bonzini Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220129173647.27981-2-chang.seok.bae@intel.com Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/fpu/xstate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/kernel/fpu/xstate.c +++ b/arch/x86/kernel/fpu/xstate.c @@ -1639,7 +1639,7 @@ static int __xstate_request_perm(u64 per perm = guest ? &fpu->guest_perm : &fpu->perm; /* Pairs with the READ_ONCE() in xstate_get_group_perm() */ - WRITE_ONCE(perm->__state_perm, requested); + WRITE_ONCE(perm->__state_perm, mask); /* Protected by sighand lock */ perm->__state_size = ksize; perm->__user_state_size = usize;