From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754460AbbDPSUw (ORCPT ); Thu, 16 Apr 2015 14:20:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41027 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753489AbbDPSUo (ORCPT ); Thu, 16 Apr 2015 14:20:44 -0400 Date: Thu, 16 Apr 2015 20:20:37 +0200 From: Oleg Nesterov To: Borislav Petkov Cc: Ingo Molnar , LKML , Rik van Riel , Andy Lutomirski , "H. Peter Anvin" , Linus Torvalds , Tavis Ormandy , Thomas Gleixner Subject: Re: [PATCH] x86/fpu: Load xsave pointer *after* initialization Message-ID: <20150416182037.GA26537@redhat.com> References: <1429207509-1717-1-git-send-email-bp@alien8.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1429207509-1717-1-git-send-email-bp@alien8.de> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.