#18624 closed bug (fixed)
Kernel panic when a program triggers a floating-point trap
Reported by: | bhaible | Owned by: | nobody |
---|---|---|---|
Priority: | normal | Milestone: | R1/beta5 |
Component: | System | Version: | R1/beta4 |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
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 (12)
by , 7 months ago
Attachment: | testdir4.tar.gz added |
---|
comment:1 by , 7 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 , 7 months ago
the backtrace goes through x86_unexpected_exception
, I think that means we are missing some code to handle these?
comment:3 by , 7 months ago
comment:5 by , 7 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 , 7 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 , 7 months ago
Milestone: | Unscheduled → R1/beta5 |
---|
test case