diff --git a/src/ballet/sbpf/fd_sbpf_loader.c b/src/ballet/sbpf/fd_sbpf_loader.c index bef497bc5c..b36f1bee1c 100644 --- a/src/ballet/sbpf/fd_sbpf_loader.c +++ b/src/ballet/sbpf/fd_sbpf_loader.c @@ -90,6 +90,7 @@ _fd_int_store_if_negative( int * p, static int fd_sbpf_check_ehdr( fd_elf64_ehdr const * ehdr, ulong elf_sz, + uint min_version, uint max_version ) { /* Validate ELF magic */ @@ -114,6 +115,7 @@ fd_sbpf_check_ehdr( fd_elf64_ehdr const * ehdr, & ( ehdr->e_phentsize==sizeof(fd_elf64_phdr) ) & ( ehdr->e_shentsize==sizeof(fd_elf64_shdr) ) & ( ehdr->e_shstrndx < ehdr->e_shnum ) + & ( ehdr->e_flags >= min_version ) & ( max_version ? ( ehdr->e_flags <= max_version ) : ( ehdr->e_flags != FD_ELF_EF_SBPF_V2 ) @@ -482,6 +484,7 @@ fd_sbpf_elf_peek( fd_sbpf_elf_info_t * info, void const * bin, ulong elf_sz, int elf_deploy_checks, + uint sbpf_min_version, uint sbpf_max_version ) { /* ELFs must have a file header */ @@ -515,7 +518,7 @@ fd_sbpf_elf_peek( fd_sbpf_elf_info_t * info, int err; /* Validate file header */ - if( FD_UNLIKELY( (err=fd_sbpf_check_ehdr( &elf->ehdr, elf_sz, sbpf_max_version ))!=0 ) ) + if( FD_UNLIKELY( (err=fd_sbpf_check_ehdr( &elf->ehdr, elf_sz, sbpf_min_version, sbpf_max_version ))!=0 ) ) return NULL; /* Program headers */ diff --git a/src/ballet/sbpf/fd_sbpf_loader.h b/src/ballet/sbpf/fd_sbpf_loader.h index a464729b44..fb16490ab4 100644 --- a/src/ballet/sbpf/fd_sbpf_loader.h +++ b/src/ballet/sbpf/fd_sbpf_loader.h @@ -22,7 +22,6 @@ #define FD_SBPF_V1 (1UL) #define FD_SBPF_V2 (2UL) #define FD_SBPF_V3 (3UL) -#define FD_SBPF_MAX_VERSION FD_SBPF_V0 /* Program struct *****************************************************/ @@ -159,14 +158,15 @@ FD_PROTOTYPES_BEGIN impossible to retroactively enforce these checks on already deployed programs, a guard flag is used to enable these checks only when deploying programs. - sbpf_max_version: determine the max SBPF version allowed, version - is retrieved from the ELF header. See SIMD-0161. */ + sbpf_min_version, sbpf_max_version: determine the min, max SBPF version + allowed, version is retrieved from the ELF header. See SIMD-0161. */ fd_sbpf_elf_info_t * fd_sbpf_elf_peek( fd_sbpf_elf_info_t * info, void const * bin, ulong bin_sz, int elf_deploy_checks, + uint sbpf_min_version, uint sbpf_max_version ); /* fd_sbpf_program_{align,footprint} return the alignment and size diff --git a/src/ballet/sbpf/fuzz_sbpf_loader.c b/src/ballet/sbpf/fuzz_sbpf_loader.c index 032aca4454..d2616e1d44 100644 --- a/src/ballet/sbpf/fuzz_sbpf_loader.c +++ b/src/ballet/sbpf/fuzz_sbpf_loader.c @@ -34,7 +34,7 @@ LLVMFuzzerTestOneInput( uchar const * data, ulong size ) { fd_sbpf_elf_info_t info; - if( FD_UNLIKELY( !fd_sbpf_elf_peek( &info, data, size, 0, FD_SBPF_MAX_VERSION ) ) ) + if( FD_UNLIKELY( !fd_sbpf_elf_peek( &info, data, size, 0, FD_SBPF_V0, FD_SBPF_V3 ) ) ) return -1; /* Allocate objects */ diff --git a/src/ballet/sbpf/test_sbpf_elf_peek.c b/src/ballet/sbpf/test_sbpf_elf_peek.c index 5169b3e576..dbea647cf8 100644 --- a/src/ballet/sbpf/test_sbpf_elf_peek.c +++ b/src/ballet/sbpf/test_sbpf_elf_peek.c @@ -11,30 +11,48 @@ LOAD_ELF( hello_solana_program_old_sbpf_v2 ) void test_sbpf_version_default( void ) { fd_sbpf_elf_info_t info; + uint min_version = FD_SBPF_V0; uint max_version = FD_SBPF_V0; - fd_sbpf_elf_peek( &info, hello_solana_program_elf, hello_solana_program_elf_sz, /* deploy checks */ 1, max_version ); + fd_sbpf_elf_peek( &info, hello_solana_program_elf, hello_solana_program_elf_sz, /* deploy checks */ 1, min_version, max_version ); FD_TEST_CUSTOM( info.sbpf_version==FD_SBPF_V0, "hello_solana_program v0" ); - fd_sbpf_elf_peek( &info, hello_solana_program_sbpf_v2_elf, hello_solana_program_sbpf_v2_elf_sz, /* deploy checks */ 1, max_version ); + fd_sbpf_elf_peek( &info, hello_solana_program_sbpf_v2_elf, hello_solana_program_sbpf_v2_elf_sz, /* deploy checks */ 1, min_version, max_version ); FD_TEST_CUSTOM( info.sbpf_version==FD_SBPF_V0, "hello_solana_program v2 accepted as v0" ); - fd_sbpf_elf_info_t * res = fd_sbpf_elf_peek( &info, hello_solana_program_old_sbpf_v2_elf, hello_solana_program_old_sbpf_v2_elf_sz, /* deploy checks */ 1, max_version ); + fd_sbpf_elf_info_t * res = fd_sbpf_elf_peek( &info, hello_solana_program_old_sbpf_v2_elf, hello_solana_program_old_sbpf_v2_elf_sz, /* deploy checks */ 1, min_version, max_version ); FD_TEST_CUSTOM( res==NULL, "hello_solana_program (old) v2 unsupported" ); } void test_sbpf_version_from_elf_header( void ) { fd_sbpf_elf_info_t info; + uint min_version = FD_SBPF_V0; uint max_version = FD_SBPF_V2; - fd_sbpf_elf_peek( &info, hello_solana_program_elf, hello_solana_program_elf_sz, /* deploy checks */ 1, max_version ); + fd_sbpf_elf_peek( &info, hello_solana_program_elf, hello_solana_program_elf_sz, /* deploy checks */ 1, min_version, max_version ); FD_TEST_CUSTOM( info.sbpf_version==FD_SBPF_V0, "hello_solana_program v0" ); - fd_sbpf_elf_peek( &info, hello_solana_program_sbpf_v2_elf, hello_solana_program_sbpf_v2_elf_sz, /* deploy checks */ 1, max_version ); + fd_sbpf_elf_peek( &info, hello_solana_program_sbpf_v2_elf, hello_solana_program_sbpf_v2_elf_sz, /* deploy checks */ 1, min_version, max_version ); FD_TEST_CUSTOM( info.sbpf_version==FD_SBPF_V2, "hello_solana_program v2" ); - fd_sbpf_elf_info_t * res = fd_sbpf_elf_peek( &info, hello_solana_program_old_sbpf_v2_elf, hello_solana_program_old_sbpf_v2_elf_sz, /* deploy checks */ 1, max_version ); + fd_sbpf_elf_info_t * res = fd_sbpf_elf_peek( &info, hello_solana_program_old_sbpf_v2_elf, hello_solana_program_old_sbpf_v2_elf_sz, /* deploy checks */ 1, min_version, max_version ); + FD_TEST_CUSTOM( res==NULL, "hello_solana_program (old) v2 unsupported" ); +} + +void test_sbpf_version_from_elf_header_with_min( void ) { + fd_sbpf_elf_info_t info; + + uint min_version = FD_SBPF_V2; + uint max_version = FD_SBPF_V2; + + fd_sbpf_elf_info_t * res = fd_sbpf_elf_peek( &info, hello_solana_program_elf, hello_solana_program_elf_sz, /* deploy checks */ 1, min_version, max_version ); + FD_TEST_CUSTOM( res==NULL, "hello_solana_program v0" ); + + fd_sbpf_elf_peek( &info, hello_solana_program_sbpf_v2_elf, hello_solana_program_sbpf_v2_elf_sz, /* deploy checks */ 1, min_version, max_version ); + FD_TEST_CUSTOM( info.sbpf_version==FD_SBPF_V2, "hello_solana_program v2" ); + + res = fd_sbpf_elf_peek( &info, hello_solana_program_old_sbpf_v2_elf, hello_solana_program_old_sbpf_v2_elf_sz, /* deploy checks */ 1, min_version, max_version ); FD_TEST_CUSTOM( res==NULL, "hello_solana_program (old) v2 unsupported" ); } @@ -46,6 +64,7 @@ main( int argc, // testing here test_sbpf_version_default(); test_sbpf_version_from_elf_header(); + test_sbpf_version_from_elf_header_with_min(); fd_halt(); return 0; diff --git a/src/ballet/sbpf/test_sbpf_load_prog.c b/src/ballet/sbpf/test_sbpf_load_prog.c index 71802a71f5..8d5d0b2afb 100644 --- a/src/ballet/sbpf/test_sbpf_load_prog.c +++ b/src/ballet/sbpf/test_sbpf_load_prog.c @@ -63,7 +63,7 @@ main( int argc, /* Extract ELF info */ fd_sbpf_elf_info_t elf_info; - if( FD_UNLIKELY( !fd_sbpf_elf_peek( &elf_info, bin_buf, bin_sz, /* deploy checks */ 1, FD_SBPF_MAX_VERSION ) ) ) + if( FD_UNLIKELY( !fd_sbpf_elf_peek( &elf_info, bin_buf, bin_sz, /* deploy checks */ 1, FD_SBPF_V0, FD_SBPF_V3 ) ) ) FD_LOG_ERR(( "FAIL: %s", fd_sbpf_strerror() )); /* Allocate rodata segment */ diff --git a/src/ballet/sbpf/test_sbpf_loader.c b/src/ballet/sbpf/test_sbpf_loader.c index 6f6ead95bd..dbcc5df6cf 100644 --- a/src/ballet/sbpf/test_sbpf_loader.c +++ b/src/ballet/sbpf/test_sbpf_loader.c @@ -39,7 +39,7 @@ void test_duplicate_entrypoint_entry( void ) { fd_valloc_t valloc = fd_scratch_virtual(); fd_sbpf_elf_info_t info; - fd_sbpf_elf_peek( &info, duplicate_entrypoint_entry_elf, duplicate_entrypoint_entry_elf_sz, /* deploy checks */ 1, FD_SBPF_MAX_VERSION ); + fd_sbpf_elf_peek( &info, duplicate_entrypoint_entry_elf, duplicate_entrypoint_entry_elf_sz, /* deploy checks */ 1, FD_SBPF_V0, FD_SBPF_V3 ); void* rodata = fd_valloc_malloc( valloc, FD_SBPF_PROG_RODATA_ALIGN, info.rodata_footprint ); FD_TEST( rodata ); diff --git a/src/flamenco/features/fd_features_generated.c b/src/flamenco/features/fd_features_generated.c index 8489105e58..4b138f6abc 100644 --- a/src/flamenco/features/fd_features_generated.c +++ b/src/flamenco/features/fd_features_generated.c @@ -1241,6 +1241,36 @@ fd_feature_id_t const ids[] = { .name = "get_sysvar_syscall_enabled", .cleaned_up = {UINT_MAX, UINT_MAX, UINT_MAX} }, + { .index = offsetof(fd_features_t, disable_sbpf_v0_execution)>>3, + .id = {"\x07\xcd\x8f\x9c\x60\x1f\xb5\x1d\xe6\xc6\x4a\x0c\x80\xee\x74\x45\xb1\x33\x0c\x00\xc8\x85\x66\xfd\xbf\x9c\x04\xb1\x80\x00\x00\x00"}, + /* XTestFeature1111111111111111111111111111111 */ + .name = "disable_sbpf_v0_execution", + .cleaned_up = {UINT_MAX, UINT_MAX, UINT_MAX} }, + + { .index = offsetof(fd_features_t, reenable_sbpf_v0_execution)>>3, + .id = {"\x06\xd3\xed\xd5\x9d\x7c\x93\xe5\xc4\xb1\xe9\xad\x79\x2d\x34\x27\xa1\xc3\x2f\xac\xb9\xbc\x05\x2d\xe0\x6c\x4b\x91\x80\x00\x00\x00"}, + /* TestFeature21111111111111111111111111111111 */ + .name = "reenable_sbpf_v0_execution", + .cleaned_up = {UINT_MAX, UINT_MAX, UINT_MAX} }, + + { .index = offsetof(fd_features_t, enable_sbpf_v1_deployment_and_execution)>>3, + .id = {"\xff\xf3\x40\x2b\x9c\xcb\xc2\xef\x87\x25\xc8\xa9\xa3\x0d\x78\x88\xc0\xd9\xaf\xad\x60\x5e\x1a\xdf\xe8\x84\x65\xac\x59\xd5\xe4\xd5"}, + /* JE86WkYvTrzW8HgNmrHY7dFYpCmSptUpKupbo2AdQ9cG */ + .name = "enable_sbpf_v1_deployment_and_execution", + .cleaned_up = {UINT_MAX, UINT_MAX, UINT_MAX} }, + + { .index = offsetof(fd_features_t, enable_sbpf_v2_deployment_and_execution)>>3, + .id = {"\xd1\x6a\x9a\x26\x8a\x6a\x8e\x40\xcc\xea\xc9\x39\xd6\x21\x78\x58\x7e\x9e\x51\x6c\x8c\xab\x5a\xec\x85\xb1\x18\x7f\xa6\xd2\xb5\xdc"}, + /* F6UVKh1ujTEFK3en2SyAL3cdVnqko1FVEXWhmdLRu6WP */ + .name = "enable_sbpf_v2_deployment_and_execution", + .cleaned_up = {UINT_MAX, UINT_MAX, UINT_MAX} }, + + { .index = offsetof(fd_features_t, enable_sbpf_v3_deployment_and_execution)>>3, + .id = {"\xa5\x5e\x2c\x94\xda\x8b\xc0\xbe\x92\x50\x5b\xcc\xed\xd1\xab\x88\x9c\xed\xbd\xa6\xc9\x36\xa1\xf2\x60\x13\x3e\x95\xba\x9e\x4f\xf8"}, + /* C8XZNs1bfzaiT3YDeXZJ7G5swQWQv7tVzDnCxtHvnSpw */ + .name = "enable_sbpf_v3_deployment_and_execution", + .cleaned_up = {UINT_MAX, UINT_MAX, UINT_MAX} }, + { .index = ULONG_MAX } }; @@ -1457,6 +1487,11 @@ fd_feature_id_query( ulong prefix ) { case 0x81fcbfa0d0f6b105: return &ids[ 202 ]; case 0x2c38e34ff071060d: return &ids[ 203 ]; case 0x829062f252ef5ba8: return &ids[ 204 ]; + case 0x1db51f609c8fcd07: return &ids[ 205 ]; + case 0xe5937c9dd5edd306: return &ids[ 206 ]; + case 0xefc2cb9c2b40f3ff: return &ids[ 207 ]; + case 0x408e6a8a269a6ad1: return &ids[ 208 ]; + case 0xbec08bda942c5ea5: return &ids[ 209 ]; default: break; } @@ -1670,5 +1705,10 @@ FD_STATIC_ASSERT( offsetof( fd_features_t, deprecate_legacy_vote_ixs FD_STATIC_ASSERT( offsetof( fd_features_t, partitioned_epoch_rewards_superfeature )>>3==202UL, layout ); FD_STATIC_ASSERT( offsetof( fd_features_t, enable_secp256r1_precompile )>>3==203UL, layout ); FD_STATIC_ASSERT( offsetof( fd_features_t, get_sysvar_syscall_enabled )>>3==204UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, disable_sbpf_v0_execution )>>3==205UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, reenable_sbpf_v0_execution )>>3==206UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, enable_sbpf_v1_deployment_and_execution )>>3==207UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, enable_sbpf_v2_deployment_and_execution )>>3==208UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, enable_sbpf_v3_deployment_and_execution )>>3==209UL, layout ); FD_STATIC_ASSERT( sizeof( fd_features_t )>>3==FD_FEATURE_ID_CNT, layout ); diff --git a/src/flamenco/features/fd_features_generated.h b/src/flamenco/features/fd_features_generated.h index 388b19aa41..6dc17967b2 100644 --- a/src/flamenco/features/fd_features_generated.h +++ b/src/flamenco/features/fd_features_generated.h @@ -6,7 +6,7 @@ /* FEATURE_ID_CNT is the number of features in ids */ -#define FD_FEATURE_ID_CNT (205UL) +#define FD_FEATURE_ID_CNT (210UL) union fd_features { @@ -218,6 +218,11 @@ union fd_features { /* 0x81fcbfa0d0f6b105 */ ulong partitioned_epoch_rewards_superfeature; /* 0x2c38e34ff071060d */ ulong enable_secp256r1_precompile; /* 0x829062f252ef5ba8 */ ulong get_sysvar_syscall_enabled; + /* 0x1db51f609c8fcd07 */ ulong disable_sbpf_v0_execution; + /* 0xe5937c9dd5edd306 */ ulong reenable_sbpf_v0_execution; + /* 0xefc2cb9c2b40f3ff */ ulong enable_sbpf_v1_deployment_and_execution; + /* 0x408e6a8a269a6ad1 */ ulong enable_sbpf_v2_deployment_and_execution; + /* 0xbec08bda942c5ea5 */ ulong enable_sbpf_v3_deployment_and_execution; }; }; diff --git a/src/flamenco/features/feature_map.json b/src/flamenco/features/feature_map.json index 0b93675813..6a44c31477 100644 --- a/src/flamenco/features/feature_map.json +++ b/src/flamenco/features/feature_map.json @@ -203,5 +203,10 @@ {"name":"deprecate_legacy_vote_ixs","pubkey":"depVvnQ2UysGrhwdiwU42tCadZL8GcBb1i2GYhMopQv"}, {"name":"partitioned_epoch_rewards_superfeature","pubkey":"PERzQrt5gBD1XEe2c9XdFWqwgHY3mr7cYWbm5V772V8"}, {"name": "enable_secp256r1_precompile","pubkey":"sr11RdZWgbHTHxSroPALe6zgaT5A1K9LcE4nfsZS4gi"}, - {"name": "get_sysvar_syscall_enabled", "pubkey": "CLCoTADvV64PSrnR6QXty6Fwrt9Xc6EdxSJE4wLRePjq"} + {"name": "get_sysvar_syscall_enabled", "pubkey": "CLCoTADvV64PSrnR6QXty6Fwrt9Xc6EdxSJE4wLRePjq"}, + {"name": "disable_sbpf_v0_execution", "pubkey": "XTestFeature1111111111111111111111111111111","comment":"IMPORTANT: NEED REKEY"}, + {"name": "reenable_sbpf_v0_execution", "pubkey": "TestFeature21111111111111111111111111111111","comment":"for test only"}, + {"name": "enable_sbpf_v1_deployment_and_execution", "pubkey": "JE86WkYvTrzW8HgNmrHY7dFYpCmSptUpKupbo2AdQ9cG"}, + {"name": "enable_sbpf_v2_deployment_and_execution", "pubkey": "F6UVKh1ujTEFK3en2SyAL3cdVnqko1FVEXWhmdLRu6WP"}, + {"name": "enable_sbpf_v3_deployment_and_execution", "pubkey": "C8XZNs1bfzaiT3YDeXZJ7G5swQWQv7tVzDnCxtHvnSpw"} ] diff --git a/src/flamenco/runtime/program/fd_bpf_loader_program.c b/src/flamenco/runtime/program/fd_bpf_loader_program.c index 0deac9cd25..d954e39371 100644 --- a/src/flamenco/runtime/program/fd_bpf_loader_program.c +++ b/src/flamenco/runtime/program/fd_bpf_loader_program.c @@ -252,7 +252,9 @@ deploy_program( fd_exec_instr_ctx_t * instr_ctx, /* Load executable */ fd_sbpf_elf_info_t _elf_info[ 1UL ]; - fd_sbpf_elf_info_t * elf_info = fd_sbpf_elf_peek( _elf_info, programdata, programdata_size, deploy_mode, FD_SBPF_MAX_VERSION ); + uint min_sbpf_version, max_sbpf_version; + fd_bpf_get_sbpf_versions( &min_sbpf_version, &max_sbpf_version, instr_ctx->slot_ctx ); + fd_sbpf_elf_info_t * elf_info = fd_sbpf_elf_peek( _elf_info, programdata, programdata_size, deploy_mode, min_sbpf_version, max_sbpf_version ); if( FD_UNLIKELY( !elf_info ) ) { //TODO: actual log, this is a custom Firedancer msg fd_log_collector_msg_literal( instr_ctx, "Failed to load or verify Elf" ); diff --git a/src/flamenco/runtime/program/fd_bpf_program_util.c b/src/flamenco/runtime/program/fd_bpf_program_util.c index f331674035..58bff94b18 100644 --- a/src/flamenco/runtime/program/fd_bpf_program_util.c +++ b/src/flamenco/runtime/program/fd_bpf_program_util.c @@ -105,6 +105,29 @@ fd_bpf_get_executable_program_content_for_v1_v2_loaders( fd_borrowed_account_t * return 0; } +void +fd_bpf_get_sbpf_versions( uint * sbpf_min_version, + uint * sbpf_max_version, + fd_exec_slot_ctx_t const * slot_ctx ) { + int disable_v0 = FD_FEATURE_ACTIVE( slot_ctx, disable_sbpf_v0_execution ); + int reenable_v0 = FD_FEATURE_ACTIVE( slot_ctx, reenable_sbpf_v0_execution ); + int enable_v0 = !disable_v0 || reenable_v0; + int enable_v1 = FD_FEATURE_ACTIVE( slot_ctx, enable_sbpf_v1_deployment_and_execution ); + int enable_v2 = FD_FEATURE_ACTIVE( slot_ctx, enable_sbpf_v2_deployment_and_execution ); + int enable_v3 = FD_FEATURE_ACTIVE( slot_ctx, enable_sbpf_v3_deployment_and_execution ); + + *sbpf_min_version = enable_v0 ? FD_SBPF_V0 : FD_SBPF_V3; + if( enable_v3 ) { + *sbpf_max_version = FD_SBPF_V3; + } else if( enable_v2 ) { + *sbpf_max_version = FD_SBPF_V2; + } else if( enable_v1 ) { + *sbpf_max_version = FD_SBPF_V1; + } else { + *sbpf_max_version = FD_SBPF_V0; + } +} + int fd_bpf_create_bpf_program_cache_entry( fd_exec_slot_ctx_t * slot_ctx, fd_borrowed_account_t * program_acc ) { @@ -134,7 +157,9 @@ fd_bpf_create_bpf_program_cache_entry( fd_exec_slot_ctx_t * slot_ctx, } fd_sbpf_elf_info_t elf_info = {0}; - if( fd_sbpf_elf_peek( &elf_info, program_data, program_data_len, /* deploy checks */ 0, FD_SBPF_MAX_VERSION ) == NULL ) { + uint min_sbpf_version, max_sbpf_version; + fd_bpf_get_sbpf_versions( &min_sbpf_version, &max_sbpf_version, slot_ctx ); + if( fd_sbpf_elf_peek( &elf_info, program_data, program_data_len, /* deploy checks */ 0, min_sbpf_version, max_sbpf_version ) == NULL ) { FD_LOG_DEBUG(( "fd_sbpf_elf_peek() failed: %s", fd_sbpf_strerror() )); return FD_EXECUTOR_INSTR_ERR_INVALID_ACC_DATA; } diff --git a/src/flamenco/runtime/program/fd_bpf_program_util.h b/src/flamenco/runtime/program/fd_bpf_program_util.h index 24d584af80..eb98d582ea 100644 --- a/src/flamenco/runtime/program/fd_bpf_program_util.h +++ b/src/flamenco/runtime/program/fd_bpf_program_util.h @@ -68,6 +68,11 @@ fd_bpf_load_cache_entry( fd_exec_slot_ctx_t const * slot_ctx, fd_pubkey_t const * program_pubkey, fd_sbpf_validated_program_t ** valid_prog ); +void +fd_bpf_get_sbpf_versions( uint * sbpf_min_version, + uint * sbpf_max_version, + fd_exec_slot_ctx_t const * slot_ctx ); + FD_PROTOTYPES_END #endif /* HEADER_fd_src_flamenco_runtime_program_fd_bpf_program_util_h */ diff --git a/src/flamenco/runtime/tests/fd_exec_instr_test.c b/src/flamenco/runtime/tests/fd_exec_instr_test.c index bf016eca15..8f8cdc81f5 100644 --- a/src/flamenco/runtime/tests/fd_exec_instr_test.c +++ b/src/flamenco/runtime/tests/fd_exec_instr_test.c @@ -1586,7 +1586,7 @@ fd_sbpf_program_load_test_run( FD_PARAM_UNUSED fd_exec_instr_test_runner_t * run do{ - if( FD_UNLIKELY( !fd_sbpf_elf_peek( &info, _bin, elf_sz, input->deploy_checks, FD_SBPF_MAX_VERSION ) ) ) { + if( FD_UNLIKELY( !fd_sbpf_elf_peek( &info, _bin, elf_sz, input->deploy_checks, FD_SBPF_V0, FD_SBPF_V3 ) ) ) { /* return incomplete effects on execution failures */ break; } diff --git a/src/flamenco/vm/fd_vm_tool.c b/src/flamenco/vm/fd_vm_tool.c index 3f8a7e5379..03b7ebe171 100644 --- a/src/flamenco/vm/fd_vm_tool.c +++ b/src/flamenco/vm/fd_vm_tool.c @@ -60,7 +60,7 @@ fd_vm_tool_prog_create( fd_vm_tool_prog_t * tool_prog, /* Extract ELF info */ fd_sbpf_elf_info_t elf_info; - FD_TEST( fd_sbpf_elf_peek( &elf_info, bin_buf, bin_sz, /* deploy checks */ 0, FD_SBPF_MAX_VERSION ) ); + FD_TEST( fd_sbpf_elf_peek( &elf_info, bin_buf, bin_sz, /* deploy checks */ 0, FD_SBPF_V0, FD_SBPF_V3 ) ); /* Allocate rodata segment */