[PATCH] D30101: [asan] Implement "scribble" flag, which overwrites free'd memory with 0x55
Filipe Cabecinhas via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 21 07:12:48 PST 2017
filcab added inline comments.
================
Comment at: lib/asan/asan_allocator.cc:533
+ uptr size_to_scribble = m->UsedSize() - kChunkHeader2Size;
+ size_to_scribble = Min(size_to_scribble, (uptr)fl.max_malloc_fill_size);
+ REAL(memset)((void *)scribble_start_ptr, 0x55, size_to_scribble);
----------------
If you're re-using `max_malloc_fill_size`, please add to its description that it's also used for scribbling after deallocation.
Otherwise, having different flags for the deallocation scribbling looks good too.
================
Comment at: lib/asan/asan_flags.inc:147
+ASAN_FLAG(bool, scribble, false,
+ "On free(), set each byte of released memory to 0x55.")
ASAN_FLAG(bool, halt_on_error, true,
----------------
`"On deallocation..."`? Since we also set it for `delete`/`delete[]`
I think the current phrasing is understandable, but seems better to phrase it more generally.
https://reviews.llvm.org/D30101
More information about the llvm-commits
mailing list