lkml.org 
[lkml]   [2016]   [Apr]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 07/10] x86/xsaves: Fix PTRACE frames for XSAVES
On Fri, Apr 29, 2016 at 01:25:34PM -0700, Dave Hansen wrote:
> On 03/04/2016 10:12 AM, Yu-cheng Yu wrote:
> > + for (i = 0; i < XFEATURE_MAX; i++) {
> > + /*
> > + * Copy only in-use xstates.
> > + */
> > + if (((header.xfeatures >> i) & 1) && xfeature_enabled(i)) {
> > + void *src = get_xsave_addr_no_check(xsave, i);
>
> How could a bit in header.xfeatures get set if it is not set in
> xfeature_enabled() aka xfeatures_mask aka XCR0?

Do you mean, we should test xfeature_enabled(i) first, like,

if (xfeature_enabled(i) && ((header.xfeatures >> i) & 1)) ?

The result will be the same, like you said, if XCR0[i] is not set,
hader.xfeatures[i] cannot be set. But if XCR0[i] is set,
header.xfeatures[i] can be cleared.

>
> If a caller tries to pass a non-enabled xfeature in, we appear to just
> silently drop it and return success. Is that really what we want to do
> or do we want to error out?

Let it fail. I will chage it.

\
 
 \ /
  Last update: 2016-04-30 00:41    [W:0.142 / U:0.452 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site