Skip to content

Commit

Permalink
Bump solana_rbpf to version 0.2.12 (solana-labs#17585)
Browse files Browse the repository at this point in the history
Unify BPF verifiers.
  • Loading branch information
Lichtso committed Dec 3, 2021
1 parent d684c7c commit 800ddfe
Show file tree
Hide file tree
Showing 8 changed files with 19 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.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" }
Expand Down
9 changes: 6 additions & 3 deletions cli/src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -1986,7 +1989,7 @@ fn read_and_verify_elf(program_location: &str) -> Result<Vec<u8>, Box<dyn std::e
// Verify the program
<dyn Executable<BpfError, ThisInstructionMeter>>::from_elf(
&program_data,
Some(|x| bpf_verifier::check(x)),
Some(|x| verifier::check(x)),
Config::default(),
)
.map_err(|err| format!("ELF error: {}", err))?;
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.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" }
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 @@ -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]
Expand Down
11 changes: 5 additions & 6 deletions programs/bpf_loader/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -11,7 +10,6 @@ pub mod with_jit;

use {
crate::{
bpf_verifier::VerifierError,
serialization::{deserialize_parameters, serialize_parameters},
syscalls::SyscallError,
},
Expand All @@ -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,
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion rbpf-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 800ddfe

Please sign in to comment.