diff options
author | ea <ea@users.noreply.github.com> | 2024-10-02 13:08:24 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-02 13:08:24 -0500 |
commit | 994ac558787cc10512854b85115e7f5e5e268513 (patch) | |
tree | f71d383c3b096858bd91a793e99f9dc6c5627be1 /docs/env_variables.md | |
parent | d21fb1a558b25c4f46692fa999c0028dfe0eecc0 (diff) | |
download | afl++-994ac558787cc10512854b85115e7f5e5e268513.tar.gz |
Fix uninitialized alloc_canary in libdislocator
When random alloc_canary env var option was introduced, a possibility for use of uninitialized alloc_canary value was made. In most cases, constructor will be called during shared library load and the alloc_canary would be initialized to either its default value or a randomly generated one if forced by AFL_RANDOM_ALLOC_CANARY env var. However, in some cases, libraries loaded before libdislocator will make allocations (still using libdislocator's allocation functions) while alloc_canary is still uninitialized. In such cases, canary value is usually NULL. If such allocated value is then free()'d after libdislocator's constructor has been run, call to free() will fail causing a false positive. This condition usually happens while calling library destructors at process termination. The patch ensures the canary value is initialized in all cases, and introduces a destructor that reverts it to default value. This does mean that certain number of early allocations will use the default canary value rather than the random one set afterwards. This seems like a reasonable tradeoff as I haven't found a surefire way of forcing libdislocator's constructor to run first in all possible cases (if nothing else, libphtread usually has priority).
Diffstat (limited to 'docs/env_variables.md')
0 files changed, 0 insertions, 0 deletions