The feature suggested by Julian Andres Klode sounds like a good fix for this, invalidating the cache if one of those values (magics or sizes) in header or footer are incorrect. However, I'm wondering, how does invalid cache lead to a segmentation fault? Are memory locations or even binary instructions saved to the cache, or are the values simply used without checking them? I know that this is a cache, but wouldn't some extra checks cost only a little bit of performance when related to this and many related crashes being fixed?
The feature suggested by Julian Andres Klode sounds like a good fix for this, invalidating the cache if one of those values (magics or sizes) in header or footer are incorrect. However, I'm wondering, how does invalid cache lead to a segmentation fault? Are memory locations or even binary instructions saved to the cache, or are the values simply used without checking them? I know that this is a cache, but wouldn't some extra checks cost only a little bit of performance when related to this and many related crashes being fixed?