From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754319Ab0BFMHU (ORCPT ); Sat, 6 Feb 2010 07:07:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:28967 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751306Ab0BFMHS (ORCPT ); Sat, 6 Feb 2010 07:07:18 -0500 Date: Sat, 6 Feb 2010 13:06:40 +0100 From: Oleg Nesterov To: Suresh Siddha Cc: Arjan van de Ven , Jeremy Fitzhardinge , "linux-kernel@vger.kernel.org" Subject: Re: PATCH? process_32.c:__switch_to() calls __math_state_restore() before updating current_task Message-ID: <20100206120640.GA22280@redhat.com> References: <20100204165105.GA5905@redhat.com> <1265305253.2768.7.camel@sbs-t61.sc.intel.com> <20100205124407.GA24974@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100205124407.GA24974@redhat.com> 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 02/05, Oleg Nesterov wrote: > > In short: why restore_i387_xstate() does init_fpu() when !used_math(), > can't (or shouldn't) it merely do set_used_math() ? > > restore_i387_xstate: > > if (!used_math()) { > err = init_fpu(tsk); > if (err) > return err; > } > > note that buf != NULL. This means that used_math() was true when > get_sigframe() was called, otherwise buf == sigcontext->fpstate > would be NULL, right? > > So, the task must have the valid ->thread.xstate, This is probably correct. But a malicious user can set sc->fpsate and fool the kernel, so we must assume buf != NULL implies the valid ->xstate. Oleg.