From: Dave Hansen <dave.hansen@intel.com>
To: "Yao, Yuan" <yuan.yao@intel.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "Bae, Chang Seok" <chang.seok.bae@intel.com>,
"x86@kernel.org" <x86@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] x86/fpu: Remove dynamic features from xcomp_bv for init_fpstate
Date: Thu, 13 Oct 2022 11:04:34 -0700 [thread overview]
Message-ID: <16c5d292-f215-0b97-4c8f-18986ba2c15a@intel.com> (raw)
In-Reply-To: <BYAPR11MB3717EDEF2351C958F2C86EED95259@BYAPR11MB3717.namprd11.prod.outlook.com>
On 10/12/22 20:35, Yao, Yuan wrote:
> Below trace is observed on host kernel with this patch applied when create VM.
>
> The reason is __copy_xstate_to_uabi_buf() copies data from &init_fpstate when the component
> is not existed in the source kernel fpstate (here is the AMX tile component), but the
> AMX TILE bit is removed from init_fpstate due to this patch, so the WARN is triggered and return
> NULL which causes kernel NULL pointer dereference later.
>
> I considered 2 possible ways to fix this without big change:
> 1. For such non-exist component, we can fill the buffer in target fpstate to 0 and don't WARN if the bit is not set
> in init_fpstate.
> 2. Enlarge the init_fpstate to content the dynamic components and still keel fpu_kernel_cfg.max_features
> in init_fpstate (but still remove the dynamic bit from new cloned thread), so we can use it safely in above case,
> but near 2 pages (8K) is wasted.
There's a bigger problem here.
Removing the AMX bit from xstate_bv just *TELLS* the __raw_xsave_addr()
about the buffer being too small. Before this patch, __raw_xsave_addr()
was probably reading crap out of whatever is past 'init_fpstate' and
copying it out to userspace.
This mess makes me want a guard page after 'init_fpstate'.
Anyway, this isn't really a separate bug. It's just more nasty fallout
from xcomp_bv being wrong in the first place.
next prev parent reply other threads:[~2022-10-13 19:38 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-11 22:24 Dave Hansen
2022-10-11 22:47 ` Chang S. Bae
2022-10-13 1:33 ` Yao, Yuan
2022-10-13 1:47 ` Chang S. Bae
2022-10-13 3:35 ` Yao, Yuan
2022-10-13 16:23 ` Chang S. Bae
2022-10-13 17:21 ` Dave Hansen
2022-10-13 17:33 ` Chang S. Bae
2022-10-13 17:44 ` Dave Hansen
2022-10-14 3:53 ` Chang S. Bae
2022-10-14 4:10 ` Yao, Yuan
2022-10-14 4:26 ` Chang S. Bae
2022-10-14 4:03 ` Yao, Yuan
2022-10-13 18:04 ` Dave Hansen [this message]
2022-10-17 22:39 ` Chang S. Bae
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=16c5d292-f215-0b97-4c8f-18986ba2c15a@intel.com \
--to=dave.hansen@intel.com \
--cc=chang.seok.bae@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=yuan.yao@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®