Skip to content

RECORD_LAYER_write_pending inconsistent result #21461

Closed as not planned
Closed as not planned

Description

@bernd-edlinger

I ran into this because I was curious why sometimes
empty SSL-write are happening in non-ktls sockets,
I try this with openssl-3.1.1:

diff --git a/ssl/record/rec_layer_s3.c b/ssl/record/rec_layer_s3.c
index 3baf820..d306fc1 100644
--- a/ssl/record/rec_layer_s3.c
+++ b/ssl/record/rec_layer_s3.c
@@ -1145,6 +1145,8 @@ int do_ssl3_write(SSL *s, int type, const unsigned char *buf,
     s->rlayer.wpend_type = type;
     s->rlayer.wpend_ret = totlen;
 
+    if (!RECORD_LAYER_write_pending(&s->rlayer))
+        printf("### NO WRITE PENDING ###\n");
     /* we now just need to write the buffer */
     return ssl3_write_pending(s, type, buf, totlen, written);
  err:
@@ -1194,6 +1196,9 @@ int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, size_
                     return i;
                 BIO_set_ktls_ctrl_msg(s->wbio, type);
             }
+            if (!BIO_get_ktls_send(s->wbio)
+                    && SSL3_BUFFER_get_left(&wb[currbuf]) == 0)
+                printf("### EMPTY WRITE ###\n");
             i = BIO_write(s->wbio, (char *)
                           &(SSL3_BUFFER_get_buf(&wb[currbuf])
                             [SSL3_BUFFER_get_offset(&wb[currbuf])]),

and make test TESTS=test_sslapi V=1 shows this

        # Subtest: test_pipelining
        1..6
        ok 460 - iteration 1
        ok 461 - iteration 2
        ok 462 - iteration 3
        ok 463 - iteration 4
### NO WRITE PENDING ###
### EMPTY WRITE ###
        ok 464 - iteration 5
        ok 465 - iteration 6
    ok 86 - test_pipelining

while empty write requests are mostly harmless,
a wrong result of RECORD_LAYER_write_pending is it not.

Activity

  1. added
    issue: bug report
    on Jul 14, 2023
  2. added a commit that references this issue on Jul 16, 2023
    656d63e
  3. added
    branch: master
    triaged: bug
    branch: 3.0
    branch: 3.1
    and removed
    issue: bug report
    on Jul 18, 2023
  4. added 2 commits that reference this issue on Jul 19, 2023
    9e49615
    976c613
  5. added a commit that references this issue on Aug 1, 2023
    2b2ecd2
  6. added 2 commits that reference this issue on Aug 19, 2023
    8cc8932
    d599731
  7. added a commit that references this issue on Sep 12, 2023
    3e9d31d
  8. added
    branch: 3.2
    on Oct 26, 2023
  9. nhorman commented on Jun 6, 2024

    @nhorman
    Contributor

    Marking as inactive, to be closed at the end of the 3.4 dev cycle, barring further updates.

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

Metadata

Metadata

Assignees

Labels

branch: 3.0branch: 3.1branch: 3.2branch: mastertriaged: bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions