Skip to content

Commit

Permalink
Requires the owner accounts of programs to be built-ins.
Browse files Browse the repository at this point in the history
(owned by the native_loader and have the executable flag set)
  • Loading branch information
Lichtso committed May 4, 2023
1 parent 886aea2 commit 86fb2d7
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions runtime/src/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -535,16 +535,23 @@ impl Accounts {
builtins_start_index.saturating_add(owner_index)
} else {
let owner_index = accounts.len();
if let Some((program_account, _)) =
if let Some((owner_account, _)) =
self.accounts_db.load_with_fixed_root(ancestors, owner_id)
{
if disable_builtin_loader_ownership_chains
&& !native_loader::check_id(owner_account.owner())
|| !owner_account.executable()
{
error_counters.invalid_program_for_execution += 1;
return Err(TransactionError::InvalidProgramForExecution);
}
Self::accumulate_and_check_loaded_account_data_size(
&mut accumulated_accounts_data_size,
program_account.data().len(),
owner_account.data().len(),
requested_loaded_accounts_data_size_limit,
error_counters,
)?;
accounts.push((*owner_id, program_account));
accounts.push((*owner_id, owner_account));
} else {
error_counters.account_not_found += 1;
return Err(TransactionError::ProgramAccountNotFound);
Expand Down

0 comments on commit 86fb2d7

Please sign in to comment.