Skip to content

Conversation

@dgn
Copy link
Contributor

@dgn dgn commented Dec 16, 2025

Commit Message: previously, we'd log a lot of "unknown" error messages. this should fix that.
Additional Description:
Risk Level: low
Testing: included
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]

@dgn dgn force-pushed the fix-system-errors branch from 2e96d27 to bc51d65 Compare December 16, 2025 14:04
previously, we'd log a lot of "unknown" error messages. this should fix
that.

Signed-off-by: Daniel Grimm <[email protected]>
@dgn dgn force-pushed the fix-system-errors branch from bc51d65 to dbd6bd8 Compare December 16, 2025 14:04
Copy link
Member

@jwendell jwendell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I'll let the expert (@tedjpoole) to chime in.

@dgn BTW, were we supposed to expect changes in envoy tests? I mean all passed but I thought that, with this change, we'd need to revert some of the changes we made in Envoy due to the differences in error strings...

Copy link
Contributor

@tedjpoole tedjpoole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good thanks, except some minor niggles. The only real functional change is ERR_reason_error_string() should return "unknown error" rather than a NULL if the reason code is unknown.

// Handle system library errors like BoringSSL does
// For system errors, return strerror(errno) like BoringSSL does
if (ERR_GET_LIB(packed_error) == ERR_LIB_SYS) {
uint32_t reason = ERR_GET_REASON(packed_error);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
uint32_t reason = ERR_GET_REASON(packed_error);
uint32_t reason = ossl_ERR_GET_REASON(packed_error);

extern "C" const char *ERR_lib_error_string(uint32_t packed_error) {
// Handle system library errors like BoringSSL does
// OpenSSL 3.x returns NULL for system errors, but BoringSSL returns "system library"
if (ERR_GET_LIB(packed_error) == ERR_LIB_SYS) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (ERR_GET_LIB(packed_error) == ERR_LIB_SYS) {
if (ossl_ERR_SYSTEM_ERROR(packed_error)) {

extern "C" const char *ERR_reason_error_string(uint32_t packed_error) {
// Handle system library errors like BoringSSL does
// For system errors, return strerror(errno) like BoringSSL does
if (ERR_GET_LIB(packed_error) == ERR_LIB_SYS) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (ERR_GET_LIB(packed_error) == ERR_LIB_SYS) {
if (ossl_ERR_SYSTEM_ERROR(packed_error)) {

if (reason > 0 && reason < 256) {
return strerror(reason);
}
return NULL;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return NULL;
return "unknown error";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants