[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <56CB914E.3040406@linux.intel.com>
Date: Mon, 22 Feb 2016 14:53:02 -0800
From: Dave Hansen <dave.hansen@...ux.intel.com>
To: Andy Lutomirski <luto@...capital.net>,
Yu-cheng Yu <yu-cheng.yu@...el.com>
Cc: X86 ML <x86@...nel.org>, "H. Peter Anvin" <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Andy Lutomirski <luto@...nel.org>,
Borislav Petkov <bp@...e.de>,
Sai Praneeth Prakhya <sai.praneeth.prakhya@...el.com>,
"Ravi V. Shankar" <ravi.v.shankar@...el.com>,
Fenghua Yu <fenghua.yu@...el.com>
Subject: Re: [PATCH 08/10] x86/xsaves: Fix PTRACE frames for XSAVES
On 02/22/2016 02:45 PM, Andy Lutomirski wrote:
>> +/*
>> > + * Convert from kernel XSAVES compacted format to standard format and copy
>> > + * to a ptrace buffer. It supports partial copy but pos always starts from
>> > + * zero. This is called from xstateregs_get() and there we check the cpu
>> > + * has XSAVES.
>> > + */
>> > +int copyout_from_xsaves(unsigned int pos, unsigned int count, void *kbuf,
>> > + void __user *ubuf, const struct xregs_state *xsave)
> Now that you've written this code, can it be shared with the signal
> handling code?
It could be. But the signal handler code has the advantage of already
having the data in the registers since it's running on its *own* FPU
state, so it can just call XSAVE(S) directly.
This ptrace code *could* do a kernel_fpu_begin(), XRSTOR the user buffer
into the registers, XRSTOR the ptracee's system state in to the
registers, then XSAVES the whole thing to the kernel buffer, then
kernel_fpu_end().
Or, we could remove the signal handler's ability to XSAVE directly to
userspace. But it already *had* that and we know it works.
Powered by blists - more mailing lists