FYI, there is a bug in the error handling logic in nss_Shutdown() which causes a bogus error code to be returned due to the following sequence of steps in nss_Shutdown():

...
status = STAN_Shutdown();
...
nss_DestroyErrorStack();
nssArena_Shutdown();
if (status == PR_FAILURE) {
    if (NSS_GetError() == NSS_ERROR_BUSY) {
        PORT_SetError(SEC_ERROR_BUSY);
    }
    shutdownRV = SECFailure;
}

Note that NSS_GetError() is called *after* nss_DestroyErrorStack()!

When NSS_GetError() is called error_get_my_stack() is invoked but because the thread local stack was destroyed it happily recreates a brand new error stack with no errors, as result NSS_GetError() returns 0.

This then causes a failure to set the correct error code via PORT_SetError(). NSS_Shutdown() returns SECFailure and the caller of NSS_Shutdown() then invokes PORT_GetError() which then returns a completely bogus error code from the dim past (because errors are never cleared).

Filed bug as: https://bugzilla.mozilla.org/show_bug.cgi?id=816488

--
John Dennis <jden...@redhat.com>

Looking to carve out IT costs?
www.redhat.com/carveoutcosts/
--
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto

Reply via email to