Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 79731ca4787f003f4deee643b53c3e35cfa64b80a06eb51a8948e3b12a6cfb3c
Ticket: 75d525d37c931812e9b00a80f6f43ac062598d54
Memory corruption transferring server (listening) sockets between threads
User & Date: apnadkarni on 2020-01-31 12:23:59
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-fossil-wiki"
  4. comment changed to:
    Working on a generic IOCP framework for Windows, I noticed the following issue while trying to grok the Windows socket code. Note it appears the same issue will also exist on Unix.
    
    The socket implementation stores the user supplied script argument to [socket -server] in the AcceptCallback structure along with a pointer to the current interp. If the socket is then transferred to a different thread using thread::transfer, when a connection comes in the callback is run in the context of the owning thread but using the original interp belonging to the original thread with obviously catastrophic results.
    
    There needs to be mechanism to either switch the interp stored in the AcceptCallback structure to the appropriate one in the receiving thread (this seems hard to me given the current implementation), or disallow transfer of server sockets.
    
    I'll try to provide a proof script later.
    
  5. foundin changed to: "8.6.10"
  6. is_private changed to: "0"
  7. login: "apnadkarni"
  8. priority changed to: "5 Medium"
  9. resolution changed to: "None"
  10. severity changed to: "Minor"
  11. status changed to: "Open"
  12. submitter changed to: "apnadkarni"
  13. subsystem changed to: "25. Channel System"
  14. title changed to:
    Memory corruption transferring server (listening) sockets between threads
    
  15. type changed to: "Bug"