diff --git a/src/app/fdctl/run/tiles/fd_sign.c b/src/app/fdctl/run/tiles/fd_sign.c index 12fdc5b603..c5fec7be89 100644 --- a/src/app/fdctl/run/tiles/fd_sign.c +++ b/src/app/fdctl/run/tiles/fd_sign.c @@ -171,6 +171,23 @@ privileged_init( fd_topo_t * topo, ctx->private_key = identity_key; ctx->public_key = identity_key + 32UL; + /* The stack can be taken over and reorganized by under AddressSanitizer, + which causes this code to fail. */ +#if FD_HAS_ASAN + FD_LOG_WARNING(( "!!! SECURITY WARNING !!! YOU ARE RUNNING THE SIGNING TILE " + "WITH ADDRESS SANITIZER ENABLED. THIS CAN LEAK SENSITIVE " + "DATA INCLUDING YOUR PRIVATE KEYS INTO CORE DUMPS IF THIS " + "PROCESS ABORTS. IT IS HIGHLY ADVISED TO NOT TO RUN IN THIS " + "MODE IN PRODUCTION!" )); +#else + /* Prevent the stack from showing up in core dumps just in case the + private key somehow ends up in there. */ + FD_TEST( fd_tile_stack0() ); + FD_TEST( fd_tile_stack_sz() ); + if( FD_UNLIKELY( madvise( (void*)fd_tile_stack0(), fd_tile_stack_sz(), MADV_DONTDUMP ) ) ) + FD_LOG_ERR(( "madvise failed (%i-%s)", errno, fd_io_strerror( errno ) )); +#endif + /* Prevent the stack from showing up in core dumps just in case the private key somehow ends up in there. */ FD_TEST( fd_tile_stack0() ); diff --git a/src/disco/tvu/fd_replay.c b/src/disco/tvu/fd_replay.c index 95507ba2e1..1e47329443 100644 --- a/src/disco/tvu/fd_replay.c +++ b/src/disco/tvu/fd_replay.c @@ -390,26 +390,26 @@ fd_replay_slot_execute( fd_replay_t * replay, fork->head->bank_hash = *bank_hash; FD_LOG_NOTICE( ( "bank hash: %32J", bank_hash->hash ) ); - // fd_bank_hash_cmp_t * bank_hash_cmp = fd_exec_epoch_ctx_bank_hash_cmp( child->slot_ctx.epoch_ctx ); - // fd_bank_hash_cmp_lock( bank_hash_cmp ); - // fd_bank_hash_cmp_insert( bank_hash_cmp, slot, bank_hash, 1 ); - - // /* Try to move the bank hash comparison window forward */ - // while (1) { - // ulong *children, nchildren, parent_slot = bank_hash_cmp->slot; - // if ( fd_blockstore_next_slot_query( replay->blockstore, parent_slot, &children, &nchildren ) == FD_BLOCKSTORE_OK ) { - // for (ulong i = 0; i < nchildren; i++) { - // if( FD_LIKELY( fd_bank_hash_cmp_check( bank_hash_cmp, children[i] ) ) ) { - // bank_hash_cmp->slot = children[i]; - // break; - // } - // } - // } else { - // FD_LOG_WARNING( ("failed at getting children of slot %lu", parent_slot) ); - // } - // if(bank_hash_cmp->slot == parent_slot) break; - // } - // fd_bank_hash_cmp_unlock( bank_hash_cmp ); + fd_bank_hash_cmp_t * bank_hash_cmp = fd_exec_epoch_ctx_bank_hash_cmp( child->slot_ctx.epoch_ctx ); + fd_bank_hash_cmp_lock( bank_hash_cmp ); + fd_bank_hash_cmp_insert( bank_hash_cmp, slot, bank_hash, 1 ); + + /* Try to move the bank hash comparison window forward */ + while (1) { + ulong *children, nchildren, parent_slot = bank_hash_cmp->slot; + if ( fd_blockstore_next_slot_query( replay->blockstore, parent_slot, &children, &nchildren ) == FD_BLOCKSTORE_OK ) { + for (ulong i = 0; i < nchildren; i++) { + if( FD_LIKELY( fd_bank_hash_cmp_check( bank_hash_cmp, children[i] ) ) ) { + bank_hash_cmp->slot = children[i]; + break; + } + } + } else { + FD_LOG_WARNING( ("failed at getting children of slot %lu", parent_slot) ); + } + if(bank_hash_cmp->slot == parent_slot) break; + } + fd_bank_hash_cmp_unlock( bank_hash_cmp ); // fd_bft_fork_update( replay->bft, child ); // fd_bft_fork_choice( replay->bft );