Re: [PATCH v4 07/10] x86/xsaves: Fix PTRACE frames for XSAVES

2016-04-29 Thread Yu-cheng Yu
On Fri, Apr 29, 2016 at 03:36:12PM -0700, Dave Hansen wrote: > On 04/29/2016 03:30 PM, Yu-cheng Yu wrote: > > 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++) { > >>> + /* > >>> +

Re: [PATCH v4 07/10] x86/xsaves: Fix PTRACE frames for XSAVES

2016-04-29 Thread Dave Hansen
On 04/29/2016 03:30 PM, Yu-cheng Yu wrote: > 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

Re: [PATCH v4 07/10] x86/xsaves: Fix PTRACE frames for XSAVES

2016-04-29 Thread Yu-cheng Yu
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_en

Re: [PATCH v4 07/10] x86/xsaves: Fix PTRACE frames for XSAVES

2016-04-29 Thread Borislav Petkov
On Fri, Apr 29, 2016 at 01:40:51PM -0700, Dave Hansen wrote: > I think we do some instruction patching based on it, so I was just > suggesting the software X86_FEATURE because it would plug in to the > existing scheme easier. Ah ok, that's fine then. -- Regards/Gruss, Boris. SUSE Linux GmbH

Re: [PATCH v4 07/10] x86/xsaves: Fix PTRACE frames for XSAVES

2016-04-29 Thread Dave Hansen
On 04/29/2016 01:38 PM, Borislav Petkov wrote: > On Fri, Apr 29, 2016 at 01:16:59PM -0700, Dave Hansen wrote: >> > We probably want a software X86_FEATURE_OS_XSAVES or something. > ... or a simple variable. I think we do some instruction patching based on it, so I was just suggesting the software

Re: [PATCH v4 07/10] x86/xsaves: Fix PTRACE frames for XSAVES

2016-04-29 Thread Borislav Petkov
On Fri, Apr 29, 2016 at 01:16:59PM -0700, Dave Hansen wrote: > We probably want a software X86_FEATURE_OS_XSAVES or something. ... or a simple variable. -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) --

Re: [PATCH v4 07/10] x86/xsaves: Fix PTRACE frames for XSAVES

2016-04-29 Thread Dave Hansen
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_

Re: [PATCH v4 07/10] x86/xsaves: Fix PTRACE frames for XSAVES

2016-04-29 Thread Dave Hansen
On 03/04/2016 10:12 AM, Yu-cheng Yu wrote: > + if (boot_cpu_has(X86_FEATURE_XSAVES)) { > + ret = copyout_from_xsaves(pos, count, kbuf, ubuf, xsave); On a higher level, we really should stop using "boot_cpu_has(X86_FEATURE_XSAVES)" as a proxy for "the kernel XSAVE buffer is in the X

[PATCH v4 07/10] x86/xsaves: Fix PTRACE frames for XSAVES

2016-03-04 Thread Yu-cheng Yu
XSAVES uses compacted format and is a kernel instruction. The kernel should use standard-format, non-supervisor state data for PTRACE. Signed-off-by: Yu-cheng Yu --- arch/x86/include/asm/fpu/xstate.h | 4 + arch/x86/kernel/fpu/regset.c | 56 +--- arch/x86/kernel/fpu/xstate.c