[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <06f44447-54eb-4644-a905-349cfc82f602@linux.intel.com>
Date: Mon, 18 Jun 2018 10:43:37 -0700
From: Dave Hansen <dave.hansen@...ux.intel.com>
To: Keno Fischer <keno@...iacomputing.com>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>, Borislav Petkov <bp@...e.de>,
Andi Kleen <andi@...stfloor.org>,
Paolo Bonzini <pbonzini@...hat.com>,
Radim Krčmář <rkrcmar@...hat.com>,
Kyle Huey <khuey@...ehuey.com>,
Robert O'Callahan <robert@...llahan.org>
Subject: Re: [RFC PATCH] x86/arch_prctl: Add ARCH_SET_XCR0 to mask XCR0
per-thread
On 06/18/2018 07:42 AM, Keno Fischer wrote:
>> But, in any case, so how is this supposed to work?
>>
>> // get features we are disabling into values matching the
>> // hardware "init state".
>> __asm__("XRSTOR %reg1,%reg2", ...);
>> prctl(PRCTL_SET_XCR0, something);
>>
>> ?
> I was primarily thinking of the ptracer use case,
>
> ptrace(PTRACE_SETFPXREGS, <recorded regs>)
> <inject arch_prctl using ptrace>
>
> in which case there isn't a problem, because the unrecorded regs
> should be in the initial state.
So, to be useful, this interface needs to be called before an
application can run XGETBV or XSAVE for the first time and caches a
"bad" value. I think that means that it might not be feasible to use
outside of cases where you ptrace() something and inject things before
it has a chance to run any real instructions.
Fundamentally, I think that makes _this_ interface pretty useless in
practice. The only practical option is to have a _future_ XCR0 value
set by the prctl() and then have it get made active by the kernel at
execve().
IMNHO, if you haven't guessed yet, I think this whole exercise is a dead
end. Just boot an identical XCR0 VM on your new hardware and do replay
there. Done.
Powered by blists - more mailing lists