public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Borislav Petkov <bp@alien8.de>
Cc: Ingo Molnar <mingo@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Rik van Riel <riel@redhat.com>,
	Andy Lutomirski <luto@amacapital.net>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Tavis Ormandy <taviso@google.com>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] x86/fpu: Load xsave pointer *after* initialization
Date: Thu, 16 Apr 2015 20:20:37 +0200	[thread overview]
Message-ID: <20150416182037.GA26537@redhat.com> (raw)
In-Reply-To: <1429207509-1717-1-git-send-email-bp@alien8.de>

On 04/16, Borislav Petkov wrote:
>
> Box exploded with the splat at the end because we do cache
> &target->thread.fpu.state->xsave into the local variable xsave but
> that pointer is NULL at that time and it gets initialized later, in
> init_fpu(), see
> 
> 	e7f180dcd8ab ("x86/fpu: Change xstateregs_get()/set() to use
> 		      ->xsave.i387 rather than ->fxsave")

OOPS! thanks a lot!!!

> --- a/arch/x86/kernel/i387.c
> +++ b/arch/x86/kernel/i387.c
> @@ -341,7 +341,7 @@ int xstateregs_get(struct task_struct *target, const struct user_regset *regset,
>  		unsigned int pos, unsigned int count,
>  		void *kbuf, void __user *ubuf)
>  {
> -	struct xsave_struct *xsave = &target->thread.fpu.state->xsave;
> +	struct xsave_struct *xsave;
>  	int ret;
>  
>  	if (!cpu_has_xsave)
> @@ -351,6 +351,8 @@ int xstateregs_get(struct task_struct *target, const struct user_regset *regset,
>  	if (ret)
>  		return ret;
>  
> +	xsave = &target->thread.fpu.state->xsave;
> +

Yes, but don't we need the same change in xstateregs_set() ?

Oleg.


  parent reply	other threads:[~2015-04-16 18:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-16 18:05 [PATCH] x86/fpu: Load xsave pointer *after* initialization Borislav Petkov
2015-04-16 18:14 ` Rik van Riel
2015-04-16 18:20 ` Oleg Nesterov [this message]
2015-04-16 18:31   ` Borislav Petkov
2015-04-16 18:41     ` [PATCH -v1.1] " Borislav Petkov
2015-04-17 13:06       ` Oleg Nesterov
2015-04-18 10:14       ` [tip:x86/urgent] " tip-bot for Borislav Petkov

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=20150416182037.GA26537@redhat.com \
    --to=oleg@redhat.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@kernel.org \
    --cc=riel@redhat.com \
    --cc=taviso@google.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /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