Pipelined State Machine Corruption
a year ago
- #protocols
- #pipelining
- #networking
- Text protocols (CRLF protocols) involve sending a line of text to a server and receiving a response.
- Pipelining allows clients to send multiple requests without waiting for individual responses, but support varies by protocol (e.g., NNTP requires it, HTTP 1.1 defines it but support is dead, SMTP offers it as an option but warns against it due to server bugs).
- A simple server unaware of pipelining might read one request at a time, but issues arise if the server relies on implicit state to drive its state machine, leading to potential corruption.
- Example scenario: A server using 'select' for IO multiplexing might incorrectly process pipelined commands (e.g., MAIL FROM and RCPT TO) if it assumes commands arrive one at a time, leading to state machine corruption.
- RFC 2920 highlights risks like stdio buffer issues (e.g., data loss when exec'ing a helper process) and deadlocks if responses aren't read while pipelining requests.