Closed Bug 302652 Opened 19 years ago Closed 11 months ago

Purify error in _PR_UnixInit() on Solaris/sparc64

Categories

(NSPR :: NSPR, defect)

Other
Other
defect

Tracking

(Not tracked)

RESOLVED INACTIVE

People

(Reporter: mi+mozilla, Unassigned)

Details

User-Agent:       Mozilla/5.0 (compatible; Konqueror/3.4; FreeBSD) KHTML/3.4.1 (like Gecko)
Build Identifier: 

All NSPR-using programs report the following problem under Purify: 
 
      UMR: Uninitialized memory read 
      This is occurring while in: 
            sigaction_internal [/usr/lib/sparcv9/libthread.so.1] 
            sigaction      [/usr/lib/sparcv9/libthread.so.1] 
            _PR_UnixInit   
[.../nspr-4.6/mozilla/nsprpub/pr/src/md/unix/unix.c:2871] 
                   sigact.sa_handler = SIG_IGN; 
                   sigemptyset(&sigact.sa_mask); 
                   sigact.sa_flags = 0; 
            =>     rv = sigaction(SIGPIPE, &sigact, 0); 
                   PR_ASSERT(0 == rv); 
               #endif /* HPUX && _PR_DCETHREADS */ 
                
            _PR_InitStuff  [nspr-4.6/mozilla/nsprpub/pr/src/misc/prinit.c:253] 
            _PR_ImplicitInitialization 
[nspr-4.6/mozilla/nsprpub/pr/src/misc/prinit.c:258] 
            PR_Init        [nspr-4.6/mozilla/nsprpub/pr/src/misc/prinit.c:309] 
            main           
[nss-3.10/mozilla/security/nss/cmd/modutil/modutil.c:778] 
            _start         [/opt/SUNWspro/WS6U2/lib/v9/crt1.o] 
      Reading 8 bytes from 0xffffffff7fffed00 on the stack (4 bytes at 
0xffffffff7fffed04 uninit). 
      Address 0xffffffff7fffed00 is       32 bytes below frame pointer in 
function sigaction. 
 
This may be something in the Solaris libraries, of course, but I think the 
sigact-structure in the function needs to be zeroed out at initialization to 
avoid occasional failures (maybe) and an alarming warning (always): 
 
 void _PR_UnixInit(void) 
 { 
-    struct sigaction sigact; 
+    struct sigaction sigact = {0}; 
     int rv; 
 
 

Reproducible: Always
Thanks for the bug report.  We've set all three
documented members of the sigaction structure,
like the sample code does:
http://www.opengroup.org/onlinepubs/009695399/functions/sigaction.html

I found that Solaris 9's sigaction structure has
a "int sa_resv[2];" member, so that may be what's
causing the UMR.

We need to use a memset to initialize the sigaction
structure.  We used the {0} initializer before and
it turned out to be not portable because the first
member of some platform's sigaction structure is
a union and so can't be initialized with the integer
constant 0.  (See bug 96673 for details.)
> I found that Solaris 9's sigaction structure has
> a "int sa_resv[2];" member, so that may be what's
> causing the UMR.

Thanks for the investigation!

If this is, indeed, all, there is to this UMR, I'd rather it just be suppressed
and a comment be added next to the nsprpub/pr/src/md/unix/unix.c:2871 advising
about it, so future "rookie" purifiers don't get alarmed.
QA Contact: wtchang → nspr
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Severity: normal → S3

The bug assignee is inactive on Bugzilla, so the assignee is being reset.

Assignee: wtc → nobody
Status: ASSIGNED → NEW
Status: NEW → RESOLVED
Closed: 11 months ago
Resolution: --- → INACTIVE
You need to log in before you can comment on or make changes to this bug.