Closed Bug 1285145 Opened 8 years ago Closed 8 years ago

Enable SSL tests on LSan runs

Categories

(NSS :: Libraries, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ttaubert, Assigned: ttaubert)

References

Details

Attachments

(1 file, 1 obsolete file)

      No description provided.
Comment on attachment 8769880 [details] [diff] [review]
0001-Bug-1285145-Enable-SSL-tests-on-LSan-runs.patch

Review of attachment 8769880 [details] [diff] [review]:
-----------------------------------------------------------------

Can you check the selfserv thing? Otherwise looking good. The HMAC_Finish issue we can also do in a follow up.

::: cmd/selfserv/selfserv.c
@@ +730,5 @@
>      PZ_NotifyAllCondVar(jobQNotEmptyCv);
> +    PZ_Unlock(qLock);
> +
> +    /* Wait for worker threads to terminate. */
> +    for (i = 0; i < maxThreads; ++i) {

Do we always have maxThreads? Before threadCount was used. Sounds to me like we could get stuck in this loop if threadCount < maxThreads or get a null pointer problem when accessing slot->prThread

::: cmd/tstclnt/tstclnt.c
@@ +1238,5 @@
> +    } else {
> +        char *certDirTmp = certDir;
> +        certDir = SECU_ConfigDirectory(certDirTmp);
> +        PORT_Free(certDirTmp);
> +    }

not sure if I see how moving this solves a leak, but I also don't see anything wrong with it.

::: lib/ssl/ssl3ext.c
@@ +1492,5 @@
>          HMAC_Update(hmac_ctx, key_name, SESS_TICKET_KEY_NAME_LEN);
>          HMAC_Update(hmac_ctx, iv, sizeof(iv));
>          HMAC_Update(hmac_ctx, (unsigned char *)length_buf, 2);
>          HMAC_Update(hmac_ctx, ciphertext.data, ciphertext.len);
>          HMAC_Finish(hmac_ctx, computed_mac, &computed_mac_length,

not a leak but HMAC_Finish returns a SECStatus. We should check that.

@@ +1494,5 @@
>          HMAC_Update(hmac_ctx, (unsigned char *)length_buf, 2);
>          HMAC_Update(hmac_ctx, ciphertext.data, ciphertext.len);
>          HMAC_Finish(hmac_ctx, computed_mac, &computed_mac_length,
>                      sizeof(computed_mac));
> +        HMAC_Destroy(hmac_ctx, PR_FALSE);

all other cases destroy in loser. Maybe we should do that here as well.
Attachment #8769880 - Flags: review?(franziskuskiefer)
(In reply to Franziskus Kiefer [:fkiefer or :franziskus] from comment #2)
> ::: cmd/selfserv/selfserv.c
> @@ +730,5 @@
> >      PZ_NotifyAllCondVar(jobQNotEmptyCv);
> > +    PZ_Unlock(qLock);
> > +
> > +    /* Wait for worker threads to terminate. */
> > +    for (i = 0; i < maxThreads; ++i) {
> 
> Do we always have maxThreads? Before threadCount was used. Sounds to me like
> we could get stuck in this loop if threadCount < maxThreads or get a null
> pointer problem when accessing slot->prThread

That's a good point. We'll always have |maxThreads| perThread structs but not all of them might have threads due to OOM. Null-checking |slot->prThread| should be sufficient.

> ::: cmd/tstclnt/tstclnt.c
> @@ +1238,5 @@
> > +    } else {
> > +        char *certDirTmp = certDir;
> > +        certDir = SECU_ConfigDirectory(certDirTmp);
> > +        PORT_Free(certDirTmp);
> > +    }
> 
> not sure if I see how moving this solves a leak, but I also don't see
> anything wrong with it.

Could have explained that some more. With pingServerFirst=true we would not reach the part of the code I moved up. We would leak |certDir| in that case. It's not the greatest solution as we don't need that config dir when pingServerFirst=true but everything else would have been uglier.

> >          HMAC_Finish(hmac_ctx, computed_mac, &computed_mac_length,
> 
> not a leak but HMAC_Finish returns a SECStatus. We should check that.

> > +        HMAC_Destroy(hmac_ctx, PR_FALSE);
> 
> all other cases destroy in loser. Maybe we should do that here as well.

Will do.
Attachment #8769880 - Attachment is obsolete: true
Attachment #8770018 - Flags: review?(franziskuskiefer)
Attachment #8770018 - Flags: review?(franziskuskiefer) → review+
https://hg.mozilla.org/projects/nss/rev/2530cf04ae82
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → 3.26
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: