Bump rbpf to v0.2.19 (#21880)

* Bump rbpf to v0.2.19

Co-authored-by: Alexander Meißner <AlexanderMeissner@gmx.net>
This commit is contained in:
Jack May 2021-12-14 07:51:23 -08:00 committed by GitHub
parent a86fe899ac
commit 509bcd2e74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 25 additions and 16 deletions

4
Cargo.lock generated
View File

@ -6187,9 +6187,9 @@ dependencies = [
[[package]]
name = "solana_rbpf"
version = "0.2.18"
version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c7a237a92714db63de655e20af29a3b59c007881f2dfbdc2d3838ca3675f45f"
checksum = "4b4ea641d81290842c822f1348ce9f35ff3e11d09553e709c894af9765b7934c"
dependencies = [
"byteorder",
"combine",

View File

@ -36,7 +36,7 @@ solana-config-program = { path = "../programs/config", version = "=1.10.0" }
solana-faucet = { path = "../faucet", version = "=1.10.0" }
solana-logger = { path = "../logger", version = "=1.10.0" }
solana-program-runtime = { path = "../program-runtime", version = "=1.10.0" }
solana_rbpf = "=0.2.18"
solana_rbpf = "=0.2.19"
solana-remote-wallet = { path = "../remote-wallet", version = "=1.10.0" }
solana-sdk = { path = "../sdk", version = "=1.10.0" }
solana-transaction-status = { path = "../transaction-status", version = "=1.10.0" }

View File

@ -3626,9 +3626,9 @@ dependencies = [
[[package]]
name = "solana_rbpf"
version = "0.2.18"
version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c7a237a92714db63de655e20af29a3b59c007881f2dfbdc2d3838ca3675f45f"
checksum = "4b4ea641d81290842c822f1348ce9f35ff3e11d09553e709c894af9765b7934c"
dependencies = [
"byteorder 1.4.3",
"combine",

View File

@ -33,7 +33,7 @@ solana-bpf-rust-realloc-invoke = { path = "rust/realloc_invoke", version = "=1.1
solana-cli-output = { path = "../../cli-output", version = "=1.10.0" }
solana-logger = { path = "../../logger", version = "=1.10.0" }
solana-measure = { path = "../../measure", version = "=1.10.0" }
solana_rbpf = "=0.2.18"
solana_rbpf = "=0.2.19"
solana-runtime = { path = "../../runtime", version = "=1.10.0" }
solana-program-runtime = { path = "../../program-runtime", version = "=1.10.0" }
solana-sdk = { path = "../../sdk", version = "=1.10.0" }

View File

@ -110,7 +110,7 @@ fn bench_program_alu(bencher: &mut Bencher) {
register_syscalls(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(&executable, &mut inner_iter, invoke_context, &[]).unwrap();

View File

@ -222,7 +222,7 @@ fn run_program(name: &str) -> u64 {
register_syscalls(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;

View File

@ -20,7 +20,7 @@ libsecp256k1 = "0.6.0"
solana-measure = { path = "../../measure", version = "=1.10.0" }
solana-program-runtime = { path = "../../program-runtime", version = "=1.10.0" }
solana-sdk = { path = "../../sdk", version = "=1.10.0" }
solana_rbpf = "=0.2.18"
solana_rbpf = "=0.2.19"
thiserror = "1.0"
[dev-dependencies]

View File

@ -38,7 +38,7 @@ use {
clock::Clock,
entrypoint::{HEAP_LENGTH, SUCCESS},
feature_set::{
do_support_realloc, reduce_required_deploy_balance,
do_support_realloc, reduce_required_deploy_balance, reject_all_elf_rw,
reject_deployment_of_unresolved_syscalls,
reject_section_virtual_address_file_offset_mismatch, requestable_heap_size,
start_verify_shift32_imm, stop_verify_mul64_imm_nonzero,
@ -52,7 +52,7 @@ use {
rent::Rent,
system_instruction::{self, MAX_PERMITTED_DATA_LENGTH},
},
std::{cell::RefCell, fmt::Debug, rc::Rc, sync::Arc},
std::{cell::RefCell, fmt::Debug, pin::Pin, rc::Rc, sync::Arc},
thiserror::Error,
};
@ -107,6 +107,9 @@ pub fn create_executor(
verify_shift32_imm: invoke_context
.feature_set
.is_active(&start_verify_shift32_imm::id()),
reject_all_writable_sections: invoke_context
.feature_set
.is_active(&reject_all_elf_rw::id()),
..Config::default()
};
let mut executable = {
@ -124,7 +127,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);
}
@ -164,7 +168,7 @@ fn check_loader_id(id: &Pubkey) -> bool {
/// Create the BPF virtual machine
pub fn create_vm<'a, 'b>(
program: &'a Executable<BpfError, ThisInstructionMeter>,
program: &'a Pin<Box<Executable<BpfError, ThisInstructionMeter>>>,
parameter_bytes: &mut [u8],
invoke_context: &'a mut InvokeContext<'b>,
orig_data_lens: &'a [usize],
@ -955,7 +959,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...

View File

@ -16,5 +16,5 @@ solana-bpf-loader-program = { path = "../programs/bpf_loader", version = "=1.10.
solana-logger = { path = "../logger", version = "=1.10.0" }
solana-program-runtime = { path = "../program-runtime", version = "=1.10.0" }
solana-sdk = { path = "../sdk", version = "=1.10.0" }
solana_rbpf = "=0.2.18"
solana_rbpf = "=0.2.19"
time = "0.3.5"

View File

@ -257,7 +257,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") {

View File

@ -279,6 +279,10 @@ pub mod allow_votes_to_directly_update_vote_state {
solana_sdk::declare_id!("Ff8b1fBeB86q8cjq47ZhsQLgv5EkHu3G1C99zjUfAzrq");
}
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> = [
@ -343,6 +347,7 @@ lazy_static! {
(reject_non_rent_exempt_vote_withdraws::id(), "fail vote withdraw instructions which leave the account non-rent-exempt"),
(evict_invalid_stakes_cache_entries::id(), "evict invalid stakes cache entries on epoch boundaries"),
(allow_votes_to_directly_update_vote_state::id(), "enable direct vote state update"),
(reject_all_elf_rw::id(), "reject all read-write data in program elfs"),
/*************** ADD NEW FEATURES HERE ***************/
]
.iter()