Bug 6559

Summary: Kernel oops with trigonometric functions on a 386 w/o fpu
Product: [Retired] Red Hat Linux Reporter: donald
Component: kernelAssignee: Michael K. Johnson <johnsonm>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-01-04 22:27:49 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description donald 1999-10-31 04:12:58 UTC
I'm running RedHat 6.0 on a 386 without a math
co-processor.  The following code (compiled with 'gcc
tst.c -lm' always produces a kernel oops and generates a
segmentation fault.  (According to 'objdump --disassemble',
there are no 486 BSWAP instructions in the executable)

#include <stdio.h>
#include <math.h>

int
main()
{
        printf ("%f\n", sin(1.0));
        exit (0);
}

Similar behaviour results with the following perl script...

$ perl -e '{ print sin(1.0), "\n" }'
Segmentation fault

Curiously, though...

$ perl -e '{ print sin(3.0), "\n" }'
0.141120008059867

works fine.  For what it's worth, here's the oops
(sorry about the wrapping).

>Unable to handle kernel paging request at virtual address
8214aabf
>current->tss.cr3 = 00646000, %cr3 = 00646000
>*pde = 00000000
>Oops: 0000
>CPU:    0
>EIP:    0010:[poly_sine+945/1140]
>EFLAGS: 00010296
>eax: 8214aabb   ebx: 00000000   ecx: 07781a5c   edx:
1de06972
>esi: 8214aabb   edi: c03cff00   ebp: c03cff00   esp:
c03cfeac
>ds: 0018   es: 0018   ss: 0018
>Process perl (pid: 7036, process nr: 30,
stackpage=c03cf000)
>Stack: 00000000 c03cffb4 c03cfefc c03cfeec c03cfee8
00000000 c03cfed4 c03cfef4
>       8214aabb 2cd09e2b 42d18469 921fb544 c03cffb4
00000000 00000000 0013d0fa
>       9c6c0650 1b2cb8ab ab698587 4318c275 53682eaf
12ffb1d5 48677021 d76aa478
>Call Trace: [fsin+71/292] [FPU_trigb+62/76]
[math_emulate+2255/2388]
>       [do_no_page+179/192] [handle_mm_fault+198/352]
>       [device_not_available+55/60]
[ret_from_exception+0/16]
>       [startup_32+43/286]
>Code: f7 60 04 89 54 24 28 8b 54 24 5c 89 54 24 10 89 54 24
2c 89

Some futher notes:

Manually upgrading the kernel to 2.2.12 (w/
CONFIG_MATH_EMULATION=y and CONFIG_M386=y) didn't help.
However, I tried recompiling the kernel (v2.2.12) using
an older compiler (gcc version 2.7.2.3) and that seemed
to fix the problem.  It looks as though there may be some
issues with the C compiler that comes with RedHat 6.0
(egcs-2.91.66 / egcs-1.1.2) and Linux's math emulation.

Comment 1 Jim Kingdon 1999-11-01 00:08:59 UTC
The fact that changing the compiler helped _might_ mean it is a
compiler problem, but it might not be.

Comment 2 Cristian Gafton 2000-01-04 22:25:59 UTC
Assigned to dledford

Comment 3 Cristian Gafton 2000-01-04 22:27:59 UTC
Assigned to dledford

Comment 4 Alan Cox 2000-08-08 14:20:52 UTC
This should be fixed in 2.2.14 and higher