Mercurial > illumos > illumos-gate
changeset 13060:dbb29763d43d
6974684 libpkcs11 performance can be improved with less restrictive dlopen() flags
6975112 libpkcs11 shouldn't try to dlclose its own metaslot
author | Valerie Bubb Fenwick <Valerie.Fenwick@Oracle.COM> |
---|---|
date | Mon, 09 Aug 2010 11:56:40 -0700 |
parents | 3a5370c021db |
children | bda0decf867b |
files | usr/src/cmd/cmd-crypto/cryptoadm/adm_uef.c usr/src/lib/pkcs11/libpkcs11/common/pkcs11Conf.c usr/src/lib/pkcs11/libpkcs11/common/pkcs11Slottable.c |
diffstat | 3 files changed, 20 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/cmd-crypto/cryptoadm/adm_uef.c Mon Aug 09 11:07:12 2010 -0700 +++ b/usr/src/cmd/cmd-crypto/cryptoadm/adm_uef.c Mon Aug 09 11:56:40 2010 -0700 @@ -231,7 +231,12 @@ (void) strlcpy(libpath, libname, sizeof (libpath)); } - /* Open the provider */ + /* + * Open the provider. Use RTLD_NOW here, as a way to + * catch any providers with incomplete symbols that + * might otherwise cause problems during libpkcs11's + * execution. + */ dldesc = dlopen(libpath, RTLD_NOW); if (dldesc == NULL) { dl_error = dlerror();
--- a/usr/src/lib/pkcs11/libpkcs11/common/pkcs11Conf.c Mon Aug 09 11:07:12 2010 -0700 +++ b/usr/src/lib/pkcs11/libpkcs11/common/pkcs11Conf.c Mon Aug 09 11:56:40 2010 -0700 @@ -528,13 +528,14 @@ } /* - * Open the provider. Use RTLD_NOW to make sure we - * will not encounter symbol referencing errors later. - * Use RTLD_GROUP to limit the provider to it's own - * symbols, which prevents it from mistakenly accessing - * the framework's C_* functions. + * Open the provider. We assume all of our plugins have + * their symbols properly defined, so the use of RTLD_NOW + * to flush out errors immediately is not necessary. + * + * Note that for proper operation, all plugins must be + * built with direct bindings enabled. */ - dldesc = dlopen(fullpath, RTLD_NOW|RTLD_GROUP); + dldesc = dlopen(fullpath, RTLD_LAZY); /* * If we failed to load it, we will just skip this
--- a/usr/src/lib/pkcs11/libpkcs11/common/pkcs11Slottable.c Mon Aug 09 11:07:12 2010 -0700 +++ b/usr/src/lib/pkcs11/libpkcs11/common/pkcs11Slottable.c Mon Aug 09 11:56:40 2010 -0700 @@ -18,9 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. */ #include <dlfcn.h> @@ -204,7 +204,11 @@ (void) cur_slot-> sl_func_list->C_Finalize(NULL); } - (void) dlclose(cur_slot->sl_dldesc); + + /* metaslot won't have a sl_dldesc! */ + if (cur_slot->sl_dldesc != NULL) { + (void) dlclose(cur_slot->sl_dldesc); + } /* * Each provider maintains one disabled