Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gate pointer alignment enforcement #12176

Merged
merged 4 commits into from
Sep 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions programs/bpf/benches/bpf_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use solana_runtime::{
loader_utils::load_program,
};
use solana_sdk::{
account::{create_keyed_readonly_accounts, Account, KeyedAccount},
account::{create_keyed_readonly_accounts, Account},
bpf_loader, bpf_loader_deprecated,
client::SyncClient,
entrypoint::SUCCESS,
Expand Down Expand Up @@ -92,12 +92,12 @@ fn bench_program_alu(bencher: &mut Bencher) {
.write_u64::<LittleEndian>(ARMSTRONG_LIMIT)
.unwrap();
inner_iter.write_u64::<LittleEndian>(0).unwrap();
let loader_id = bpf_loader::id();
let mut invoke_context = MockInvokeContext::default();

let elf = load_elf("bench_alu").unwrap();
let (mut vm, _) =
solana_bpf_loader_program::create_vm(&bpf_loader::id(), &elf, &[], &mut invoke_context)
.unwrap();
solana_bpf_loader_program::create_vm(&loader_id, &elf, &[], &mut invoke_context).unwrap();

println!("Interpreted:");
assert_eq!(
Expand Down
3 changes: 2 additions & 1 deletion programs/bpf/tests/programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ fn run_program(
let mut program_account = Account::default();
file.read_to_end(&mut program_account.data).unwrap();

let loader_id = bpf_loader::id();
let mut invoke_context = MockInvokeContext::default();
let (mut vm, heap_region) = create_vm(
&bpf_loader::id(),
&loader_id,
&program_account.data,
parameter_accounts,
&mut invoke_context,
Expand Down
2 changes: 1 addition & 1 deletion programs/bpf_loader/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub enum BPFError {
impl UserDefinedError for BPFError {}

pub fn create_vm<'a>(
loader_id: &Pubkey,
loader_id: &'a Pubkey,
prog: &'a [u8],
parameter_accounts: &'a [KeyedAccount<'a>],
invoke_context: &'a mut dyn InvokeContext,
Expand Down
Loading