File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -176,12 +176,18 @@ static void collect_memory_snapshot(void) {
176
176
char * line = NULL ;
177
177
size_t len = 0 ;
178
178
ssize_t read ;
179
+ uint64_t afl_shm_inode = 0 ;
180
+ char * afl_shm_id_str = getenv (SHM_ENV_VAR );
179
181
180
182
fp = fopen ("/proc/self/maps" , "r" );
181
183
if (fp == NULL ) {
182
184
fprintf (stderr , "[AFL] ERROR: cannot open /proc/self/maps\n" );
183
185
exit (1 );
184
186
}
187
+
188
+ if (afl_shm_id_str ) {
189
+ afl_shm_inode = atoi (afl_shm_id_str );
190
+ }
185
191
186
192
size_t memory_snapshot_allocd = 32 ;
187
193
if (!lkm_snapshot )
@@ -208,6 +214,11 @@ static void collect_memory_snapshot(void) {
208
214
if (page_check_range (h2g (min ), max - min , flags ) == -1 )
209
215
continue ;
210
216
217
+ // When `libcompcov.so` is used, the shared memory used to track coverage
218
+ // is picked up here. Obviously, we don't want to reset that, as that
219
+ // would erase coverage tracking, so we skip it.
220
+ if (afl_shm_id_str && inode == afl_shm_inode ) continue ;
221
+
211
222
if (lkm_snapshot ) {
212
223
213
224
afl_snapshot_include_vmrange ((void * )min , (void * )max );
You can’t perform that action at this time.
0 commit comments