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

Incoming TCP connections should not be added to the descriptor table until they're accept()ed #1780

Open
stevenengler opened this issue Nov 19, 2021 · 0 comments
Labels
Type: Bug Error or flaw producing unexpected results

Comments

@stevenengler
Copy link
Contributor

When a listening socket receives a SYN packet, it immediately registers a new socket in the descriptor table.

switch(tcp->state) {
case TCPS_LISTEN: {
/* receive SYN, send SYNACK, move to SYNRECEIVED */
if(header->flags & PTCP_SYN) {
MAGIC_ASSERT(tcp->server);
flags |= TCP_PF_PROCESSED;
/* we need to multiplex a new child */
guint64 recvBufSize = host_getConfiguredRecvBufSize(host);
guint64 sendBufSize = host_getConfiguredSendBufSize(host);
TCP* multiplexed = tcp_new(host, recvBufSize, sendBufSize);
process_registerLegacyDescriptor(
descriptor_getOwnerProcess((LegacyDescriptor*)tcp),
(LegacyDescriptor*)multiplexed);

Shadow should wait and only register the socket in the descriptor table once the user space process calls accept().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Error or flaw producing unexpected results
Projects
None yet
Development

No branches or pull requests

1 participant