Skip to content

Commit

Permalink
Correct dynamic link error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksei-fedotov committed Jan 29, 2025
1 parent 1ffd421 commit a912937
Showing 1 changed file with 26 additions and 25 deletions.
51 changes: 26 additions & 25 deletions src/tbb/dynamic_link.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,22 +146,22 @@ namespace r1 {
case dl_lib_not_found:
str = va_arg(args, const char*);
error = va_arg(args, dlerr_t);
TBB_FPRINTF(stdout, "%s The module \"%s\" was not loaded because it was not found. "
"System error: " DLERROR_SPECIFIER "\n", prefix, str, error);
TBB_FPRINTF(stdout, "%s The module \"%s\" was not found. System error: "
DLERROR_SPECIFIER "\n", prefix, str, error);
break;
case dl_sym_not_found: // char const * sym, dlerr_t err:
// TODO: Print not found symbol once it is used by the implementation
break;
case dl_sys_fail:
str = va_arg(args, const char*);
error = va_arg(args, dlerr_t);
TBB_FPRINTF(stdout, "oneTBB: A call to \"%s\" failed with error " DLERROR_SPECIFIER
"\n", str, error);
TBB_FPRINTF(stdout, "%s A call to \"%s\" failed with error " DLERROR_SPECIFIER "\n",
prefix, str, error);
break;
case dl_buff_too_small:
TBB_FPRINTF(stdout, "oneTBB: An internal buffer representing a path to dynamically "
"loaded module is small. Consider compile with larger value for PATH_MAX "
"macro.\n");
TBB_FPRINTF(stdout, "%s An internal buffer representing a path to dynamically loaded "
"module is small. Consider compiling with larger value for PATH_MAX macro.\n",
prefix);
break;
case dl_unload_fail:
str = va_arg(args, const char*);
Expand All @@ -171,43 +171,40 @@ namespace r1 {
break;
case dl_lib_unsigned:
str = va_arg(args, const char*);
TBB_FPRINTF(stdout, "%s The module \"%s\" was not loaded because it is unsigned or has "
"invalid signature.\n", prefix, str);
TBB_FPRINTF(stdout, "%s The module \"%s\" is unsigned or has invalid signature.\n",
prefix, str);
break;
case dl_sig_err_unknown:
str = va_arg(args, const char*);
error = va_arg(args, dlerr_t);
TBB_FPRINTF(stdout, "%s The module \"%s\" was not loaded because its signature "
"verification results in unknown error:" DLERROR_SPECIFIER "\n",
prefix, str, error);
TBB_FPRINTF(stdout, "%s The signature verification of the module \"%s\" results in "
"unknown error:" DLERROR_SPECIFIER "\n", prefix, str, error);
break;
case dl_sig_explicit_distrust:
str = va_arg(args, const char*);
TBB_FPRINTF(stdout, "%s The module \"%s\" was not loaded because the certificate "
"with which it was signed is explicitly distrusted by an admin or user.\n",
prefix, str);
TBB_FPRINTF(stdout, "%s The certificate with which the module \"%s\" is signed is "
"explicitly distrusted by an admin or user.\n", prefix, str);
break;
case dl_sig_untrusted_root:
str = va_arg(args, const char*);
TBB_FPRINTF(stdout, "%s The module \"%s\" was not loaded because during the signature "
"verification process, the certificate chain is terminated in a root "
"certificate which is not trusted.\n", prefix, str);
TBB_FPRINTF(stdout, "%s The signature verification process for the module \"%s\" has "
"terminated in a root certificate which is not trusted.\n", prefix, str);
break;
case dl_sig_distrusted:
str = va_arg(args, const char*);
TBB_FPRINTF(stdout, "%s The module \"%s\" was not loaded because its signature is not "
"trusted.\n", prefix, str);
TBB_FPRINTF(stdout, "%s The signature of the module \"%s\" is not trusted.\n", prefix,
str);
break;
case dl_sig_security_settings:
str = va_arg(args, const char*);
TBB_FPRINTF(stdout, "%s The module \"%s\" was not loaded because the hash or publisher "
"was not explicitly trusted and user trust was not allowed.", prefix, str);
TBB_FPRINTF(stdout, "%s The hash or publisher of the module \"%s\" was not explicitly "
"trusted and user trust was not allowed.\n", prefix, str);
break;
case dl_sig_other_error:
str = va_arg(args, const char*);
error = va_arg(args, dlerr_t);
TBB_FPRINTF(stdout, "%s The module \"%s\" was not loaded. System error code "
DLERROR_SPECIFIER "\n", prefix, str, error);
TBB_FPRINTF(stdout, "%s Signature verification for the module \"%s\" failed. System "
"error code: " DLERROR_SPECIFIER "\n", prefix, str, error);
break;
}

Expand Down Expand Up @@ -693,12 +690,16 @@ namespace r1 {
path = absolute_path;
}

if (has_valid_signature(path, length))
if (has_valid_signature(path, length)) {
#endif /* __TBB_VERIFY_DEPENDENCY_SIGNATURE */
#endif /* _WIN32 */
// The argument of loading_flags is ignored on Windows
library_handle = dlopen( path, loading_flags(flags & DYNAMIC_LINK_LOCAL) );
#if _WIN32
#if __TBB_VERIFY_DEPENDENCY_SIGNATURE
} else
return library_handle; // Warning (if any) has already been reported
#endif /* __TBB_VERIFY_DEPENDENCY_SIGNATURE */
SetErrorMode (prev_mode);
#endif /* _WIN32 */
if( library_handle ) {
Expand Down

0 comments on commit a912937

Please sign in to comment.