Opened 15 months ago
Last modified 3 months ago
#18624 assigned bug
Kernel panic when a program triggers a floating-point trap
Reported by: | bhaible | Owned by: | korli |
---|---|---|---|
Priority: | normal | Milestone: | R1/beta6 |
Component: | System/Kernel | Version: | R1/beta4 |
Keywords: | Cc: | ||
Blocked By: | Blocking: | #19063 | |
Platform: | x86-64 |
Description
Find attached a program that
1) invokes feenableexcept(FE_INVALID);
to turn FE_INVALID floating-point exceptions (not C++ exceptions!) into traps,
2) exercises an arithmetic operation with a signalling NaN, so as to trigger such a FE_INVALID floating-point exception.
How to reproduce:
- Open a Terminal.
- Unpack testdir4.tar.gz.
- Then
cd testdir4 ./configure make make check
Expected outcome: The program crashes with some signal (most likely SIGFPE).
Actual outcome: Kernel panic; screenshot attached.
The program invocation that crashes is one of:
gltests/test-snan-2 f gltests/test-snan-2 d gltests/test-snan-2 l
Attachments (2)
Change History (18)
by , 15 months ago
Attachment: | testdir4.tar.gz added |
---|
comment:1 by , 15 months ago
More details:
gltests/test-snan-2 f
succeeds.
gltests/test-snan-2 d
succeeds.
gltests/test-snan-2 l
is the invocation that crashes.
comment:2 by , 15 months ago
the backtrace goes through x86_unexpected_exception
, I think that means we are missing some code to handle these?
comment:3 by , 14 months ago
comment:5 by , 14 months ago
What hrev, please?
I'm using the release from https://www.haiku-os.org/get-haiku/r1beta4/, download timestamp: 2022-12-22.
comment:6 by , 14 months ago
I suspect that exception occurs when kernel write FPU registers during contex switch, some of value is SNaN and triggering exceptions by SNaN is enabled in FPU flags. Kernel should not trust FPU flags set by userland and turn off SNaN exceptions before context switch.
comment:8 by , 14 months ago
Milestone: | Unscheduled → R1/beta5 |
---|
comment:11 by , 4 months ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
I reproduce it again in Haiku hrev57823 (from 2024-07-15).
How to reproduce:
tar xfz testdir4.tar.gz cd testdir4 ./configure make gltests/test-snan-2 l
comment:12 by , 4 months ago
Blocking: | 19063 added |
---|
comment:13 by , 4 months ago
Component: | System → System/Kernel |
---|---|
Owner: | changed from | to
Status: | reopened → assigned |
I guess this must've regressed in hrev57381, but that commit indicates that this ticket was re-tested then, so I'm not sure what could've happened.
comment:14 by , 4 months ago
(Since this keeps regressing we should probably add a test to the testsuite.)
comment:15 by , 4 months ago
(Since this keeps regressing we should probably add a test to the testsuite.)
The foo2.c from #19063 is a single-file reproducer. Feel free to add it to the test suite.
test case