openssl/openssl

Solaris build is lacking -pthread causing socket errors

Open

#23,891 建立於 2024年3月20日

在 GitHub 查看
 (9 留言) (0 反應) (0 負責人)C (11,262 fork)batch import
help wantedtriaged: bug

倉庫指標

Star
 (30,157 star)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

Hi,

It seems that on SPARC Solaris OpenSSL 3.2.1 is now built w/o -pthread option when using gcc, due to this commit:

https://github.com/openssl/openssl/commit/f5b06306b7727f830407c639f8a7bf1698f8aaa5

This creates the unfortunate problem that if sock_read() in bss_sock.c hits an EAGAIN error in a non-blocking socket and subsequently calls BIO_sock_should_retry() and get_last_socket_error(), it queries errno variable, which (w/o a proper -pthread option) is defined in the system headers as just extern int errno; describing the main thread's last system call error code instead of an extern int * ___errno(); returning last system call error code of the current thread.

This makes SSL connection fail when using non-blocking sockets from spawned threads because get_last_socket_error() doesn't return a proper EAGAIN to caller, it returns whatever last error happened in the main thread, often merely a 0.

When -pthread is put back into 10-main.conf, things start working fine.

Please look into this.

貢獻者指南