Skip to content

Commit

Permalink
revert: unintentional changes to files from #1665
Browse files Browse the repository at this point in the history
  • Loading branch information
lidatong committed May 7, 2024
1 parent 40de401 commit 636a4af
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 20 deletions.
17 changes: 17 additions & 0 deletions src/app/fdctl/run/tiles/fd_sign.c
Original file line number Diff line number Diff line change
Expand Up @@ -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() );
Expand Down
40 changes: 20 additions & 20 deletions src/disco/tvu/fd_replay.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down

0 comments on commit 636a4af

Please sign in to comment.