We observed a new form of cache corruption at Intel
which was caused by a _run_tool command line longer
than 2^15 bytes.
_run_tool command lines get sent to the cache server as
the "sourceFunc" annotation when adding a cache entry.
This is recorded to make it possible for someone
looking into the cache's contents to map a primary key
back to what created the cache entry. This text string
is written (and read) with the functions in
src/common/TextIO.C (in
/vesta/vestasys.org/vesta/cache). This uses 16-bit
integers to record the length and fails to check for an
overflow.
This caused failures when trying to re-write on-disk
PKFiles and wrote a corrupt entry to the cache log.
The first problem caused the cache server to die
several times, and the the second problem eventually
caused a failure on startup.
I've checked in a quick stop-gap fix as:
/vesta/vestasys.org/vesta/cache/47
This simply switches to unsigned 16-bit integers
(doubling the headroom) and adds an assert which will
cause an immediate failure if we overflow that. While
not ideal, this will at least prevent writing corrupt
data to disk.
Note that the title reads "cache abort", which
represents the situation as of cache/47. (Without that
fix, it really would result in a corrupt cache.)