Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4159619pxv; Mon, 19 Jul 2021 18:50:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPhyRw4/6mnYWSVDOpqMfmDy1fGeIuoZ/9qXlmkm4SLSF2nx/seeNdyaKePV9MOoAninOr X-Received: by 2002:a6b:e207:: with SMTP id z7mr15808985ioc.111.1626745809814; Mon, 19 Jul 2021 18:50:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626745809; cv=none; d=google.com; s=arc-20160816; b=PDVGQnlw+ZKob/XMozdtUjrPIOcnIwosNtWHw6DLRzbVa+S4z2oayfTGt+IyQiw3Cv dT+d6rnV6vJ2lPGMW8BIKhka5CD6jN6+q92BuF2evrMIwOoaUTUkqQfhoXyboaEA+7i2 Yp9+UDLUCFHi/+MbPxmvjGeaW92Qvu0Arb6JJ9AwQqgAzkaz3IYPjJ72o+tmG8a5HN8m jcZR8JfsHL99zORoT+taM+lYceSM84aF5FRZNp5Jz9M5vDR1+zhWP12OeHM6DsjjhVhM 7eifxfMAR4oxtKbUJ4mcEk+gGIPageOJl4gUitEXs1B9aKIdn03vBKHbcPtA6chcXjS6 FG/g== 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=ae/8iSM+51lUhycZBflzvNMWFxHzkzQHpuA5Mfz/UPQ=; b=B93UL8raJFqIkKcLrGkTKBekDuKoT0i98cxqWt5wCCrDAnX4D93UW7bXjRbr4boomq LgyW1y37KxuTmWUKFkaIxFBM1HPNMkJTj0SPr1cg6ZDBd8MpPGxc3DFmBgC8u7GaUGBn opZuGM1Lt1EqkgM2Yh0ttieps28yWcra2RnzIwWjpTm/p0gNpgDEroZ8k5Ii6kL1Jb/5 qlvKhraA9a9/B82mlQ2Kc0quA9YsvjI8Po9ygY8E+VXuE3QSbE1lHGAp+7yZQIgZ6hLj 2kQ7nRIciNNFWWk3Uh7ArAWVcKGFD5cyTReF9Vx2vsjvdW3LLPOWAho2nmLTVtiI6ftD Q3/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eHW2Ptal; 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 t7si22452122jam.62.2021.07.19.18.49.58; Mon, 19 Jul 2021 18:50:09 -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=eHW2Ptal; 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 S1345504AbhGSPLk (ORCPT + 99 others); Mon, 19 Jul 2021 11:11:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:41930 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344279AbhGSOso (ORCPT ); Mon, 19 Jul 2021 10:48:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A0DA061287; Mon, 19 Jul 2021 15:27:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626708463; bh=GUnLCwqGq+Q1BY2Di5mdFrrVM7TVqfE4gqATT0VHGZw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eHW2Ptaldz3rTUhmPrkIlC/HubOIh65Xd/oZ2vP3jDvsK7pUxC3JDtKI0KGC3YgQp i578stM/jFyfwaGDIdLzIg8+kDgATlxFoTBHtLoCFDQX6/LUwtvVyBk91nJ1KDIKVj MGxlPAY5VL/DVbLUxKBYe0goLRe4eD7HkywlrNMw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , Borislav Petkov , Andy Lutomirski , Sasha Levin Subject: [PATCH 4.14 295/315] x86/fpu: Limit xstate copy size in xstateregs_set() Date: Mon, 19 Jul 2021 16:53:04 +0200 Message-Id: <20210719144953.166987065@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210719144942.861561397@linuxfoundation.org> References: <20210719144942.861561397@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: Thomas Gleixner [ Upstream commit 07d6688b22e09be465652cf2da0da6bf86154df6 ] If the count argument is larger than the xstate size, this will happily copy beyond the end of xstate. Fixes: 91c3dba7dbc1 ("x86/fpu/xstate: Fix PTRACE frames for XSAVES") Signed-off-by: Thomas Gleixner Signed-off-by: Borislav Petkov Reviewed-by: Andy Lutomirski Reviewed-by: Borislav Petkov Link: https://lkml.kernel.org/r/20210623121452.120741557@linutronix.de Signed-off-by: Sasha Levin --- arch/x86/kernel/fpu/regset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/fpu/regset.c b/arch/x86/kernel/fpu/regset.c index bc02f5144b95..621d249ded0b 100644 --- a/arch/x86/kernel/fpu/regset.c +++ b/arch/x86/kernel/fpu/regset.c @@ -128,7 +128,7 @@ int xstateregs_set(struct task_struct *target, const struct user_regset *regset, /* * A whole standard-format XSAVE buffer is needed: */ - if ((pos != 0) || (count < fpu_user_xstate_size)) + if (pos != 0 || count != fpu_user_xstate_size) return -EFAULT; xsave = &fpu->state.xsave; -- 2.30.2