Skip to content

Conversation

@joe-redpanda
Copy link

Adds assert to the on-ramps to net::packet UB.
This commit changes posix_data_sink_impl to guard against concurrency problems by asserting that its contained net::packet is null before accepting another.

changes:
net_packet now initialized as a null packet instead of a default packet added assert to put(net::packet) that checks the contained packet is null
write_all can throw, change the packet reset to occur regardless of exceptions

Adds assert to the on-ramps to net::packet UB.
This commit changes posix_data_sink_impl to guard against concurrency
problems by asserting that its contained net::packet is null before
accepting another.

changes:
net_packet now initialized as a null packet instead of a default packet
added assert to put(net::packet) that checks the contained packet is
null
write_all can throw, change the packet reset to occur regardless of
exceptions
Copilot AI review requested due to automatic review settings November 19, 2025 18:51
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses potential concurrency issues in posix_data_sink_impl by adding safeguards to prevent misuse of the internal net::packet member. The changes ensure that the packet member is properly initialized and not overwritten while in use.

Key Changes:

  • Added assertion to verify packet state before accepting new data
  • Changed packet initialization from default to explicit null packet
  • Improved exception safety by using finally instead of then for cleanup

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
include/seastar/net/posix-stack.hh Initializes _p member as null packet to ensure proper initial state
src/net/posix-stack.cc Adds assertion to guard against concurrent packet writes and improves cleanup exception safety

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@joe-redpanda
Copy link
Author

Attempting to upstream instead

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants