From patchwork Fri Mar 18 14:16:31 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Edworthy X-Patchwork-Id: 643981 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2IEGrmT009900 for ; Fri, 18 Mar 2011 14:16:53 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756527Ab1CROQw (ORCPT ); Fri, 18 Mar 2011 10:16:52 -0400 Received: from relmlor2.renesas.com ([210.160.252.172]:50842 "EHLO relmlor2.renesas.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754075Ab1CROQw (ORCPT ); Fri, 18 Mar 2011 10:16:52 -0400 Received: from relmlir4.idc.renesas.com ([10.200.68.154]) by relmlor2.idc.renesas.com ( SJSMS) with ESMTP id <0LI9007B1BO2UY50@relmlor2.idc.renesas.com> for linux-sh@vger.kernel.org; Fri, 18 Mar 2011 23:16:50 +0900 (JST) Received: from relmlac4.idc.renesas.com ([10.200.69.24]) by relmlir4.idc.renesas.com ( SJSMS) with ESMTP id <0LI9007UCBO2RM60@relmlir4.idc.renesas.com> for linux-sh@vger.kernel.org; Fri, 18 Mar 2011 23:16:50 +0900 (JST) Received: by relmlac4.idc.renesas.com (Postfix, from userid 0) id D085848082; Fri, 18 Mar 2011 23:16:50 +0900 (JST) Received: from relmlac4.idc.renesas.com (localhost [127.0.0.1]) by relmlac4.idc.renesas.com (Postfix) with ESMTP id B92084808A for ; Fri, 18 Mar 2011 23:16:50 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac4.idc.renesas.com with ESMTP id ZAB08060; Fri, 18 Mar 2011 23:16:50 +0900 X-IronPort-AV: E=Sophos; i="4.63,205,1299423600"; d="scan'208"; a="17283587" Received: from unknown (HELO rte-idc-bh1.RTE.ADWIN.RENESAS.COM) ([172.28.64.243]) by relmlii1.idc.renesas.com with ESMTP; Fri, 18 Mar 2011 23:16:50 +0900 Received: from rte-ben-exch.RTE.ADWIN.RENESAS.COM ([172.29.42.16]) by rte-idc-bh1.RTE.ADWIN.RENESAS.COM with Microsoft SMTPSVC(6.0.3790.211) ; Fri, 18 Mar 2011 14:16:46 +0000 Received: from ubuntu ([172.29.43.69]) by rte-ben-exch.RTE.ADWIN.RENESAS.COM with Microsoft SMTPSVC(6.0.3790.3959); Fri, 18 Mar 2011 14:16:46 +0000 From: Phil Edworthy To: linux-sh@vger.kernel.org Cc: Phil Edworthy Subject: [PATCH] sh: Fix ptrace fpu state initialisation Date: Fri, 18 Mar 2011 14:16:31 +0000 Message-id: <1300457791-11485-1-git-send-email-phil.edworthy@renesas.com> X-Mailer: git-send-email 1.7.1 X-OriginalArrivalTime: 18 Mar 2011 14:16:46.0429 (UTC) FILETIME=[1D3850D0:01CBE577] Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 18 Mar 2011 14:16:54 +0000 (UTC) diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c index 90a15d2..b53664e 100644 --- a/arch/sh/kernel/ptrace_32.c +++ b/arch/sh/kernel/ptrace_32.c @@ -392,6 +392,9 @@ long arch_ptrace(struct task_struct *child, long request, tmp = 0; } else { unsigned long index; + ret = init_fpu(child); + if (ret) + break; index = addr - offsetof(struct user, fpu); tmp = ((unsigned long *)child->thread.xstate) [index >> 2]; @@ -423,6 +426,9 @@ long arch_ptrace(struct task_struct *child, long request, else if (addr >= offsetof(struct user, fpu) && addr < offsetof(struct user, u_fpvalid)) { unsigned long index; + ret = init_fpu(child); + if (ret) + break; index = addr - offsetof(struct user, fpu); set_stopped_child_used_math(child); ((unsigned long *)child->thread.xstate) diff --git a/arch/sh/kernel/ptrace_64.c b/arch/sh/kernel/ptrace_64.c index 4436eac..c8f9764 100644 --- a/arch/sh/kernel/ptrace_64.c +++ b/arch/sh/kernel/ptrace_64.c @@ -403,6 +403,9 @@ long arch_ptrace(struct task_struct *child, long request, else if ((addr >= offsetof(struct user, fpu)) && (addr < offsetof(struct user, u_fpvalid))) { unsigned long index; + ret = init_fpu(child); + if (ret) + break; index = addr - offsetof(struct user, fpu); tmp = get_fpu_long(child, index); } else if (addr == offsetof(struct user, u_fpvalid)) { @@ -442,6 +445,9 @@ long arch_ptrace(struct task_struct *child, long request, else if ((addr >= offsetof(struct user, fpu)) && (addr < offsetof(struct user, u_fpvalid))) { unsigned long index; + ret = init_fpu(child); + if (ret) + break; index = addr - offsetof(struct user, fpu); ret = put_fpu_long(child, index, data); }