bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bash 2.05 converts sigset_t to char* and back


From: Paul Eggert
Subject: Bash 2.05 converts sigset_t to char* and back
Date: Thu, 3 May 2001 00:13:15 -0700 (PDT)

Configuration Information [Automatically generated, do not change]:
Machine: sparc
OS: solaris2.7
Compiler: cc -xarch=v9
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='sparc' 
-DCONF_OSTYPE='solaris2.7' -DCONF_MACHTYPE='sparc-sun-solaris2.7' 
-DCONF_VENDOR='sun' -DSHELL  -DHAVE_CONFIG_H  -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I.  -I.. -I../include -I../lib 
-I/tmp/prefix/include -g
uname output: SunOS sic.twinsun.com 5.7 Generic_106541-15 sun4u sparc 
SUNW,UltraSPARC-IIi-Engine
Machine Type: sparc-sun-solaris2.7

Bash Version: 2.05
Patch Level: 0
Release Status: release

Description:
        I found this bug by code inspection while looking into other
        places where add_unwind_protect might cause problems.  The
        Bash 2.05 function restore_signal_mask is invoked on a value
        of type sigset_t, but this value has been converted to char*
        and back by add_unwind_protect.  Such a conversion is not
        reliable, as sigset_t might be larger than char*.  On this
        platform (64-bit Solaris 7 sparc) the conversion happens to
        work (sigset_t is 16 bytes, but structure values are always
        passed by reference) but this won't be true in general.

Repeat-By:

Fix:

2001-05-03  Paul Eggert  <eggert@twinsun.com>

        * execute_cmd.c (restore_signal_mask): Accept sigset_t *, not
        sigset_t, because add_unwind_protect passes a pointer and
        sigset_t may not fit into a pointer.
        (execute_pipeline): Pass sigset_t *, not sigset_t, to
        restore_signal_mask via add_unwind_protect.

===================================================================
RCS file: execute_cmd.c,v
retrieving revision 2.5.0.5
retrieving revision 2.5.0.6
diff -pu -r2.5.0.5 -r2.5.0.6
--- execute_cmd.c       2001/05/01 01:21:56     2.5.0.5
+++ execute_cmd.c       2001/05/03 07:03:48     2.5.0.6
@@ -355,9 +355,9 @@ dispose_exec_redirects ()
    is interrupted or errors occur while creating a pipeline. */
 static int
 restore_signal_mask (set)
-     sigset_t set;
+     sigset_t *set;
 {
-  return (sigprocmask (SIG_SETMASK, &set, (sigset_t *)NULL));
+  return (sigprocmask (SIG_SETMASK, set, (sigset_t *)NULL));
 }
 #endif /* JOB_CONTROL */
 
@@ -1288,7 +1288,7 @@ execute_pipeline (command, asynchronous,
       add_unwind_protect (close, dummyfd);
 
 #if defined (JOB_CONTROL)
-      add_unwind_protect (restore_signal_mask, oset);
+      add_unwind_protect (restore_signal_mask, &oset);
 #endif /* JOB_CONTROL */
 
       if (ignore_return && cmd->value.Connection->first)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]