Subject: lib/17595: libcdk installs a sigsegv and sigbus handler
To: None <gnats-bugs@gnats.netbsd.org>
From: None <xs@kittenz.org>
List: netbsd-bugs
Date: 07/14/2002 12:41:31
>Number: 17595
>Category: lib
>Synopsis: libcdk installs a sigsegv and sigbus handler
>Confidential: no
>Severity: serious
>Priority: low
>Responsible: lib-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Jul 14 04:42:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:
>Release: NetBSD 1.6B
>Organization:
>Environment:
/usr/src/dist/cdk/cdkscreen.c:
$Author: garbled $
$Date: 2001/01/04 19:58:24 $
$Revision: 1.1.1.1 $
System: NetBSD stasis 1.6B NetBSD 1.6B (STASIS) #19: Sat Jul 6 13:17:35 BST 2002 xs@stasis:/usr/src/sys/arch/i386/compile/STASIS i386
Architecture: i386
Machine: i386
>Description:
initCDKScreen install a SIGBUS and SIGSEGV handler. This is unexpected
and unsafe because the handler invokes printf() which is not listed
by SuS/posix as being async-signal-safe.
The handler also calls endCDK() which is likely to not be
async-signal-safe.
>How-To-Repeat:
>Fix:
Index: cdkscreen.c
===================================================================
RCS file: /cvsroot/basesrc/dist/cdk/cdkscreen.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 cdkscreen.c
--- cdkscreen.c 2001/01/04 19:58:24 1.1.1.1
+++ cdkscreen.c 2002/07/14 11:23:39
@@ -7,8 +7,6 @@
* $Revision: 1.1.1.1 $
*/
-static void segvTrap (int sig);
-
static boolean validObjType(EObjectType type)
{
switch (type) {
@@ -56,10 +54,6 @@
CDKSCREEN *screen = (CDKSCREEN *)malloc (sizeof(CDKSCREEN));
int x;
- /* Set signal trap handlers. */
- signal (SIGSEGV, segvTrap);
- signal (SIGBUS, segvTrap);
-
/* Set up basic curses settings. */
noecho();
cbreak();
@@ -262,16 +256,3 @@
#endif
}
-/*
- * This is the function called when we trap a SEGV or a BUS error.
- */
-static void segvTrap (int sig)
-{
- static int nested;
- if (!nested++)
- {
- endCDK();
- printf ("core dumped. your fault! (signal %d)\n", sig);
- }
- abort();
-}
>Release-Note:
>Audit-Trail:
>Unformatted: