SBPF stricter ELF headers
- Idea
- Draft
- Review
- Accept
- Implement
- Active
Decision brief
Why this proposal matters
Imposes more restrictions on what is expected of ELF headers.
Proposal at a glance
What changes
- e_ident.ei_mag must be [0x7F, 0x45, 0x4C, 0x46]
- e_ident.ei_class must be ELFCLASS64 (0x02)
- e_ident.ei_data must be ELFDATA2LSB (0x01)
Stakeholder map
Who is affected
Builders & client teams Medium impact
The toolchain linker will use a new linker script to adhere to these restrictions defined here and thus the change will be transparent to the dApp developers.
Action requirement unknownValidators & operators Impact unknown
No proposal-specific evidence was found for this group.
Action requirement unknownUsers & stakers Impact unknown
No proposal-specific evidence was found for this group.
Action requirement unknownGovernance & ecosystem Impact unknown
No proposal-specific evidence was found for this group.
Action requirement unknownExact source revision
Full proposal document
0616093b2952Summary
Imposes more restrictions on what is expected of ELF headers.
Motivation
After the removal of relocations in SIMD-0178 the ELF layout could be massively be simplified by constraining it to a strict subset of what ELF otherwise allows. Doing so not only reduces the complexity of validator implementations but also reduces the attack surface.
Alternatives Considered
Moving away from ELF as a container format altogether. However this would only gain a very small file size advantage but otherwise loose all tooling compatibility.
New Terminology
None.
Detailed Design
The following must go into effect if and only if a program indicates the SBPF-version v3 or higher in its program header (see SIMD-0161).
File header
The file size must not be less than size_of::<Elf64Ehdr>() (64 bytes),
otherwise ElfParserError::OutOfBounds must be thrown.
e_ident.ei_magmust be[0x7F, 0x45, 0x4C, 0x46]e_ident.ei_classmust beELFCLASS64(0x02)e_ident.ei_datamust beELFDATA2LSB(0x01)e_ident.ei_versionmust beEV_CURRENT(0x01)e_ident.ei_osabimust beELFOSABI_NONE(0x00)e_ident.ei_abiversionmust be0x00e_ident.ei_padmust be[0x00; 7]e_typeis not checkede_machinemust beEM_BPF(0x00F7)e_versionmust beEV_CURRENT(0x00000001)e_entrymust be within the bounds of the second program headere_phoffmust besize_of::<Elf64Ehdr>()(64 bytes)e_shoffis not checkede_flagssee SIMD-0161e_ehsizemust besize_of::<Elf64Ehdr>()(64 bytes)e_phnummust be greater than or equal0x0001e_phoff + e_phnum * size_of::<Elf64Phdr>()must be less than or equal the file sizee_phentsizemust besize_of::<Elf64Phdr>()(56 bytes)e_shnumis not checkede_shentsizeis not checkede_shstrndxis not checked
If any check fails ElfParserError::InvalidFileHeader must be thrown.
Program headers
| index | purpose | p_flags | p_vaddr |
|---|---|---|---|
| 0 | ro data | PF_R | 0 << 32 |
| 1 | bytecode | PF_X | 1 << 32 |
If p_flags of the first program header is not PF_R, then only the second
program header is expected (effectively skipping the first). For each of these
predefined program headers:
p_typemust bePT_LOADp_flagsmust match thep_flagsof the entry in the table abovep_offsetbee_phoff + e_phnum * size_of::<Elf64Phdr>()for the first entry and bep_offset + p_fileszof the previous entry for all subsequent entriesp_offsetmust be less than or equalfile.len() as u64p_offsetmust be evenly divisible by 8 bytes,p_vaddrmust match thep_vaddrof the entry in the table abovep_paddrmust match thep_vaddrof the entry in the table abovep_fileszmust bep_memszp_fileszmust not be greater thanfile.len() as u64 - p_offsetp_fileszmust be evenly divisible by 8 bytes,p_memszmust fit in 32 bits / be less than1 << 32p_alignis ignored
If any check fails ElfParserError::InvalidProgramHeader must be thrown.
Impact
The toolchain linker will use a new linker script to adhere to these restrictions defined here and thus the change will be transparent to the dApp developers.
The section headers are ignored so arbitrary metadata can continue to be encoded there.
Security Considerations
None.
Evidence graph
Related proposals and rollout
One or more sources are unavailable.
Upstream review record
Upstream discussion & review
GitHub review is editorial context, not evidence of on-chain support, voting, or outcome.
PR #189 · merged SIMD-0189: SBPF stricter ELF headers 48 comments and reviews · Mar 16, 2026I'm just thinking about how we might be able to make sure our compiled binaries can be analyzed by upstream-compatible tooling. If our ELF layout is pretty closely aligned with ETEXEC, we might as well lean into that and use the proper etype so that off-the-shelf tools can analyze Solana binaries directly from the chain (or compiled locally). On one hand, the kernel expects a ETREL, not a ETEXEC. I asked the type not be ETREL, because I believe linkers won't solve relocations for ETREL files. On the other, llvm tools and gnu-binutils tools work with eBPF code regardless of the ELF type. As far as I can tell, Asymmetric Research was using Ghidra with our SBPFv0 ETDYN files without any problem
GitHub ↗Thanks, topointon-jump(https://github.com/topointon-jump)! ⚠️ Status: Cannot merge yet - Missing approval from: Anza (t-nelson(https://github.com/t-nelson), sakridge(https://github.com/sakridge), or bw-solana(https://github.com/bw-solana))
GitHub ↗Thanks, 0x0ece(https://github.com/0x0ece)! ⚠️ Status: Cannot merge yet - Missing approval from: Anza (t-nelson(https://github.com/t-nelson), sakridge(https://github.com/sakridge), or bw-solana(https://github.com/bw-solana))
GitHub ↗resolved as headers are now removed and rodata header is now optional.
GitHub ↗Thanks, ripatel-fd(https://github.com/ripatel-fd)! ⚠️ Status: Cannot merge yet - Missing approval from: Anza (t-nelson(https://github.com/t-nelson), sakridge(https://github.com/sakridge), or bw-solana(https://github.com/bw-solana))
GitHub ↗✅ All approvals received! @Lichtso, you can now merge this by commenting /merge. ✅ Status: Ready to merge
GitHub ↗/merge
GitHub ↗✅ Merge successful! Lichtso(https://github.com/Lichtso)'s PR has been merged.
GitHub ↗Provenance
Evidence & technical details
Rollout or chain data, source revisions, freshness and integrity. 1
Provenance
Evidence & technical details
Rollout or chain data, source revisions, freshness and integrity.SIMD
Deployment Status
GJav1vwg2etvSWraPT96QvYuQJswJTJwtcyARrvkhuV9Exact source revision
Sources & integrity
- Proposal document pinned_commit_blob
0616093b2952ed6de52c4a27d66aadd11d48d4f9 - simd-document document · current · Sep 11, 2026
0616093b2952ed6de52c4a27d66aadd11d48d4f9
One or more sources are unavailable.
simd.watch community discussion · SIMD-0189
Powered by Giscus · Sign in with GitHub to comment
Community comments load when this section approaches the viewport.