diff --git a/src/util/scratch/fd_scratch.h b/src/util/scratch/fd_scratch.h index 6af93c3087..eac6d6362a 100644 --- a/src/util/scratch/fd_scratch.h +++ b/src/util/scratch/fd_scratch.h @@ -179,12 +179,13 @@ fd_scratch_attach( void * smem, fd_scratch_private_frame_max = depth; # if FD_HAS_DEEPASAN - /* Poison the entire smem region. Underpoison the boundaries to respect + /* Poison the entire smem region. Underpoison the boundaries to respect alignment requirements. */ ulong aligned_start = fd_ulong_align_up( fd_scratch_private_start, FD_ASAN_ALIGN ); ulong aligned_end = fd_ulong_align_dn( fd_scratch_private_stop, FD_ASAN_ALIGN ); fd_asan_poison( (void*)aligned_start, aligned_end - aligned_start ); # endif + fd_msan_poison( (void*)fd_scratch_private_start, fd_scratch_private_stop - fd_scratch_private_start ); } /* fd_scratch_detach detaches the calling thread from its current @@ -278,6 +279,7 @@ fd_scratch_reset( void ) { ulong aligned_stop = fd_ulong_align_dn( fd_scratch_private_stop, FD_ASAN_ALIGN ); fd_asan_poison( (void*)aligned_start, aligned_stop - aligned_start ); # endif + fd_msan_poison( (void*)fd_scratch_private_start, fd_scratch_private_stop - fd_scratch_private_start ); } /* fd_scratch_push creates a new scratch frame and makes it the current @@ -304,7 +306,7 @@ fd_scratch_push( void ) { ulong aligned_start = fd_ulong_align_up( fd_scratch_private_free, FD_ASAN_ALIGN ); ulong aligned_stop = fd_ulong_align_dn( fd_scratch_private_stop, FD_ASAN_ALIGN ); fd_asan_poison( (void*)aligned_start, aligned_stop - aligned_start ); -# endif +# endif } /* fd_scratch_pop frees all allocations in the current scratch frame, @@ -324,7 +326,9 @@ fd_scratch_pop( void ) { if( FD_UNLIKELY( !fd_scratch_private_frame_cnt ) ) FD_LOG_ERR(( "unmatched pop" )); fd_scratch_in_prepare = 0; # endif + ulong old_free = fd_scratch_private_free; fd_scratch_private_free = fd_scratch_private_frame[ --fd_scratch_private_frame_cnt ]; + fd_msan_poison( (void *)old_free, fd_scratch_private_free - old_free ); # if FD_HAS_DEEPASAN /* On a pop() operation, the entire range from fd_scratch_private_free to the @@ -411,7 +415,7 @@ fd_scratch_prepare( ulong align ) { always going to be at least 8 byte aligned. */ ulong aligned_sz = fd_ulong_align_up( fd_scratch_private_stop - smem, FD_ASAN_ALIGN ); fd_asan_unpoison( (void*)smem, aligned_sz ); -# endif +# endif fd_scratch_private_free = smem; return (void *)smem; @@ -433,7 +437,7 @@ fd_scratch_publish( void * _end ) { /* Poison everything that is trimmed off. Conservatively poison potentially less than the region that is trimmed to respect alignment requirements. */ ulong aligned_end = fd_ulong_align_up( end, FD_ASAN_ALIGN ); - ulong aligned_stop = fd_ulong_align_dn( fd_scratch_private_stop, FD_ASAN_ALIGN ); + ulong aligned_stop = fd_ulong_align_dn( fd_scratch_private_stop, FD_ASAN_ALIGN ); fd_asan_poison( (void*)aligned_end, aligned_stop - aligned_end ); # endif diff --git a/src/util/wksp/fd_wksp_user.c b/src/util/wksp/fd_wksp_user.c index 6e15c93a36..a5a69e1efc 100644 --- a/src/util/wksp/fd_wksp_user.c +++ b/src/util/wksp/fd_wksp_user.c @@ -182,6 +182,7 @@ fd_wksp_private_free( ulong i, /* Partition to free, /* Poison the data region of the now freed allocation. */ fd_asan_poison( fd_wksp_laddr_fast( wksp, pinfo[ i ].gaddr_lo ), pinfo[ i ].gaddr_hi - pinfo[ i ].gaddr_lo ); # endif + fd_msan_poison( fd_wksp_laddr_fast( wksp, pinfo[ i ].gaddr_lo ), pinfo[ i ].gaddr_hi - pinfo[ i ].gaddr_lo ); } /* user APIs **********************************************************/ @@ -334,6 +335,7 @@ fd_wksp_alloc_at_least( fd_wksp_t * wksp, /* Unpoison the data region of the allocation */ fd_asan_unpoison( fd_wksp_laddr_fast( wksp, lo ), hi - lo ); # endif + fd_msan_unpoison( fd_wksp_laddr_fast( wksp, lo ), hi - lo ); fd_wksp_private_unlock( wksp ); *_lo = lo;