Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 93c7bf9b8d2a04f0d378dc801c903c95e442891884f637f366b9b3b873e624e0
Ticket: e2698b94b151aecf275b3dd2c5d605b89022684e
Tcl_FSChdir crashes after seteuid
User & Date: jmroot on 2026-04-14 23:48:01
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-fossil-plain"
  4. comment changed to:
    Tcl_FSChdir can trigger thousands of levels of recursion and finally crash in some circumstances. The attached reproducer will crash when run as root from a directory that is inaccessible to 'nobody'. It's as minimal as I could get it; removing either of the Tcl_FSGetCwd calls seems to avoid the crash.
    
    This was discovered in MacPorts, where the issue can easily be triggered by the user running 'sudo port ...' from their home directory (since it is typically not accessible to the account used for dropping privileges). The crash happens when it calls pwd and cd at the script level: [https://github.com/macports/macports-base/blob/master/src/port1.0/portutil.tcl#L1419]
    
    I'm also attaching the crash log generated by running the reproduction program when linked with Tcl built with debug information and clang sanitizers (hence the weird stuff at the top of the stack trace).
    
  5. foundin changed to: "9.0.3"
  6. is_private changed to: "0"
  7. login: "jmroot"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "76145175b6ffee50eff3d492ff299da342ff102d"
  10. resolution changed to: "None"
  11. severity changed to: "Severe"
  12. status changed to: "Open"
  13. submitter changed to: "jmroot"
  14. subsystem changed to: "36. Pathname Management"
  15. title changed to: "Tcl_FSChdir crashes after seteuid"
  16. type changed to: "Bug"