linux-um archives
 help / color / mirror / Atom feed
From: Yu-cheng Yu <yu-cheng.yu@intel.com>
To: Richard Weinberger <richard@nod.at>
Cc: Thomas Meyer <thomas@m3y3r.de>,
	elicooper@gmx.com, linux-kernel@vger.kernel.org,
	"open list:USER-MODE LINUX (UML)"
	<user-mode-linux-devel@lists.sourceforge.net>,
	linux-x86_64@vger.kernel.org, Dave Hansen <dave.hansen@intel.com>,
	Ingo Molnar <mingo@redhat.com>
Subject: Re: um: PTRACE_SETREGSET failure with XSTATE on Kabylake CPU
Date: Tue, 20 Jun 2017 11:04:34 -0700	[thread overview]
Message-ID: <1497981874.22112.20.camel@test-lenovo> (raw)
In-Reply-To: <25066617-df15-6d21-713c-1ede1e953448@nod.at>

On Tue, 2017-06-20 at 11:05 +0200, Richard Weinberger wrote:
> [adding x86 folks]
> 
> Am 20.06.2017 um 10:49 schrieb Thomas Meyer:
> > 
> > In UML the first userspace ptrace always fails, so init get's killed.
> > 
> > The check "count < fpu_user_xstate_size" was introduced by commit:
> > 
> > commit 91c3dba7dbc199191272f4a9863f86ea3bfd679f
> > Author: Yu-cheng Yu <yu-cheng.yu@intel.com>
> > Date:   Fri Jun 17 13:07:17 2016 -0700
> > 
> >     x86/fpu/xstate: Fix PTRACE frames for XSAVES
> >     
> >     XSAVES uses compacted format and is a kernel instruction. The kernel
> >     should use standard-format, non-supervisor state data for PTRACE.
> > 
> > So to summarize:
> > 
> > - PTRACE_GETREGSET with NT_X86_XSTATE gets 832 and return 832, with no
> > error.
> > 
> > - PTRACE_SETREGSET get 832 (sizeof struct _xstate) but wants at least
> > 1088, otherwise it will fail with -EFAULT (why not -EINVAL?)
> > 
> > Ideas?

We considered allowing a partial XSAVE buffer for PTRACE_SETREGSET, but
it was that the XSAVE instruction requires a full-size buffer led to
this choice.  Using a smaller buffer for XSAVE causes a fault.

Yu-cheng




  reply	other threads:[~2017-06-20 18:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-20  1:56 um: PTRACE_SETREGSET failure with XSTATE on Kabylake CPU Thomas Meyer
2017-06-20  6:58 ` Richard Weinberger
2017-06-20  8:49   ` [uml-devel] " Thomas Meyer
2017-06-20  9:05     ` Richard Weinberger
2017-06-20 18:04       ` Yu-cheng Yu [this message]
2017-06-20 18:17         ` [uml-devel] " Richard Weinberger
2017-06-20 18:59           ` Richard Weinberger
2017-06-20 19:53             ` Yu-cheng Yu
2017-06-20 20:13               ` [uml-devel] " Thomas Meyer
2017-06-21  8:39                 ` Natale Patriciello
2017-06-21  9:44                   ` Thomas Meyer
2017-06-21 12:47                     ` Richard Weinberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1497981874.22112.20.camel@test-lenovo \
    --to=yu-cheng.yu@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=elicooper@gmx.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-x86_64@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=richard@nod.at \
    --cc=thomas@m3y3r.de \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox