diff options
| author | van Hauser <vh@thc.org> | 2021-03-06 18:47:58 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-06 18:47:58 +0100 |
| commit | 976cb3e36c130dc31fb189e9bb4f036730fca7ee (patch) | |
| tree | 94143e3775e23597abe00b1ad9373c6c90b62632 /instrumentation/README.ctx.md | |
| parent | bd0a23de73011a390714b9f3836a46443054fdd5 (diff) | |
| parent | 9b3d8c327d33191b181219ffce411b40bdbe8902 (diff) | |
| download | afl++-976cb3e36c130dc31fb189e9bb4f036730fca7ee.tar.gz | |
Merge pull request #778 from AFLplusplus/dev
This fixes 3 different crash issues
Diffstat (limited to 'instrumentation/README.ctx.md')
| -rw-r--r-- | instrumentation/README.ctx.md | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/instrumentation/README.ctx.md b/instrumentation/README.ctx.md index caf2c09a..577b3e5f 100644 --- a/instrumentation/README.ctx.md +++ b/instrumentation/README.ctx.md @@ -4,14 +4,19 @@ This is an LLVM-based implementation of the context sensitive branch coverage. -Basically every function gets its own ID and that ID is combined with the -edges of the called functions. +Basically every function gets its own ID and, every time when an edge is logged, +all the IDs in the callstack are hashed and combined with the edge transition +hash to augment the classic edge coverage with the information about the +calling context. So if both function A and function B call a function C, the coverage collected in C will be different. In math the coverage is collected as follows: -`map[current_location_ID ^ previous_location_ID >> 1 ^ previous_callee_ID] += 1` +`map[current_location_ID ^ previous_location_ID >> 1 ^ hash_callstack_IDs] += 1` + +The callstack hash is produced XOR-ing the function IDs to avoid explosion with +recursive functions. ## Usage @@ -20,3 +25,14 @@ Set the `AFL_LLVM_INSTRUMENT=CTX` or `AFL_LLVM_CTX=1` environment variable. It is highly recommended to increase the MAP_SIZE_POW2 definition in config.h to at least 18 and maybe up to 20 for this as otherwise too many map collisions occur. + +## Caller Branch Coverage + +If the context sensitive coverage introduces too may collisions and becoming +decremental, the user can choose to augment edge coverage with just the +called function ID, instead of the entire callstack hash. + +In math the coverage is collected as follows: +`map[current_location_ID ^ previous_location_ID >> 1 ^ previous_callee_ID] += 1` + +Set the `AFL_LLVM_INSTRUMENT=CALLER` or `AFL_LLVM_CALLER=1` environment variable. |
