s2n-tls icon indicating copy to clipboard operation
s2n-tls copied to clipboard

fix: fix open AF_INET sockets in s2n_self_talk_ktls_test.c

Open boquan-fang opened this issue 4 months ago • 0 comments

Resolved issues:

Partially solve #4005. Detected opened AF_INET sockets in s2n_self_talk_ktls_test.c.

Description of changes:

  • Close all AF_INET in s2n_new_inet_socket_pair. The child process exits without close all AF_INET sockets.
  • Close a file fd, that was left opened.

Call-outs:

  • This problem is detected while running the open fds check.
    • The result shows such leak in Ubuntu 22 and 24 (test results for awslc, openssl-3.0, and openssl-1.0.2).
    • Previous check on open fds were ran on Ubuntu 18, so such problem was not detected previously.
  • The test results contain opened /dev/urandom errors, because the PR to fix that problem is not yet merged.

Testing:

  • Test it locally, and all opened AF_INET sockets are closed in s2n_self_talk_ktls_test.c.
  • Test it in codebuild with the newly proposed open fds check.
  • The test for this PR is ran in a branch which has valgrind open fds check.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

boquan-fang avatar Oct 18 '24 00:10 boquan-fang