Conversation
Greptile SummaryThe PR adds serialization and restoration of supported OpenSTA sessions through
Confidence Score: 0/5The PR is not safe to merge because crafted StaDB files can still terminate OpenSTA through oversized allocations, and a failed restore still destroys the active session. The new 64 GiB section and 512 GiB file caps still allow infeasible attacker-controlled vector allocations, while Files Needing Attention: stadb/StaDbFormat.hh, stadb/StaDbFile.cc, and stadb/StaDbReader.cc
|
| Filename | Overview |
|---|---|
| stadb/StaDbFormat.hh | Introduces allocation caps, but 64 GiB per section and 512 GiB per file remain large enough for the previously reported memory-exhaustion paths. |
| stadb/StaDbFile.cc | Adds pre-allocation checks, but accepted attacker-controlled sizes still flow directly into potentially infeasible vector allocations. |
| stadb/StaDbReader.cc | Adds cleanup for failed in-place restores, but still destroys the previous session and leaves the caller with an empty one. |
| stadb/StaDbGraph.cc | Restores graph, levelization, delay, and period-check state; malformed collection counts also reinforce the need for effective aggregate resource limits. |
| stadb/StaDbWriter.cc | Coordinates deterministic serialization of supported session sections and rejects unsupported session configurations. |
Sequence Diagram
sequenceDiagram
participant Tcl as read_sta_db
participant File as DbFileReader
participant STA as Active Sta
participant Restore as Section decoders
Tcl->>File: read and validate container
File-->>Tcl: validated sections
Tcl->>STA: clearSession()
Tcl->>Restore: restore Liberty/network/graph/SDC/search
alt restore succeeds
Restore-->>Tcl: restored session
else section decoding throws
Restore-->>Tcl: exception
Tcl->>STA: clearSession()
Tcl-->>Tcl: rethrow with empty session
end
Reviews (3): Last reviewed commit: "File safety + sta docs" | Re-trigger Greptile
This PR adds StaDBs, which are serialized STA sessions. They can be written with write_sta_db and read with read_sta_db. Reading an StaDB session will clear state before restoring the serialized session.
Rewrites after restore are byte-idempotent; as such, some data structures need to be sorted before serialization.
StaDBs are considered valid across builds of OpenSTA with the same stadb_version and stadbAbiGuard(), which is a hash of sizeof for Vertex, Edge, Liberty, etc. Not shareable across libc++/libstdc++ builds due to various
sizeofdifferences.Covered in serialization
Liberties (NLDM), SDC, Netlists, Graph and search (e.g. report_checks)
Not covered in serialization (out of scope)
Parasitics (SPEF) are omitted, MCMM (i.e. anything >1 Scene throws), CCS is dropped, statistical throws
Open questions: