Skip to content

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

@stevenengler

Description

@stevenengler

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().

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugError or flaw producing unexpected results

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions