Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openssl: encode the value of fd (ssl->wbio->num) to gen uuid, rather than an unexpected random number #494

Merged
merged 1 commit into from Mar 3, 2024

Conversation

wuyexkx
Copy link

@wuyexkx wuyexkx commented Feb 28, 2024

make the format of uuid consistent with SSL_read, get the fd rather than a random value

@cfc4n cfc4n added the wontfix This will not be worked on label Feb 28, 2024
@cfc4n
Copy link
Member

cfc4n commented Feb 28, 2024

Please provide a detailed description of the functionality of this PR. Also, read the code carefully to ensure that you are familiar enough with the modified code and understand its purpose.

@cfc4n
Copy link
Member

cfc4n commented Mar 2, 2024

hello @wuyexkx

@wuyexkx wuyexkx changed the title openssl: use the value of wbio->fd to gen uuid openssl: use the value of ssl->wbio->num to encode uuid, rather than an unexpected random number Mar 2, 2024
@wuyexkx
Copy link
Author

wuyexkx commented Mar 2, 2024

Please provide a detailed description of the functionality of this PR. Also, read the code carefully to ensure that you are familiar enough with the modified code and understand its purpose.

the format related to uuid is: fmt.Sprintf("%d_%d_%s_%d_%d", se.Pid, se.Tid, CToGoString(se.Comm[:]), se.Fd, se.DataType), example:
tls_2024/03/03 00:46:22 UUID:1114108_1114108_https_example_4_0 ...
tls_2024/03/03 00:50:10 UUID:1114108_1114108_https_example_1456828997_1 ...
tls_2024/03/03 00:50:48 UUID:1117935_1117935_https_example_9253395096_1 ...

// https://github.com/openssl/openssl/blob/OpenSSL_1_1_1-stable/ssl/ssl_local.h#L1083
struct ssl_st {
...
/* used by SSL_write */
BIO *wbio;
...
}

we want to get value of the fd (ssl->wbio->num) from the first arg of SSL_write(SSL *ssl, ...) to encode uuid,
wbio is a pointer, (ssl + SSL_ST_WBIO) is position of this pointer, ssl->wbio == *(ssl + SSL_ST_WBIO), != (ssl + SSL_ST_WBIO),
so ssl->wbio->num == ((ssl + SSL_ST_WBIO) + BIO_ST_NUM).
could refer to SSL_read(SSL *ssl, ...), its correct.

make the uuid of SSL_write have the same format as the uuid of SSL_read

Signed-off-by: wuyexkx <ggstarthh@gmail.com>
@wuyexkx wuyexkx changed the title openssl: use the value of ssl->wbio->num to encode uuid, rather than an unexpected random number openssl: encode the value of fd (ssl->wbio->num) to gen uuid, rather than an unexpected random number Mar 2, 2024
@cfc4n
Copy link
Member

cfc4n commented Mar 3, 2024

OK, I understand what you mean. However, I have a question.

tls_2024/03/03 00:46:22 UUID:1114108_1114108_https_example_4_0 ...
tls_2024/03/03 00:50:10 UUID:1114108_1114108_https_example_1456828997_1 ...
tls_2024/03/03 00:50:48 UUID:1117935_1117935_https_example_9253395096_1 ...

Why is the FD correct in https_example_4_0 in these logs?

Please also provide a description of how to reproduce it.

Copy link
Member

@cfc4n cfc4n left a comment

Choose a reason for hiding this comment

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

I reproduced it.

LGTM, Thanks.

@cfc4n cfc4n added bug Something isn't working fix bug fix PR good first issue Good for newcomers and removed wontfix This will not be worked on labels Mar 3, 2024
@cfc4n cfc4n merged commit df17751 into gojue:master Mar 3, 2024
6 checks passed
@wuyexkx
Copy link
Author

wuyexkx commented Mar 3, 2024

I reproduced it.

LGTM, Thanks.

OK, 3Q very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fix bug fix PR good first issue Good for newcomers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants