Gate CPI authorized programs (bp #14361) (#14364)

* Gate CPI authorized programs (#14361)

(cherry picked from commit 2d8dacb72b)

# Conflicts:
#	programs/bpf_loader/src/syscalls.rs

* resolve conflicts

Co-authored-by: Jack May <jack@solana.com>
This commit is contained in:
mergify[bot]
2020-12-31 03:43:55 +00:00
committed by GitHub
parent bfe9f12fe0
commit 3fa08e620a
2 changed files with 10 additions and 3 deletions

View File

@@ -16,8 +16,8 @@ use solana_sdk::{
bpf_loader_upgradeable::{self, UpgradeableLoaderState},
entrypoint::{MAX_PERMITTED_DATA_INCREASE, SUCCESS},
feature_set::{
pubkey_log_syscall_enabled, ristretto_mul_syscall_enabled, sha256_syscall_enabled,
sol_log_compute_units_syscall,
limit_cpi_loader_invoke, pubkey_log_syscall_enabled, ristretto_mul_syscall_enabled,
sha256_syscall_enabled, sol_log_compute_units_syscall,
},
hash::{Hasher, HASH_BYTES},
instruction::{AccountMeta, Instruction, InstructionError},
@@ -1234,7 +1234,9 @@ fn call<'a>(
let (message, callee_program_id) =
MessageProcessor::create_message(&instruction, &keyed_account_refs, &signers)
.map_err(SyscallError::InstructionError)?;
check_authorized_program(&callee_program_id)?;
if invoke_context.is_feature_active(&limit_cpi_loader_invoke::id()) {
check_authorized_program(&callee_program_id)?;
}
let (accounts, account_refs) = syscall.translate_accounts(
&message,
account_infos_addr,