Skip to content

Commit 423a4d6

Browse files
Lichtsomvines
authored andcommitted
Bumps solana_rbpf to v0.2.19 (solana-labs#21880)
1 parent 16f6bdf commit 423a4d6

File tree

10 files changed

+25
-17
lines changed

10 files changed

+25
-17
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ solana-config-program = { path = "../programs/config", version = "=1.8.11" }
4040
solana-faucet = { path = "../faucet", version = "=1.8.11" }
4141
solana-logger = { path = "../logger", version = "=1.8.11" }
4242
solana-net-utils = { path = "../net-utils", version = "=1.8.11" }
43-
solana_rbpf = "=0.2.18"
43+
solana_rbpf = "=0.2.19"
4444
solana-remote-wallet = { path = "../remote-wallet", version = "=1.8.11" }
4545
solana-sdk = { path = "../sdk", version = "=1.8.11" }
4646
solana-transaction-status = { path = "../transaction-status", version = "=1.8.11" }

programs/bpf/Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

programs/bpf/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ solana-bpf-loader-program = { path = "../bpf_loader", version = "=1.8.11" }
3030
solana-cli-output = { path = "../../cli-output", version = "=1.8.11" }
3131
solana-logger = { path = "../../logger", version = "=1.8.11" }
3232
solana-measure = { path = "../../measure", version = "=1.8.11" }
33-
solana_rbpf = "=0.2.18"
33+
solana_rbpf = "=0.2.19"
3434
solana-runtime = { path = "../../runtime", version = "=1.8.11" }
3535
solana-sdk = { path = "../../sdk", version = "=1.8.11" }
3636
solana-transaction-status = { path = "../../transaction-status", version = "=1.8.11" }

programs/bpf/benches/bpf_loader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ fn bench_program_alu(bencher: &mut Bencher) {
105105
register_syscalls(&mut invoke_context).unwrap(),
106106
)
107107
.unwrap();
108-
executable.jit_compile().unwrap();
108+
Executable::<BpfError, ThisInstructionMeter>::jit_compile(&mut executable).unwrap();
109109
let compute_meter = invoke_context.get_compute_meter();
110110
let mut instruction_meter = ThisInstructionMeter { compute_meter };
111111
let mut vm = create_vm(

programs/bpf/tests/programs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ fn run_program(
226226
register_syscalls(&mut invoke_context).unwrap(),
227227
)
228228
.unwrap();
229-
executable.jit_compile().unwrap();
229+
Executable::<BpfError, ThisInstructionMeter>::jit_compile(&mut executable).unwrap();
230230

231231
let mut instruction_count = 0;
232232
let mut tracer = None;

programs/bpf_loader/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ sha3 = "0.9.1"
2222
solana-measure = { path = "../../measure", version = "=1.8.11" }
2323
solana-runtime = { path = "../../runtime", version = "=1.8.11" }
2424
solana-sdk = { path = "../../sdk", version = "=1.8.11" }
25-
solana_rbpf = "=0.2.18"
25+
solana_rbpf = "=0.2.19"
2626
thiserror = "1.0"
2727

2828
[dev-dependencies]

programs/bpf_loader/src/lib.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ use solana_sdk::{
3333
entrypoint::{HEAP_LENGTH, SUCCESS},
3434
feature_set::{
3535
add_missing_program_error_mappings, close_upgradeable_program_accounts, fix_write_privs,
36-
reduce_required_deploy_balance, reject_deployment_of_unresolved_syscalls,
37-
reject_section_virtual_address_file_offset_mismatch, requestable_heap_size,
38-
start_verify_shift32_imm, stop_verify_mul64_imm_nonzero, upgradeable_close_instruction,
36+
reduce_required_deploy_balance, reject_all_elf_rw,
37+
reject_deployment_of_unresolved_syscalls,
38+
reject_section_virtual_address_file_offset_mismatch, start_verify_shift32_imm,
39+
stop_verify_mul64_imm_nonzero, upgradeable_close_instruction,
3940
},
4041
ic_logger_msg, ic_msg,
4142
instruction::{AccountMeta, InstructionError},
@@ -49,7 +50,7 @@ use solana_sdk::{
4950
rent::Rent,
5051
system_instruction::{self, MAX_PERMITTED_DATA_LENGTH},
5152
};
52-
use std::{cell::RefCell, fmt::Debug, rc::Rc, sync::Arc};
53+
use std::{cell::RefCell, fmt::Debug, pin::Pin, rc::Rc, sync::Arc};
5354
use thiserror::Error;
5455

5556
solana_sdk::declare_builtin!(
@@ -97,6 +98,7 @@ pub fn create_executor(
9798
verify_mul64_imm_nonzero: !invoke_context
9899
.is_feature_active(&stop_verify_mul64_imm_nonzero::id()),
99100
verify_shift32_imm: invoke_context.is_feature_active(&start_verify_shift32_imm::id()),
101+
reject_all_writable_sections: invoke_context.is_feature_active(&reject_all_elf_rw::id()),
100102
..Config::default()
101103
};
102104
let mut executable = {
@@ -111,7 +113,8 @@ pub fn create_executor(
111113
verifier::check(text_bytes, &config)
112114
.map_err(|e| map_ebpf_error(invoke_context, EbpfError::UserError(e.into())))?;
113115
if use_jit {
114-
if let Err(err) = executable.jit_compile() {
116+
if let Err(err) = Executable::<BpfError, ThisInstructionMeter>::jit_compile(&mut executable)
117+
{
115118
ic_msg!(invoke_context, "Failed to compile program {:?}", err);
116119
return Err(InstructionError::ProgramFailedToCompile);
117120
}
@@ -152,7 +155,7 @@ fn check_loader_id(id: &Pubkey) -> bool {
152155
/// Create the BPF virtual machine
153156
pub fn create_vm<'a>(
154157
loader_id: &'a Pubkey,
155-
program: &'a Executable<BpfError, ThisInstructionMeter>,
158+
program: &'a Pin<Box<Executable<BpfError, ThisInstructionMeter>>>,
156159
parameter_bytes: &mut [u8],
157160
invoke_context: &'a mut dyn InvokeContext,
158161
) -> Result<EbpfVm<'a, BpfError, ThisInstructionMeter>, EbpfError<BpfError>> {
@@ -874,7 +877,7 @@ impl InstructionMeter for ThisInstructionMeter {
874877

875878
/// BPF Loader's Executor implementation
876879
pub struct BpfExecutor {
877-
executable: Executable<BpfError, ThisInstructionMeter>,
880+
executable: Pin<Box<Executable<BpfError, ThisInstructionMeter>>>,
878881
}
879882

880883
// Well, implement Debug for solana_rbpf::vm::Executable in solana-rbpf...

rbpf-cli/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ native machine code before execting it in the virtual machine.",
210210
let text_bytes = executable.get_text_bytes().1;
211211
check(text_bytes, &config).unwrap();
212212
}
213-
executable.jit_compile().unwrap();
213+
Executable::<BpfError, ThisInstructionMeter>::jit_compile(&mut executable).unwrap();
214214
let analysis = Analysis::from_executable(&executable);
215215

216216
match matches.value_of("use") {

sdk/src/feature_set.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,10 @@ pub mod reject_section_virtual_address_file_offset_mismatch {
267267
solana_sdk::declare_id!("5N4NikcJLEiZNqwndhNyvZw15LvFXp1oF7AJQTNTZY5k");
268268
}
269269

270+
pub mod reject_all_elf_rw {
271+
solana_sdk::declare_id!("DeMpxgMq51j3rZfNK2hQKZyXknQvqevPSFPJFNTbXxsS");
272+
}
273+
270274
lazy_static! {
271275
/// Map of feature identifiers to user-visible description
272276
pub static ref FEATURE_NAMES: HashMap<Pubkey, &'static str> = [
@@ -334,6 +338,7 @@ lazy_static! {
334338
(add_compute_budget_program::id(), "Add compute_budget_program"),
335339
(reject_deployment_of_unresolved_syscalls::id(), "Reject deployment of programs with unresolved syscall symbols"),
336340
(reject_section_virtual_address_file_offset_mismatch::id(), "enforce section virtual addresses and file offsets in ELF to be equal"),
341+
(reject_all_elf_rw::id(), "reject all read-write data in program elfs"),
337342
/*************** ADD NEW FEATURES HERE ***************/
338343
]
339344
.iter()

0 commit comments

Comments
 (0)