Skip to content

Commit

Permalink
Bump rbpf to v0.2.19 (solana-labs#21880)
Browse files Browse the repository at this point in the history
* Bump rbpf to v0.2.19

Co-authored-by: Alexander Meißner <AlexanderMeissner@gmx.net>
  • Loading branch information
jackcmay and Lichtso authored Dec 14, 2021
1 parent a86fe89 commit 509bcd2
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 16 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 @@ -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" }
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 @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion programs/bpf/benches/bpf_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion programs/bpf/tests/programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
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 @@ -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]
Expand Down
14 changes: 9 additions & 5 deletions programs/bpf_loader/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
};

Expand Down Expand Up @@ -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 = {
Expand All @@ -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);
}
Expand Down Expand Up @@ -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],
Expand Down Expand Up @@ -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...
Expand Down
2 changes: 1 addition & 1 deletion rbpf-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion rbpf-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
5 changes: 5 additions & 0 deletions sdk/src/feature_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> = [
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 509bcd2

Please sign in to comment.