Messages in this thread | | | Subject | Re: [PATCH 08/10] x86/xsaves: Fix PTRACE frames for XSAVES | From | Dave Hansen <> | Date | Mon, 22 Feb 2016 14:53:02 -0800 |
| |
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.
| |