Skip to content

Verify atomic close-on-exec for Redis writer connections #1317

Backlog

Description

@ashutosh-agrawal

swss-common currently sets FD_CLOEXEC after hiredis connects and before sending AUTH. That leaves a window between socket creation and fcntl(). A concurrent fork in that window can give a child a copy of the descriptor without the flag. Setting it in the parent afterward cannot change the child's copy.

Debian Trixie's hiredis 1.2.0-6 creates Unix and TCP sockets without SOCK_CLOEXEC. The buildimage draft adds the flag at socket creation for Trixie while keeping the existing hiredis ABI. Upstream hiredis added opt-in close-on-exec after the 1.2.0 release. A follow-up PR addresses a collision between the close-on-exec and address-reuse flags.

swss-common follow-up

Once the patched package is available, verify that protected writer connections already have FD_CLOEXEC before AUTH. Coordinate the check with package delivery so existing callers on stock packages keep their current behavior. Cover new connections, copies, worker connections, and reconnects. Confirm on the installed image that the socket is closed across child exec.

References

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions