Overview
| Artifact ID: | 3f9364b0dcefbdb0f917c4babe1c6d571f019e60 |
|---|---|
| Ticket: | 2184717fffffffffffffffffffffffffffffffff
unaligned malloc() -> Tcl panic |
| User & Date: | dgp on 2008-10-21 15:28:14 |
Changes
- assignee changed to: "hobbs"
- cmimetype changed to: "text/plain"
- comment changed to:
Testing memory hygiene in a program that embeds Tcl on an x86_64 system with ElectricFence, we encountered panics in the Tcl library. The problem boils down to this. Tcl's Tcl_Alloc() routine (and the ckalloc() form) is documented to return a pointer aligned for any purpose. Some of the Tcl source code is written assuming this to be true. Unfortunately, when malloc() returns a pointer that is misaligned for some purposes (notably for holding a pointer value), the TclpAlloc() implementation in tclThreadAlloc.c propagates that misalignment up to the pointer returned by ckalloc() leading to panics in the code that assumes this cannot happen. Misaligned malloc() returns is one of the hazards introduced by ElectricFence testing. Since Tcl_Alloc() is documented to return an aligned pointer, and it cannot always be assumed that malloc() will cooperate, it would make Tcl more robust, and more useful for testing in partnership with ElectricFence, if the allocator in tclThreadAlloc.c included safeguards to prevent misalignment from bubbling up from below.
- foundin changed to: "obsolete: 8.5.5"
- is_private changed to: "0"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "dgp"
- subsystem changed to: "41. Memory Allocation"
- title changed to: "unaligned malloc() -> Tcl panic"
- type changed to: "Bug"