disable deprecated BPF loader deploys (#23757)
This commit is contained in:
parent
7e358c654f
commit
1f052c6234
|
@ -551,10 +551,14 @@ fn test_program_bpf_loader_deprecated() {
|
|||
println!("Test program: {:?}", program);
|
||||
|
||||
let GenesisConfigInfo {
|
||||
genesis_config,
|
||||
mut genesis_config,
|
||||
mint_keypair,
|
||||
..
|
||||
} = create_genesis_config(50);
|
||||
genesis_config
|
||||
.accounts
|
||||
.remove(&solana_sdk::feature_set::disable_deprecated_loader::id())
|
||||
.unwrap();
|
||||
let mut bank = Bank::new_for_tests(&genesis_config);
|
||||
let (name, id, entrypoint) = solana_bpf_loader_deprecated_program!();
|
||||
bank.add_builtin(&name, &id, entrypoint);
|
||||
|
@ -2039,19 +2043,13 @@ fn test_program_bpf_disguised_as_bpf_loader() {
|
|||
..
|
||||
} = create_genesis_config(50);
|
||||
let mut bank = Bank::new_for_tests(&genesis_config);
|
||||
let (name, id, entrypoint) = solana_bpf_loader_deprecated_program!();
|
||||
let (name, id, entrypoint) = solana_bpf_loader_program!();
|
||||
bank.add_builtin(&name, &id, entrypoint);
|
||||
let bank_client = BankClient::new(bank);
|
||||
|
||||
let program_id = load_bpf_program(
|
||||
&bank_client,
|
||||
&bpf_loader_deprecated::id(),
|
||||
&mint_keypair,
|
||||
program,
|
||||
);
|
||||
let program_id = load_bpf_program(&bank_client, &bpf_loader::id(), &mint_keypair, program);
|
||||
let account_metas = vec![AccountMeta::new_readonly(program_id, false)];
|
||||
let instruction =
|
||||
Instruction::new_with_bytes(bpf_loader_deprecated::id(), &[1], account_metas);
|
||||
let instruction = Instruction::new_with_bytes(bpf_loader::id(), &[1], account_metas);
|
||||
let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction);
|
||||
assert_eq!(
|
||||
result.unwrap_err().unwrap(),
|
||||
|
|
|
@ -44,8 +44,8 @@ use {
|
|||
entrypoint::{HEAP_LENGTH, SUCCESS},
|
||||
feature_set::{
|
||||
cap_accounts_data_len, disable_bpf_deprecated_load_instructions,
|
||||
disable_bpf_unresolved_symbols_at_runtime, do_support_realloc,
|
||||
reduce_required_deploy_balance, requestable_heap_size,
|
||||
disable_bpf_unresolved_symbols_at_runtime, disable_deprecated_loader,
|
||||
do_support_realloc, reduce_required_deploy_balance, requestable_heap_size,
|
||||
},
|
||||
instruction::{AccountMeta, InstructionError},
|
||||
keyed_account::{keyed_account_at_index, KeyedAccount},
|
||||
|
@ -387,6 +387,10 @@ fn process_instruction_common(
|
|||
)
|
||||
} else {
|
||||
debug_assert_eq!(first_instruction_account, 1);
|
||||
|
||||
let disable_deprecated_loader = invoke_context
|
||||
.feature_set
|
||||
.is_active(&disable_deprecated_loader::id());
|
||||
if bpf_loader_upgradeable::check_id(program_id) {
|
||||
process_loader_upgradeable_instruction(
|
||||
first_instruction_account,
|
||||
|
@ -394,13 +398,18 @@ fn process_instruction_common(
|
|||
invoke_context,
|
||||
use_jit,
|
||||
)
|
||||
} else if bpf_loader::check_id(program_id) || bpf_loader_deprecated::check_id(program_id) {
|
||||
} else if bpf_loader::check_id(program_id)
|
||||
|| (!disable_deprecated_loader && bpf_loader_deprecated::check_id(program_id))
|
||||
{
|
||||
process_loader_instruction(
|
||||
first_instruction_account,
|
||||
instruction_data,
|
||||
invoke_context,
|
||||
use_jit,
|
||||
)
|
||||
} else if disable_deprecated_loader && bpf_loader_deprecated::check_id(program_id) {
|
||||
ic_logger_msg!(log_collector, "Deprecated loader is no longer supported");
|
||||
Err(InstructionError::UnsupportedProgramId)
|
||||
} else {
|
||||
ic_logger_msg!(log_collector, "Invalid BPF loader id");
|
||||
Err(InstructionError::IncorrectProgramId)
|
||||
|
|
|
@ -327,6 +327,10 @@ pub mod limit_secp256k1_recovery_id {
|
|||
solana_sdk::declare_id!("7g9EUwj4j7CS21Yx1wvgWLjSZeh5aPq8x9kpoPwXM8n8");
|
||||
}
|
||||
|
||||
pub mod disable_deprecated_loader {
|
||||
solana_sdk::declare_id!("GTUMCZ8LTNxVfxdrw7ZsDFTxXb7TutYkzJnFwinpE6dg");
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
/// Map of feature identifiers to user-visible description
|
||||
pub static ref FEATURE_NAMES: HashMap<Pubkey, &'static str> = [
|
||||
|
@ -403,6 +407,7 @@ lazy_static! {
|
|||
(syscall_saturated_math::id(), "syscalls use saturated math"),
|
||||
(check_physical_overlapping::id(), "check physical overlapping regions"),
|
||||
(limit_secp256k1_recovery_id::id(), "limit secp256k1 recovery id"),
|
||||
(disable_deprecated_loader::id(), "disable the deprecated BPF loader"),
|
||||
/*************** ADD NEW FEATURES HERE ***************/
|
||||
]
|
||||
.iter()
|
||||
|
|
Loading…
Reference in New Issue