lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CALCETrW-hZz+Uy0M3EQ_ajX7_iF8J5XyLGbSwBWwDzd_8Q6oMg@mail.gmail.com>
Date:	Mon, 22 Feb 2016 14:55:50 -0800
From:	Andy Lutomirski <luto@...capital.net>
To:	Dave Hansen <dave.hansen@...ux.intel.com>
Cc:	Yu-cheng Yu <yu-cheng.yu@...el.com>, 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 Mon, Feb 22, 2016 at 2:53 PM, Dave Hansen
<dave.hansen@...ux.intel.com> wrote:
> 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.

Some day I kind of want to delete all this xsave/xrstor directly on
user buffers code.   I've never been thrilled with the concept, and it
has messy (although AFAICT not presently buggy [1]) interactions with
context switches, and it can't run with preemption disabled because it
can take page faults.

In the mean time, it's fine as far as I know, but maybe it would be
cleaner if it used the software copy code.  Or maybe we can change it
later if a good reason shows up.

[1] actually there's a minor bug in the 32-bit compat code that
Borislav has a patch for.

-- 
Andy Lutomirski
AMA Capital Management, LLC

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ