Bumps solana_rbpf to v0.2.14 (#18869)
* Bumps solana_rbpf to v0.2.14 * Feature gate for verify_mul64_imm_nonzero as discussed in #17520.
This commit is contained in:
committed by
GitHub
parent
9912b73f9f
commit
0a63f65c03
@@ -16,9 +16,8 @@ use log::{log_enabled, trace, Level::Trace};
|
||||
use solana_measure::measure::Measure;
|
||||
use solana_rbpf::{
|
||||
aligned_memory::AlignedMemory,
|
||||
ebpf::{HOST_ALIGN, MM_HEAP_START},
|
||||
ebpf::HOST_ALIGN,
|
||||
error::{EbpfError, UserDefinedError},
|
||||
memory_region::MemoryRegion,
|
||||
static_analysis::Analysis,
|
||||
verifier::{self, VerifierError},
|
||||
vm::{Config, EbpfVm, Executable, InstructionMeter},
|
||||
@@ -31,7 +30,7 @@ use solana_sdk::{
|
||||
bpf_loader_upgradeable::{self, UpgradeableLoaderState},
|
||||
clock::Clock,
|
||||
entrypoint::{HEAP_LENGTH, SUCCESS},
|
||||
feature_set::add_missing_program_error_mappings,
|
||||
feature_set::{add_missing_program_error_mappings, stop_verify_mul64_imm_nonzero},
|
||||
ic_logger_msg, ic_msg,
|
||||
instruction::InstructionError,
|
||||
keyed_account::{from_keyed_account, keyed_account_at_index},
|
||||
@@ -83,6 +82,8 @@ pub fn create_executor(
|
||||
max_call_depth: compute_budget.max_call_depth,
|
||||
stack_frame_size: compute_budget.stack_frame_size,
|
||||
enable_instruction_tracing: log_enabled!(Trace),
|
||||
verify_mul64_imm_nonzero: !invoke_context
|
||||
.is_feature_active(&stop_verify_mul64_imm_nonzero::id()), // TODO: Feature gate and then remove me
|
||||
..Config::default()
|
||||
};
|
||||
let mut executable = {
|
||||
@@ -98,10 +99,8 @@ pub fn create_executor(
|
||||
)
|
||||
}
|
||||
.map_err(|e| map_ebpf_error(invoke_context, e))?;
|
||||
let (_, elf_bytes) = executable
|
||||
.get_text_bytes()
|
||||
.map_err(|e| map_ebpf_error(invoke_context, e))?;
|
||||
verifier::check(elf_bytes)
|
||||
let text_bytes = executable.get_text_bytes().1;
|
||||
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() {
|
||||
@@ -150,10 +149,9 @@ pub fn create_vm<'a>(
|
||||
invoke_context: &'a mut dyn InvokeContext,
|
||||
) -> Result<EbpfVm<'a, BpfError, ThisInstructionMeter>, EbpfError<BpfError>> {
|
||||
let compute_budget = invoke_context.get_compute_budget();
|
||||
let heap =
|
||||
let mut heap =
|
||||
AlignedMemory::new_with_size(compute_budget.heap_size.unwrap_or(HEAP_LENGTH), HOST_ALIGN);
|
||||
let heap_region = MemoryRegion::new_from_slice(heap.as_slice(), MM_HEAP_START, 0, true);
|
||||
let mut vm = EbpfVm::new(program, parameter_bytes, &[heap_region])?;
|
||||
let mut vm = EbpfVm::new(program, heap.as_slice_mut(), parameter_bytes)?;
|
||||
syscalls::bind_syscall_context_objects(loader_id, &mut vm, invoke_context, heap)?;
|
||||
Ok(vm)
|
||||
}
|
||||
@@ -909,7 +907,8 @@ mod tests {
|
||||
)
|
||||
.unwrap();
|
||||
let mut vm =
|
||||
EbpfVm::<BpfError, TestInstructionMeter>::new(program.as_ref(), input, &[]).unwrap();
|
||||
EbpfVm::<BpfError, TestInstructionMeter>::new(program.as_ref(), &mut [], input)
|
||||
.unwrap();
|
||||
let mut instruction_meter = TestInstructionMeter { remaining: 10 };
|
||||
vm.execute_program_interpreted(&mut instruction_meter)
|
||||
.unwrap();
|
||||
@@ -921,7 +920,7 @@ mod tests {
|
||||
let prog = &[
|
||||
0x18, 0x00, 0x00, 0x00, 0x88, 0x77, 0x66, 0x55, // first half of lddw
|
||||
];
|
||||
verifier::check(prog).unwrap();
|
||||
verifier::check(prog, &Config::default()).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Reference in New Issue
Block a user