From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760579AbXH2TNe (ORCPT ); Wed, 29 Aug 2007 15:13:34 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751576AbXH2TN0 (ORCPT ); Wed, 29 Aug 2007 15:13:26 -0400 Received: from mx1.redhat.com ([66.187.233.31]:33086 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755119AbXH2TNZ (ORCPT ); Wed, 29 Aug 2007 15:13:25 -0400 Message-ID: <46D5C552.1060307@redhat.com> Date: Wed, 29 Aug 2007 15:13:22 -0400 From: Chuck Ebbert Organization: Red Hat User-Agent: Thunderbird 1.5.0.12 (X11/20070719) MIME-Version: 1.0 To: Clark Cooper CC: linux-kernel@vger.kernel.org Subject: Re: PROBLEM: Caught SIGFPE exceptions aren't reset References: <18128.322.59087.367556@alkaid.it.uu.se> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On 08/25/2007 01:31 PM, Clark Cooper wrote: >> Your handler can do this by masking >> exceptions, changing the operands of the failed FP instruction, >> or by changing the PC so that the failed instruction is skipped >> (your handler may want to emulate the instruction in this case). > > Given the current SIGFPE handling in the kernel, a userland handler > CAN'T mask the exceptions or clear the exception flags. This is > demonstrated in my example program where I call both feclearexception > and fedisableexception in the handler. The reason these don't work is > that any change you make to these FPU registers is overwritten with > the saved FPU context on return from the signal handler. Changing the > PC won't help since the exception flag is still set and unmasked on > signal return. Just change the saved FPU context before returning. (It's on the stack when your handler is running.)