From 800ddfe22c84a53fb54a465e6865ad6fbc845ddc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Mei=C3=9Fner?= Date: Fri, 3 Dec 2021 21:42:57 +0100 Subject: [PATCH] Bump solana_rbpf to version 0.2.12 (#17585) Unify BPF verifiers. --- Cargo.lock | 4 ++-- cli/Cargo.toml | 2 +- cli/src/program.rs | 9 ++++++--- programs/bpf/Cargo.lock | 4 ++-- programs/bpf/Cargo.toml | 2 +- programs/bpf_loader/Cargo.toml | 2 +- programs/bpf_loader/src/lib.rs | 11 +++++------ rbpf-cli/Cargo.toml | 2 +- 8 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f80920b95b128c..6d990d0bd5fe71 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5951,9 +5951,9 @@ dependencies = [ [[package]] name = "solana_rbpf" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c1c5bdfa63c68d848d95024c7f4335bae4b1917f7df2e48e2d945f4664a8b45" +checksum = "c44596a3613a44f76a7f6e5205464a1e78d1529fa19e8eacde0b9e55a6387f50" dependencies = [ "byteorder", "combine", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 1a35fde3a6737b..d04fc4305910a1 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -40,7 +40,7 @@ solana-config-program = { path = "../programs/config", version = "=1.8.7" } solana-faucet = { path = "../faucet", version = "=1.8.7" } solana-logger = { path = "../logger", version = "=1.8.7" } solana-net-utils = { path = "../net-utils", version = "=1.8.7" } -solana_rbpf = "=0.2.11" +solana_rbpf = "=0.2.12" solana-remote-wallet = { path = "../remote-wallet", version = "=1.8.7" } solana-sdk = { path = "../sdk", version = "=1.8.7" } solana-transaction-status = { path = "../transaction-status", version = "=1.8.7" } diff --git a/cli/src/program.rs b/cli/src/program.rs index 1a8f1c0a87ef27..2b8dbdcfbefa88 100644 --- a/cli/src/program.rs +++ b/cli/src/program.rs @@ -10,7 +10,7 @@ use { clap::{App, AppSettings, Arg, ArgMatches, SubCommand}, log::*, solana_account_decoder::{UiAccountEncoding, UiDataSliceConfig}, - solana_bpf_loader_program::{bpf_verifier, BpfError, ThisInstructionMeter}, + solana_bpf_loader_program::{BpfError, ThisInstructionMeter}, solana_clap_utils::{self, input_parsers::*, input_validators::*, keypair::*}, solana_cli_output::{ CliProgram, CliProgramAccountType, CliProgramAuthority, CliProgramBuffer, CliProgramId, @@ -24,7 +24,10 @@ use { rpc_filter::{Memcmp, MemcmpEncodedBytes, RpcFilterType}, tpu_client::{TpuClient, TpuClientConfig}, }, - solana_rbpf::vm::{Config, Executable}, + solana_rbpf::{ + verifier, + vm::{Config, Executable}, + }, solana_remote_wallet::remote_wallet::RemoteWalletManager, solana_sdk::{ account::Account, @@ -1986,7 +1989,7 @@ fn read_and_verify_elf(program_location: &str) -> Result, Box>::from_elf( &program_data, - Some(|x| bpf_verifier::check(x)), + Some(|x| verifier::check(x)), Config::default(), ) .map_err(|err| format!("ELF error: {}", err))?; diff --git a/programs/bpf/Cargo.lock b/programs/bpf/Cargo.lock index 166e8c1cb5d6f1..4579f2a45cc826 100644 --- a/programs/bpf/Cargo.lock +++ b/programs/bpf/Cargo.lock @@ -3698,9 +3698,9 @@ dependencies = [ [[package]] name = "solana_rbpf" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c1c5bdfa63c68d848d95024c7f4335bae4b1917f7df2e48e2d945f4664a8b45" +checksum = "c44596a3613a44f76a7f6e5205464a1e78d1529fa19e8eacde0b9e55a6387f50" dependencies = [ "byteorder 1.3.4", "combine", diff --git a/programs/bpf/Cargo.toml b/programs/bpf/Cargo.toml index e3443bbd24a4f0..2b046803f3412a 100644 --- a/programs/bpf/Cargo.toml +++ b/programs/bpf/Cargo.toml @@ -30,7 +30,7 @@ solana-bpf-loader-program = { path = "../bpf_loader", version = "=1.8.7" } solana-cli-output = { path = "../../cli-output", version = "=1.8.7" } solana-logger = { path = "../../logger", version = "=1.8.7" } solana-measure = { path = "../../measure", version = "=1.8.7" } -solana_rbpf = "=0.2.11" +solana_rbpf = "=0.2.12" solana-runtime = { path = "../../runtime", version = "=1.8.7" } solana-sdk = { path = "../../sdk", version = "=1.8.7" } solana-transaction-status = { path = "../../transaction-status", version = "=1.8.7" } diff --git a/programs/bpf_loader/Cargo.toml b/programs/bpf_loader/Cargo.toml index dda8295b5dda81..b649b8ea427607 100644 --- a/programs/bpf_loader/Cargo.toml +++ b/programs/bpf_loader/Cargo.toml @@ -21,7 +21,7 @@ sha3 = "0.9.1" solana-measure = { path = "../../measure", version = "=1.8.7" } solana-runtime = { path = "../../runtime", version = "=1.8.7" } solana-sdk = { path = "../../sdk", version = "=1.8.7" } -solana_rbpf = "=0.2.11" +solana_rbpf = "=0.2.12" thiserror = "1.0" [dev-dependencies] diff --git a/programs/bpf_loader/src/lib.rs b/programs/bpf_loader/src/lib.rs index ea9f4449070bd2..b37be9d3d7a347 100644 --- a/programs/bpf_loader/src/lib.rs +++ b/programs/bpf_loader/src/lib.rs @@ -1,7 +1,6 @@ #![allow(clippy::integer_arithmetic)] pub mod alloc; pub mod allocator_bump; -pub mod bpf_verifier; pub mod deprecated; pub mod serialization; pub mod syscalls; @@ -11,7 +10,6 @@ pub mod with_jit; use { crate::{ - bpf_verifier::VerifierError, serialization::{deserialize_parameters, serialize_parameters}, syscalls::SyscallError, }, @@ -23,6 +21,7 @@ use { error::{EbpfError, UserDefinedError}, memory_region::MemoryRegion, static_analysis::Analysis, + verifier::{self, VerifierError}, vm::{Config, EbpfVm, Executable, InstructionMeter}, }, solana_runtime::message_processor::MessageProcessor, @@ -103,8 +102,8 @@ pub fn create_executor( let (_, elf_bytes) = executable .get_text_bytes() .map_err(|e| map_ebpf_error(invoke_context, e))?; - bpf_verifier::check(elf_bytes) - .map_err(|e| map_ebpf_error(invoke_context, EbpfError::UserError(e)))?; + verifier::check(elf_bytes) + .map_err(|e| map_ebpf_error(invoke_context, EbpfError::UserError(e.into())))?; executable.set_syscall_registry(syscall_registry); if use_jit { if let Err(err) = executable.jit_compile() { @@ -1071,12 +1070,12 @@ mod tests { } #[test] - #[should_panic(expected = "VerifierError(LDDWCannotBeLast)")] + #[should_panic(expected = "LDDWCannotBeLast")] fn test_bpf_loader_check_load_dw() { let prog = &[ 0x18, 0x00, 0x00, 0x00, 0x88, 0x77, 0x66, 0x55, // first half of lddw ]; - bpf_verifier::check(prog).unwrap(); + verifier::check(prog).unwrap(); } #[test] diff --git a/rbpf-cli/Cargo.toml b/rbpf-cli/Cargo.toml index 0979d4bc075d13..48b7b2732ae575 100644 --- a/rbpf-cli/Cargo.toml +++ b/rbpf-cli/Cargo.toml @@ -15,4 +15,4 @@ serde_json = "1.0.56" solana-bpf-loader-program = { path = "../programs/bpf_loader", version = "=1.8.7" } solana-logger = { path = "../logger", version = "=1.8.7" } solana-sdk = { path = "../sdk", version = "=1.8.7" } -solana_rbpf = "=0.2.11" +solana_rbpf = "=0.2.12"