Bumps solana_rbpf to v0.2.16 (#21492)
This commit is contained in:
parent
e960634909
commit
c9aa7ed5ca
|
@ -6090,9 +6090,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana_rbpf"
|
name = "solana_rbpf"
|
||||||
version = "0.2.15"
|
version = "0.2.16"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dc53d7522cccfd4a86a82a2fad79328002b70910d944f5be3ba72ac96c64c518"
|
checksum = "3af7860a2bf51e63a07c4098966b1c80e8cbfdab3cf4ac36aac7fdd80ea1094c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"combine",
|
"combine",
|
||||||
|
@ -6105,7 +6105,6 @@ dependencies = [
|
||||||
"scroll",
|
"scroll",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"time 0.1.43",
|
"time 0.1.43",
|
||||||
"version_check 0.9.3",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
@ -36,7 +36,7 @@ solana-config-program = { path = "../programs/config", version = "=1.9.0" }
|
||||||
solana-faucet = { path = "../faucet", version = "=1.9.0" }
|
solana-faucet = { path = "../faucet", version = "=1.9.0" }
|
||||||
solana-logger = { path = "../logger", version = "=1.9.0" }
|
solana-logger = { path = "../logger", version = "=1.9.0" }
|
||||||
solana-program-runtime = { path = "../program-runtime", version = "=1.9.0" }
|
solana-program-runtime = { path = "../program-runtime", version = "=1.9.0" }
|
||||||
solana_rbpf = "=0.2.15"
|
solana_rbpf = "=0.2.16"
|
||||||
solana-remote-wallet = { path = "../remote-wallet", version = "=1.9.0" }
|
solana-remote-wallet = { path = "../remote-wallet", version = "=1.9.0" }
|
||||||
solana-sdk = { path = "../sdk", version = "=1.9.0" }
|
solana-sdk = { path = "../sdk", version = "=1.9.0" }
|
||||||
solana-transaction-status = { path = "../transaction-status", version = "=1.9.0" }
|
solana-transaction-status = { path = "../transaction-status", version = "=1.9.0" }
|
||||||
|
|
|
@ -25,10 +25,7 @@ use solana_client::{
|
||||||
tpu_client::{TpuClient, TpuClientConfig},
|
tpu_client::{TpuClient, TpuClientConfig},
|
||||||
};
|
};
|
||||||
use solana_program_runtime::invoke_context::ThisInvokeContext;
|
use solana_program_runtime::invoke_context::ThisInvokeContext;
|
||||||
use solana_rbpf::{
|
use solana_rbpf::{elf::Executable, verifier, vm::Config};
|
||||||
verifier,
|
|
||||||
vm::{Config, Executable},
|
|
||||||
};
|
|
||||||
use solana_remote_wallet::remote_wallet::RemoteWalletManager;
|
use solana_remote_wallet::remote_wallet::RemoteWalletManager;
|
||||||
use solana_sdk::{
|
use solana_sdk::{
|
||||||
account::Account,
|
account::Account,
|
||||||
|
@ -1997,7 +1994,7 @@ fn read_and_verify_elf(program_location: &str) -> Result<Vec<u8>, Box<dyn std::e
|
||||||
let mut invoke_context = ThisInvokeContext::new_mock(&[], &[]);
|
let mut invoke_context = ThisInvokeContext::new_mock(&[], &[]);
|
||||||
|
|
||||||
// Verify the program
|
// Verify the program
|
||||||
<dyn Executable<BpfError, ThisInstructionMeter>>::from_elf(
|
Executable::<BpfError, ThisInstructionMeter>::from_elf(
|
||||||
&program_data,
|
&program_data,
|
||||||
Some(verifier::check),
|
Some(verifier::check),
|
||||||
Config {
|
Config {
|
||||||
|
|
|
@ -3575,9 +3575,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana_rbpf"
|
name = "solana_rbpf"
|
||||||
version = "0.2.15"
|
version = "0.2.16"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dc53d7522cccfd4a86a82a2fad79328002b70910d944f5be3ba72ac96c64c518"
|
checksum = "3af7860a2bf51e63a07c4098966b1c80e8cbfdab3cf4ac36aac7fdd80ea1094c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder 1.4.3",
|
"byteorder 1.4.3",
|
||||||
"combine",
|
"combine",
|
||||||
|
@ -3590,7 +3590,6 @@ dependencies = [
|
||||||
"scroll",
|
"scroll",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"time",
|
"time",
|
||||||
"version_check",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
@ -33,7 +33,7 @@ solana-bpf-rust-realloc-invoke = { path = "rust/realloc_invoke", version = "=1.9
|
||||||
solana-cli-output = { path = "../../cli-output", version = "=1.9.0" }
|
solana-cli-output = { path = "../../cli-output", version = "=1.9.0" }
|
||||||
solana-logger = { path = "../../logger", version = "=1.9.0" }
|
solana-logger = { path = "../../logger", version = "=1.9.0" }
|
||||||
solana-measure = { path = "../../measure", version = "=1.9.0" }
|
solana-measure = { path = "../../measure", version = "=1.9.0" }
|
||||||
solana_rbpf = "=0.2.15"
|
solana_rbpf = "=0.2.16"
|
||||||
solana-runtime = { path = "../../runtime", version = "=1.9.0" }
|
solana-runtime = { path = "../../runtime", version = "=1.9.0" }
|
||||||
solana-program-runtime = { path = "../../program-runtime", version = "=1.9.0" }
|
solana-program-runtime = { path = "../../program-runtime", version = "=1.9.0" }
|
||||||
solana-sdk = { path = "../../sdk", version = "=1.9.0" }
|
solana-sdk = { path = "../../sdk", version = "=1.9.0" }
|
||||||
|
|
|
@ -12,7 +12,7 @@ use solana_bpf_loader_program::{
|
||||||
};
|
};
|
||||||
use solana_measure::measure::Measure;
|
use solana_measure::measure::Measure;
|
||||||
use solana_program_runtime::invoke_context::{with_mock_invoke_context, InvokeContext};
|
use solana_program_runtime::invoke_context::{with_mock_invoke_context, InvokeContext};
|
||||||
use solana_rbpf::vm::{Config, Executable, InstructionMeter, SyscallRegistry};
|
use solana_rbpf::{elf::Executable, vm::{Config, InstructionMeter, SyscallRegistry}};
|
||||||
use solana_runtime::{
|
use solana_runtime::{
|
||||||
bank::Bank,
|
bank::Bank,
|
||||||
bank_client::BankClient,
|
bank_client::BankClient,
|
||||||
|
@ -74,7 +74,7 @@ fn bench_program_create_executable(bencher: &mut Bencher) {
|
||||||
let elf = load_elf("bench_alu").unwrap();
|
let elf = load_elf("bench_alu").unwrap();
|
||||||
|
|
||||||
bencher.iter(|| {
|
bencher.iter(|| {
|
||||||
let _ = <dyn Executable<BpfError, ThisInstructionMeter>>::from_elf(
|
let _ = Executable::<BpfError, ThisInstructionMeter>::from_elf(
|
||||||
&elf,
|
&elf,
|
||||||
None,
|
None,
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
@ -96,7 +96,7 @@ fn bench_program_alu(bencher: &mut Bencher) {
|
||||||
let elf = load_elf("bench_alu").unwrap();
|
let elf = load_elf("bench_alu").unwrap();
|
||||||
let loader_id = bpf_loader::id();
|
let loader_id = bpf_loader::id();
|
||||||
with_mock_invoke_context(loader_id, 10000001, |invoke_context| {
|
with_mock_invoke_context(loader_id, 10000001, |invoke_context| {
|
||||||
let mut executable = <dyn Executable<BpfError, ThisInstructionMeter>>::from_elf(
|
let mut executable = Executable::<BpfError, ThisInstructionMeter>::from_elf(
|
||||||
&elf,
|
&elf,
|
||||||
None,
|
None,
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
@ -108,7 +108,7 @@ fn bench_program_alu(bencher: &mut Bencher) {
|
||||||
let mut instruction_meter = ThisInstructionMeter { compute_meter };
|
let mut instruction_meter = ThisInstructionMeter { compute_meter };
|
||||||
let mut vm = create_vm(
|
let mut vm = create_vm(
|
||||||
&loader_id,
|
&loader_id,
|
||||||
executable.as_ref(),
|
&executable,
|
||||||
&mut inner_iter,
|
&mut inner_iter,
|
||||||
invoke_context,
|
invoke_context,
|
||||||
&[],
|
&[],
|
||||||
|
@ -220,7 +220,7 @@ fn bench_create_vm(bencher: &mut Bencher) {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let executable = <dyn Executable<BpfError, ThisInstructionMeter>>::from_elf(
|
let executable = Executable::<BpfError, ThisInstructionMeter>::from_elf(
|
||||||
&elf,
|
&elf,
|
||||||
None,
|
None,
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
@ -231,7 +231,7 @@ fn bench_create_vm(bencher: &mut Bencher) {
|
||||||
bencher.iter(|| {
|
bencher.iter(|| {
|
||||||
let _ = create_vm(
|
let _ = create_vm(
|
||||||
&loader_id,
|
&loader_id,
|
||||||
executable.as_ref(),
|
&executable,
|
||||||
serialized.as_slice_mut(),
|
serialized.as_slice_mut(),
|
||||||
invoke_context,
|
invoke_context,
|
||||||
&account_lengths,
|
&account_lengths,
|
||||||
|
@ -264,7 +264,7 @@ fn bench_instruction_count_tuner(_bencher: &mut Bencher) {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let executable = <dyn Executable<BpfError, ThisInstructionMeter>>::from_elf(
|
let executable = Executable::<BpfError, ThisInstructionMeter>::from_elf(
|
||||||
&elf,
|
&elf,
|
||||||
None,
|
None,
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
@ -274,7 +274,7 @@ fn bench_instruction_count_tuner(_bencher: &mut Bencher) {
|
||||||
let mut instruction_meter = ThisInstructionMeter { compute_meter };
|
let mut instruction_meter = ThisInstructionMeter { compute_meter };
|
||||||
let mut vm = create_vm(
|
let mut vm = create_vm(
|
||||||
&loader_id,
|
&loader_id,
|
||||||
executable.as_ref(),
|
&executable,
|
||||||
serialized.as_slice_mut(),
|
serialized.as_slice_mut(),
|
||||||
invoke_context,
|
invoke_context,
|
||||||
&account_lengths,
|
&account_lengths,
|
||||||
|
|
|
@ -20,8 +20,9 @@ use solana_bpf_rust_realloc_invoke::instructions::*;
|
||||||
use solana_cli_output::display::println_transaction;
|
use solana_cli_output::display::println_transaction;
|
||||||
use solana_program_runtime::invoke_context::{with_mock_invoke_context, InvokeContext};
|
use solana_program_runtime::invoke_context::{with_mock_invoke_context, InvokeContext};
|
||||||
use solana_rbpf::{
|
use solana_rbpf::{
|
||||||
|
elf::Executable,
|
||||||
static_analysis::Analysis,
|
static_analysis::Analysis,
|
||||||
vm::{Config, Executable, Tracer},
|
vm::{Config, Tracer},
|
||||||
};
|
};
|
||||||
use solana_runtime::{
|
use solana_runtime::{
|
||||||
bank::{Bank, ExecuteTimings, NonceInfo, TransactionBalancesSet, TransactionResults},
|
bank::{Bank, ExecuteTimings, NonceInfo, TransactionBalancesSet, TransactionResults},
|
||||||
|
@ -210,7 +211,7 @@ fn run_program(name: &str) -> u64 {
|
||||||
enable_instruction_tracing: true,
|
enable_instruction_tracing: true,
|
||||||
..Config::default()
|
..Config::default()
|
||||||
};
|
};
|
||||||
let mut executable = <dyn Executable<BpfError, ThisInstructionMeter>>::from_elf(
|
let mut executable = Executable::<BpfError, ThisInstructionMeter>::from_elf(
|
||||||
&data,
|
&data,
|
||||||
None,
|
None,
|
||||||
config,
|
config,
|
||||||
|
@ -227,7 +228,7 @@ fn run_program(name: &str) -> u64 {
|
||||||
{
|
{
|
||||||
let mut vm = create_vm(
|
let mut vm = create_vm(
|
||||||
&loader_id,
|
&loader_id,
|
||||||
executable.as_ref(),
|
&executable,
|
||||||
parameter_bytes.as_slice_mut(),
|
parameter_bytes.as_slice_mut(),
|
||||||
invoke_context,
|
invoke_context,
|
||||||
&account_lengths,
|
&account_lengths,
|
||||||
|
@ -246,7 +247,7 @@ fn run_program(name: &str) -> u64 {
|
||||||
if config.enable_instruction_tracing {
|
if config.enable_instruction_tracing {
|
||||||
if i == 1 {
|
if i == 1 {
|
||||||
if !Tracer::compare(tracer.as_ref().unwrap(), vm.get_tracer()) {
|
if !Tracer::compare(tracer.as_ref().unwrap(), vm.get_tracer()) {
|
||||||
let analysis = Analysis::from_executable(executable.as_ref());
|
let analysis = Analysis::from_executable(&executable);
|
||||||
let stdout = std::io::stdout();
|
let stdout = std::io::stdout();
|
||||||
println!("TRACE (interpreted):");
|
println!("TRACE (interpreted):");
|
||||||
tracer
|
tracer
|
||||||
|
@ -260,7 +261,7 @@ fn run_program(name: &str) -> u64 {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert!(false);
|
assert!(false);
|
||||||
} else if log_enabled!(Trace) {
|
} else if log_enabled!(Trace) {
|
||||||
let analysis = Analysis::from_executable(executable.as_ref());
|
let analysis = Analysis::from_executable(&executable);
|
||||||
let mut trace_buffer = Vec::<u8>::new();
|
let mut trace_buffer = Vec::<u8>::new();
|
||||||
tracer
|
tracer
|
||||||
.as_ref()
|
.as_ref()
|
||||||
|
|
|
@ -21,7 +21,7 @@ openssl = "^0.10.38"
|
||||||
solana-measure = { path = "../../measure", version = "=1.9.0" }
|
solana-measure = { path = "../../measure", version = "=1.9.0" }
|
||||||
solana-program-runtime = { path = "../../program-runtime", version = "=1.9.0" }
|
solana-program-runtime = { path = "../../program-runtime", version = "=1.9.0" }
|
||||||
solana-sdk = { path = "../../sdk", version = "=1.9.0" }
|
solana-sdk = { path = "../../sdk", version = "=1.9.0" }
|
||||||
solana_rbpf = "=0.2.15"
|
solana_rbpf = "=0.2.16"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|
|
@ -24,10 +24,11 @@ use solana_program_runtime::{
|
||||||
use solana_rbpf::{
|
use solana_rbpf::{
|
||||||
aligned_memory::AlignedMemory,
|
aligned_memory::AlignedMemory,
|
||||||
ebpf::HOST_ALIGN,
|
ebpf::HOST_ALIGN,
|
||||||
|
elf::Executable,
|
||||||
error::{EbpfError, UserDefinedError},
|
error::{EbpfError, UserDefinedError},
|
||||||
static_analysis::Analysis,
|
static_analysis::Analysis,
|
||||||
verifier::{self, VerifierError},
|
verifier::{self, VerifierError},
|
||||||
vm::{Config, EbpfVm, Executable, InstructionMeter},
|
vm::{Config, EbpfVm, InstructionMeter},
|
||||||
};
|
};
|
||||||
use solana_sdk::{
|
use solana_sdk::{
|
||||||
account::{ReadableAccount, WritableAccount},
|
account::{ReadableAccount, WritableAccount},
|
||||||
|
@ -99,7 +100,7 @@ pub fn create_executor(
|
||||||
let mut executable = {
|
let mut executable = {
|
||||||
let keyed_accounts = invoke_context.get_keyed_accounts()?;
|
let keyed_accounts = invoke_context.get_keyed_accounts()?;
|
||||||
let programdata = keyed_account_at_index(keyed_accounts, programdata_account_index)?;
|
let programdata = keyed_account_at_index(keyed_accounts, programdata_account_index)?;
|
||||||
<dyn Executable<BpfError, ThisInstructionMeter>>::from_elf(
|
Executable::<BpfError, ThisInstructionMeter>::from_elf(
|
||||||
&programdata.try_account_ref()?.data()[programdata_offset..],
|
&programdata.try_account_ref()?.data()[programdata_offset..],
|
||||||
None,
|
None,
|
||||||
config,
|
config,
|
||||||
|
@ -152,7 +153,7 @@ fn check_loader_id(id: &Pubkey) -> bool {
|
||||||
/// Create the BPF virtual machine
|
/// Create the BPF virtual machine
|
||||||
pub fn create_vm<'a>(
|
pub fn create_vm<'a>(
|
||||||
loader_id: &'a Pubkey,
|
loader_id: &'a Pubkey,
|
||||||
program: &'a dyn Executable<BpfError, ThisInstructionMeter>,
|
program: &'a Executable<BpfError, ThisInstructionMeter>,
|
||||||
parameter_bytes: &mut [u8],
|
parameter_bytes: &mut [u8],
|
||||||
invoke_context: &'a mut dyn InvokeContext,
|
invoke_context: &'a mut dyn InvokeContext,
|
||||||
orig_data_lens: &'a [usize],
|
orig_data_lens: &'a [usize],
|
||||||
|
@ -945,7 +946,7 @@ impl InstructionMeter for ThisInstructionMeter {
|
||||||
|
|
||||||
/// BPF Loader's Executor implementation
|
/// BPF Loader's Executor implementation
|
||||||
pub struct BpfExecutor {
|
pub struct BpfExecutor {
|
||||||
executable: Box<dyn Executable<BpfError, ThisInstructionMeter>>,
|
executable: Executable<BpfError, ThisInstructionMeter>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Well, implement Debug for solana_rbpf::vm::Executable in solana-rbpf...
|
// Well, implement Debug for solana_rbpf::vm::Executable in solana-rbpf...
|
||||||
|
@ -985,7 +986,7 @@ impl Executor for BpfExecutor {
|
||||||
let compute_meter = invoke_context.get_compute_meter();
|
let compute_meter = invoke_context.get_compute_meter();
|
||||||
let mut vm = match create_vm(
|
let mut vm = match create_vm(
|
||||||
loader_id,
|
loader_id,
|
||||||
self.executable.as_ref(),
|
&self.executable,
|
||||||
parameter_bytes.as_slice_mut(),
|
parameter_bytes.as_slice_mut(),
|
||||||
invoke_context,
|
invoke_context,
|
||||||
&account_lengths,
|
&account_lengths,
|
||||||
|
@ -1017,7 +1018,7 @@ impl Executor for BpfExecutor {
|
||||||
);
|
);
|
||||||
if log_enabled!(Trace) {
|
if log_enabled!(Trace) {
|
||||||
let mut trace_buffer = Vec::<u8>::new();
|
let mut trace_buffer = Vec::<u8>::new();
|
||||||
let analysis = Analysis::from_executable(self.executable.as_ref());
|
let analysis = Analysis::from_executable(&self.executable);
|
||||||
vm.get_tracer().write(&mut trace_buffer, &analysis).unwrap();
|
vm.get_tracer().write(&mut trace_buffer, &analysis).unwrap();
|
||||||
let trace_string = String::from_utf8(trace_buffer).unwrap();
|
let trace_string = String::from_utf8(trace_buffer).unwrap();
|
||||||
trace!("BPF Program Instruction Trace:\n{}", trace_string);
|
trace!("BPF Program Instruction Trace:\n{}", trace_string);
|
||||||
|
@ -1153,8 +1154,9 @@ mod tests {
|
||||||
];
|
];
|
||||||
let input = &mut [0x00];
|
let input = &mut [0x00];
|
||||||
let mut bpf_functions = std::collections::BTreeMap::<u32, (usize, String)>::new();
|
let mut bpf_functions = std::collections::BTreeMap::<u32, (usize, String)>::new();
|
||||||
solana_rbpf::elf::register_bpf_function(&mut bpf_functions, 0, "entrypoint").unwrap();
|
solana_rbpf::elf::register_bpf_function(&mut bpf_functions, 0, "entrypoint", false)
|
||||||
let program = <dyn Executable<BpfError, TestInstructionMeter>>::from_text_bytes(
|
.unwrap();
|
||||||
|
let program = Executable::<BpfError, TestInstructionMeter>::from_text_bytes(
|
||||||
program,
|
program,
|
||||||
None,
|
None,
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
@ -1163,8 +1165,7 @@ mod tests {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let mut vm =
|
let mut vm =
|
||||||
EbpfVm::<BpfError, TestInstructionMeter>::new(program.as_ref(), &mut [], input)
|
EbpfVm::<BpfError, TestInstructionMeter>::new(&program, &mut [], input).unwrap();
|
||||||
.unwrap();
|
|
||||||
let mut instruction_meter = TestInstructionMeter { remaining: 10 };
|
let mut instruction_meter = TestInstructionMeter { remaining: 10 };
|
||||||
vm.execute_program_interpreted(&mut instruction_meter)
|
vm.execute_program_interpreted(&mut instruction_meter)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
|
@ -16,5 +16,5 @@ solana-bpf-loader-program = { path = "../programs/bpf_loader", version = "=1.9.0
|
||||||
solana-logger = { path = "../logger", version = "=1.9.0" }
|
solana-logger = { path = "../logger", version = "=1.9.0" }
|
||||||
solana-program-runtime = { path = "../program-runtime", version = "=1.9.0" }
|
solana-program-runtime = { path = "../program-runtime", version = "=1.9.0" }
|
||||||
solana-sdk = { path = "../sdk", version = "=1.9.0" }
|
solana-sdk = { path = "../sdk", version = "=1.9.0" }
|
||||||
solana_rbpf = "=0.2.15"
|
solana_rbpf = "=0.2.16"
|
||||||
time = "0.3.5"
|
time = "0.3.5"
|
||||||
|
|
|
@ -10,9 +10,10 @@ use solana_program_runtime::invoke_context::{
|
||||||
};
|
};
|
||||||
use solana_rbpf::{
|
use solana_rbpf::{
|
||||||
assembler::assemble,
|
assembler::assemble,
|
||||||
|
elf::Executable,
|
||||||
static_analysis::Analysis,
|
static_analysis::Analysis,
|
||||||
verifier::check,
|
verifier::check,
|
||||||
vm::{Config, DynamicAnalysis, Executable},
|
vm::{Config, DynamicAnalysis},
|
||||||
};
|
};
|
||||||
use solana_sdk::{account::AccountSharedData, bpf_loader, pubkey::Pubkey};
|
use solana_sdk::{account::AccountSharedData, bpf_loader, pubkey::Pubkey};
|
||||||
use std::{fs::File, io::Read, io::Seek, io::SeekFrom, path::Path};
|
use std::{fs::File, io::Read, io::Seek, io::SeekFrom, path::Path};
|
||||||
|
@ -230,7 +231,7 @@ native machine code before execting it in the virtual machine.",
|
||||||
file.read_to_end(&mut contents).unwrap();
|
file.read_to_end(&mut contents).unwrap();
|
||||||
let syscall_registry = register_syscalls(&mut invoke_context).unwrap();
|
let syscall_registry = register_syscalls(&mut invoke_context).unwrap();
|
||||||
let mut executable = if magic == [0x7f, 0x45, 0x4c, 0x46] {
|
let mut executable = if magic == [0x7f, 0x45, 0x4c, 0x46] {
|
||||||
<dyn Executable<BpfError, ThisInstructionMeter>>::from_elf(
|
Executable::<BpfError, ThisInstructionMeter>::from_elf(
|
||||||
&contents,
|
&contents,
|
||||||
None,
|
None,
|
||||||
config,
|
config,
|
||||||
|
@ -252,7 +253,7 @@ native machine code before execting it in the virtual machine.",
|
||||||
check(text_bytes, &config).unwrap();
|
check(text_bytes, &config).unwrap();
|
||||||
}
|
}
|
||||||
executable.jit_compile().unwrap();
|
executable.jit_compile().unwrap();
|
||||||
let analysis = Analysis::from_executable(executable.as_ref());
|
let analysis = Analysis::from_executable(&executable);
|
||||||
|
|
||||||
match matches.value_of("use") {
|
match matches.value_of("use") {
|
||||||
Some("cfg") => {
|
Some("cfg") => {
|
||||||
|
@ -271,7 +272,7 @@ native machine code before execting it in the virtual machine.",
|
||||||
let id = bpf_loader::id();
|
let id = bpf_loader::id();
|
||||||
let mut vm = create_vm(
|
let mut vm = create_vm(
|
||||||
&id,
|
&id,
|
||||||
executable.as_ref(),
|
&executable,
|
||||||
parameter_bytes.as_slice_mut(),
|
parameter_bytes.as_slice_mut(),
|
||||||
&mut invoke_context,
|
&mut invoke_context,
|
||||||
&account_lengths,
|
&account_lengths,
|
||||||
|
@ -291,7 +292,7 @@ native machine code before execting it in the virtual machine.",
|
||||||
if matches.is_present("trace") {
|
if matches.is_present("trace") {
|
||||||
println!("Trace is saved in trace.out");
|
println!("Trace is saved in trace.out");
|
||||||
let mut file = File::create("trace.out").unwrap();
|
let mut file = File::create("trace.out").unwrap();
|
||||||
let analysis = Analysis::from_executable(executable.as_ref());
|
let analysis = Analysis::from_executable(&executable);
|
||||||
vm.get_tracer().write(&mut file, &analysis).unwrap();
|
vm.get_tracer().write(&mut file, &analysis).unwrap();
|
||||||
}
|
}
|
||||||
if matches.is_present("profile") {
|
if matches.is_present("profile") {
|
||||||
|
|
Loading…
Reference in New Issue