Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
Bumps solana_rbpf to v0.2.19 (#21880)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lichtso authored and mvines committed Dec 14, 2021
1 parent 16f6bdf commit 423a4d6
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ solana-config-program = { path = "../programs/config", version = "=1.8.11" }
solana-faucet = { path = "../faucet", version = "=1.8.11" }
solana-logger = { path = "../logger", version = "=1.8.11" }
solana-net-utils = { path = "../net-utils", version = "=1.8.11" }
solana_rbpf = "=0.2.18"
solana_rbpf = "=0.2.19"
solana-remote-wallet = { path = "../remote-wallet", version = "=1.8.11" }
solana-sdk = { path = "../sdk", version = "=1.8.11" }
solana-transaction-status = { path = "../transaction-status", version = "=1.8.11" }
Expand Down
4 changes: 2 additions & 2 deletions programs/bpf/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion programs/bpf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ solana-bpf-loader-program = { path = "../bpf_loader", version = "=1.8.11" }
solana-cli-output = { path = "../../cli-output", version = "=1.8.11" }
solana-logger = { path = "../../logger", version = "=1.8.11" }
solana-measure = { path = "../../measure", version = "=1.8.11" }
solana_rbpf = "=0.2.18"
solana_rbpf = "=0.2.19"
solana-runtime = { path = "../../runtime", version = "=1.8.11" }
solana-sdk = { path = "../../sdk", version = "=1.8.11" }
solana-transaction-status = { path = "../../transaction-status", version = "=1.8.11" }
Expand Down
2 changes: 1 addition & 1 deletion programs/bpf/benches/bpf_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ fn bench_program_alu(bencher: &mut Bencher) {
register_syscalls(&mut invoke_context).unwrap(),
)
.unwrap();
executable.jit_compile().unwrap();
Executable::<BpfError, ThisInstructionMeter>::jit_compile(&mut executable).unwrap();
let compute_meter = invoke_context.get_compute_meter();
let mut instruction_meter = ThisInstructionMeter { compute_meter };
let mut vm = create_vm(
Expand Down
2 changes: 1 addition & 1 deletion programs/bpf/tests/programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ fn run_program(
register_syscalls(&mut invoke_context).unwrap(),
)
.unwrap();
executable.jit_compile().unwrap();
Executable::<BpfError, ThisInstructionMeter>::jit_compile(&mut executable).unwrap();

let mut instruction_count = 0;
let mut tracer = None;
Expand Down
2 changes: 1 addition & 1 deletion programs/bpf_loader/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ sha3 = "0.9.1"
solana-measure = { path = "../../measure", version = "=1.8.11" }
solana-runtime = { path = "../../runtime", version = "=1.8.11" }
solana-sdk = { path = "../../sdk", version = "=1.8.11" }
solana_rbpf = "=0.2.18"
solana_rbpf = "=0.2.19"
thiserror = "1.0"

[dev-dependencies]
Expand Down
17 changes: 10 additions & 7 deletions programs/bpf_loader/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ use solana_sdk::{
entrypoint::{HEAP_LENGTH, SUCCESS},
feature_set::{
add_missing_program_error_mappings, close_upgradeable_program_accounts, fix_write_privs,
reduce_required_deploy_balance, reject_deployment_of_unresolved_syscalls,
reject_section_virtual_address_file_offset_mismatch, requestable_heap_size,
start_verify_shift32_imm, stop_verify_mul64_imm_nonzero, upgradeable_close_instruction,
reduce_required_deploy_balance, reject_all_elf_rw,
reject_deployment_of_unresolved_syscalls,
reject_section_virtual_address_file_offset_mismatch, start_verify_shift32_imm,
stop_verify_mul64_imm_nonzero, upgradeable_close_instruction,
},
ic_logger_msg, ic_msg,
instruction::{AccountMeta, InstructionError},
Expand All @@ -49,7 +50,7 @@ use solana_sdk::{
rent::Rent,
system_instruction::{self, MAX_PERMITTED_DATA_LENGTH},
};
use std::{cell::RefCell, fmt::Debug, rc::Rc, sync::Arc};
use std::{cell::RefCell, fmt::Debug, pin::Pin, rc::Rc, sync::Arc};
use thiserror::Error;

solana_sdk::declare_builtin!(
Expand Down Expand Up @@ -97,6 +98,7 @@ pub fn create_executor(
verify_mul64_imm_nonzero: !invoke_context
.is_feature_active(&stop_verify_mul64_imm_nonzero::id()),
verify_shift32_imm: invoke_context.is_feature_active(&start_verify_shift32_imm::id()),
reject_all_writable_sections: invoke_context.is_feature_active(&reject_all_elf_rw::id()),
..Config::default()
};
let mut executable = {
Expand All @@ -111,7 +113,8 @@ pub fn create_executor(
verifier::check(text_bytes, &config)
.map_err(|e| map_ebpf_error(invoke_context, EbpfError::UserError(e.into())))?;
if use_jit {
if let Err(err) = executable.jit_compile() {
if let Err(err) = Executable::<BpfError, ThisInstructionMeter>::jit_compile(&mut executable)
{
ic_msg!(invoke_context, "Failed to compile program {:?}", err);
return Err(InstructionError::ProgramFailedToCompile);
}
Expand Down Expand Up @@ -152,7 +155,7 @@ fn check_loader_id(id: &Pubkey) -> bool {
/// Create the BPF virtual machine
pub fn create_vm<'a>(
loader_id: &'a Pubkey,
program: &'a Executable<BpfError, ThisInstructionMeter>,
program: &'a Pin<Box<Executable<BpfError, ThisInstructionMeter>>>,
parameter_bytes: &mut [u8],
invoke_context: &'a mut dyn InvokeContext,
) -> Result<EbpfVm<'a, BpfError, ThisInstructionMeter>, EbpfError<BpfError>> {
Expand Down Expand Up @@ -874,7 +877,7 @@ impl InstructionMeter for ThisInstructionMeter {

/// BPF Loader's Executor implementation
pub struct BpfExecutor {
executable: Executable<BpfError, ThisInstructionMeter>,
executable: Pin<Box<Executable<BpfError, ThisInstructionMeter>>>,
}

// Well, implement Debug for solana_rbpf::vm::Executable in solana-rbpf...
Expand Down
2 changes: 1 addition & 1 deletion rbpf-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ native machine code before execting it in the virtual machine.",
let text_bytes = executable.get_text_bytes().1;
check(text_bytes, &config).unwrap();
}
executable.jit_compile().unwrap();
Executable::<BpfError, ThisInstructionMeter>::jit_compile(&mut executable).unwrap();
let analysis = Analysis::from_executable(&executable);

match matches.value_of("use") {
Expand Down
5 changes: 5 additions & 0 deletions sdk/src/feature_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,10 @@ pub mod reject_section_virtual_address_file_offset_mismatch {
solana_sdk::declare_id!("5N4NikcJLEiZNqwndhNyvZw15LvFXp1oF7AJQTNTZY5k");
}

pub mod reject_all_elf_rw {
solana_sdk::declare_id!("DeMpxgMq51j3rZfNK2hQKZyXknQvqevPSFPJFNTbXxsS");
}

lazy_static! {
/// Map of feature identifiers to user-visible description
pub static ref FEATURE_NAMES: HashMap<Pubkey, &'static str> = [
Expand Down Expand Up @@ -334,6 +338,7 @@ lazy_static! {
(add_compute_budget_program::id(), "Add compute_budget_program"),
(reject_deployment_of_unresolved_syscalls::id(), "Reject deployment of programs with unresolved syscall symbols"),
(reject_section_virtual_address_file_offset_mismatch::id(), "enforce section virtual addresses and file offsets in ELF to be equal"),
(reject_all_elf_rw::id(), "reject all read-write data in program elfs"),
/*************** ADD NEW FEATURES HERE ***************/
]
.iter()
Expand Down

0 comments on commit 423a4d6

Please sign in to comment.