solana-labs / rbpf

Rust virtual machine and JIT compiler for eBPF programs
Apache License 2.0
277 stars 169 forks source link

Refactor - Virtual Address Constants #615

Closed Lichtso closed 1 week ago

Lichtso commented 2 weeks ago

SBPFv1 allows multiple readonly sections and a single text section. All of them are concatenated and mapped into the same memory region named MM_PROGRAM_START.

Going forward we want to separate the bytecode (of the text section) out into its own (unmapped) region named MM_BYTECODE_START, which will only be executable and neither readable nor writable for memory accesses.

The MM_PROGRAM_START region will then become MM_RODATA_START because it will be readable only, and not executable anymore.

Also exports a constant MM_REGION_SIZE to make it easier to have multiple input sections MM_INPUT_START + MM_REGION_SIZE * index.