Skip to content

Commit

Permalink
Track whether a region is account data or resize area
Browse files Browse the repository at this point in the history
  • Loading branch information
seanyoung committed Nov 22, 2024
1 parent 7d58371 commit 58408b7
Show file tree
Hide file tree
Showing 7 changed files with 153 additions and 68 deletions.
6 changes: 3 additions & 3 deletions benches/memory_mapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ macro_rules! bench_randomized_access_with_0001_entry {
#[bench]
fn $name(bencher: &mut Bencher) {
let content = vec![0; 1024 * 2];
let memory_regions = vec![MemoryRegion::new_readonly(&content[..], 0x100000000)];
let memory_regions = vec![MemoryRegion::new_readonly(&content[..], 0x100000000, false)];
let config = Config::default();
let memory_mapping = $mem::new(memory_regions, &config, SBPFVersion::V2).unwrap();
let mut prng = new_prng!();
Expand Down Expand Up @@ -297,8 +297,8 @@ fn do_bench_mapping_operation(bencher: &mut Bencher, op: MemoryOperation, vm_add
let config = Config::default();
let memory_mapping = UnalignedMemoryMapping::new(
vec![
MemoryRegion::new_writable(&mut mem1, 0x100000000),
MemoryRegion::new_writable(&mut mem2, 0x100000000 + 8),
MemoryRegion::new_writable(&mut mem1, 0x100000000, false),
MemoryRegion::new_writable(&mut mem2, 0x100000000 + 8, false),
],
&config,
SBPFVersion::V2,
Expand Down
2 changes: 1 addition & 1 deletion benches/vm_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fn bench_jit_vs_interpreter(
executable.verify::<RequisiteVerifier>().unwrap();
executable.jit_compile().unwrap();
let mut context_object = TestContextObject::default();
let mem_region = MemoryRegion::new_writable(mem, ebpf::MM_INPUT_START);
let mem_region = MemoryRegion::new_writable(mem, ebpf::MM_INPUT_START, false);
create_vm!(
vm,
&executable,
Expand Down
2 changes: 1 addition & 1 deletion src/elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1371,7 +1371,7 @@ pub(crate) fn get_ro_region(ro_section: &Section, elf: &[u8]) -> MemoryRegion {
// If offset > 0, the region will start at MM_RODATA_START + the offset of
// the first read only byte. [MM_RODATA_START, MM_RODATA_START + offset)
// will be unmappable, see MemoryRegion::vm_to_host.
MemoryRegion::new_readonly(ro_data, offset as u64)
MemoryRegion::new_readonly(ro_data, offset as u64, false)
}

#[cfg(test)]
Expand Down
Loading

0 comments on commit 58408b7

Please sign in to comment.