NetBSD Problem Report #59294

From www@netbsd.org  Sun Apr 13 23:37:17 2025
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id B38C51A9239
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 13 Apr 2025 23:37:17 +0000 (UTC)
Message-Id: <20250413233716.315081A923D@mollari.NetBSD.org>
Date: Sun, 13 Apr 2025 23:37:16 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: tests/lib/libc/gen/t_siginfo: sigfpe_flt raises SIGILL, not SIGFPE
X-Send-Pr-Version: www-1.0

>Number:         59294
>Category:       port-hppa
>Synopsis:       tests/lib/libc/gen/t_siginfo: sigfpe_flt raises SIGILL, not SIGFPE
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-hppa-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Apr 13 23:40:00 +0000 2025
>Last-Modified:  Mon Apr 14 00:50:02 +0000 2025
>Originator:     Taylor R Campbell
>Release:        current
>Organization:
The HP PA-BSD Sigfpeinformation
>Environment:
>Description:
Relevant excerpt from atf-run output:

tp-start: 1744585134.484021, t_siginfo, 1
tc-start: 1744585134.522808, sigfpe_flt
tc-se:Test program crashed; attempting to get stack trace
tc-se:[New process 492]
tc-se:Core was generated by `t_siginfo'.
tc-se:Program terminated with signal SIGILL, Illegal instruction.
tc-se:#0  0x000119d0 in atfu_sigfpe_flt_body (tc=<optimized out>) at /home/riastradh/netbsd/current/src/tests/lib/libc/gen/t_siginfo.c:334
tc-se:#0  0x000119d0 in atfu_sigfpe_flt_body (tc=<optimized out>) at /home/riastradh/netbsd/current/src/tests/lib/libc/gen/t_siginfo.c:334
tc-se:#1  0xaf80bc7c in atf_tc_run (tc=<optimized out>, resfile=<optimized out>) at /usr/src/external/bsd/atf/dist/atf-c/tc.c:1024
tc-se:#2  0xaf80745c in atf_tp_run (tp=<optimized out>, tcname=<optimized out>, resfile=0xafed8020 "/tmp/atf-run.ArQ50d/tcr") at /usr/src/external/bsd/atf/dist/atf-c/tp.c:205
tc-se:#3  0xaf806d08 in run_tc (exitcode=<synthetic pointer>, p=0xb00017c8, tp=0xb00017f8) at /usr/src/external/bsd/atf/dist/atf-c/detail/tp_main.c:510
tc-se:#4  controlled_main (exitcode=<synthetic pointer>, add_tcs_hook=@0x14172: 0x11d1c <atfu_tp_add_tcs>, argv=<optimized out>, argc=<optimized out>) at /usr/src/external/bsd/atf/dist/atf-c/detail/tp_main.c:580
tc-se:#5  atf_tp_main (argc=<optimized out>, argv=<optimized out>, add_tcs_hook=@0x14172: 0x11d1c <atfu_tp_add_tcs>) at /usr/src/external/bsd/atf/dist/atf-c/detail/tp_main.c:610
tc-se:#6  0x000124a0 in main (argc=<optimized out>, argv=<optimized out>) at /home/riastradh/netbsd/current/src/tests/lib/libc/gen/t_siginfo.c:542
tc-se:Stack trace complete
tc-end: 1744585175.995480, sigfpe_flt, failed, Test program received signal 4 (core dumped)
tp-end: 1744585176.47816, t_siginfo

Signal 4 is SIGILL: https://nxr.NetBSD.org/xref/src/sys/sys/signal.h?r=1.78#55

gdb on the core dump from `/usr/tests/lib/libc/gen/t_siginfo sigfpe_flt' confirms that it is in fact the fdiv,dbl instruction at issue:

Program terminated with signal SIGILL, Illegal instruction.
#0  0x000119d0 in atfu_sigfpe_flt_body (tc=<optimized out>)
    at /home/riastradh/netbsd/current/src/tests/lib/libc/gen/t_siginfo.c:334
334     /home/riastradh/netbsd/current/src/tests/lib/libc/gen/t_siginfo.c: No such file or directory.
(gdb) x/i $pc
=> 0x119d0 <atfu_sigfpe_flt_body+312>:  fdiv,dbl fr7,fr22,fr7

>How-To-Repeat:
cd /usr/tests/lib/libc/gen
atf-run t_siginfo | atf-report
>Fix:
Yes, please!

>Audit-Trail:
From: Taylor R Campbell <riastradh@NetBSD.org>
To: gnats-bugs@NetBSD.org, netbsd-bugs@NetBSD.org
Cc: 
Subject: Re: port-hppa/59294: tests/lib/libc/gen/t_siginfo: sigfpe_flt raises SIGILL, not SIGFPE
Date: Mon, 14 Apr 2025 00:46:46 +0000

 Might be another qemu hppa fpu bug.  I printed the exception registers
 (32-bit halves of fr0-fr3) in the T_EXCEPTION | T_USER case of trap in
 hppa/trap.c, and:

 [  52.9324218] fpp[0]=0x0
 [  52.9324218] fpp[1]=0x0
 [  52.9450154] fpp[2]=0x0
 [  52.9450154] fpp[3]=0x0
 [  52.9450154] fpp[4]=0x0
 [  52.9450154] fpp[5]=0x0
 [  52.9450154] fpp[6]=0x0
 [  52.9450154] fpp[7]=0x0
 [  52.9450154] trap:829: type=0x4e ex=0x0 inst=0x0

 I don't think they're supposed to be all zero!  I think they're
 supposed to have copies of the instructions that triggered the
 exception.  (Except for the first one, which is the fp status
 register.)

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2025 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.