-
Notifications
You must be signed in to change notification settings - Fork 191
Refactor - Assign SBPF versions to SIMDs #602
Conversation
88e0c85 to
b6d8898
Compare
b6d8898 to
4b2c3df
Compare
dcf9245 to
785454e
Compare
6f0ba50 to
08bcb37
Compare
60a4eed to
dbd0844
Compare
src/verifier.rs
Outdated
| ebpf::EXIT if !sbpf_version.static_syscalls() => {}, | ||
| ebpf::RETURN if sbpf_version.static_syscalls() => {}, | ||
| ebpf::SYSCALL if sbpf_version.static_syscalls() => { | ||
| ebpf::SYSCALL if sbpf_version.stricter_controlflow() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is still static syscall isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that check here should still be sbpf_version.static_syscalls(), as this path will be available with static syscalls.
| ElfExecutable::parse_ro_sections( | ||
| &config, | ||
| &SBPFVersion::V1, // v2 requires optimize_rodata=true | ||
| &SBPFVersion::V0, // v2 requires optimize_rodata=true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should V3 in the comment now?
doc/bytecode.md
Outdated
| - `add64 reg, imm` can use `r11` as destination register | ||
|
|
||
| ### until v3 | ||
| - The targets of `call` instructions (which includes `syscall` instructions) is checked at runtime not verification time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - The targets of `call` instructions (which includes `syscall` instructions) is checked at runtime not verification time | |
| - The targets of `call` instructions (which includes `syscall` instructions) are checked at runtime not verification time |
| SBPFVersion::Reserved | ||
| } else { | ||
| SBPFVersion::V1 | ||
| SBPFVersion::V0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we get a 3 in the e_flags, the version will be V0 here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep exactly, that is the bug we are feature gating out here.
src/verifier.rs
Outdated
| ebpf::EXIT if !sbpf_version.static_syscalls() => {}, | ||
| ebpf::RETURN if sbpf_version.static_syscalls() => {}, | ||
| ebpf::SYSCALL if sbpf_version.static_syscalls() => { | ||
| ebpf::SYSCALL if sbpf_version.stricter_controlflow() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that check here should still be sbpf_version.static_syscalls(), as this path will be available with static syscalls.
dbd0844 to
80aa8e1
Compare
| ebpf::JSLT_REG => { check_jmp_offset(prog, insn_ptr, &function_range)?; }, | ||
| ebpf::JSLE_IMM => { check_jmp_offset(prog, insn_ptr, &function_range)?; }, | ||
| ebpf::JSLE_REG => { check_jmp_offset(prog, insn_ptr, &function_range)?; }, | ||
| ebpf::CALL_IMM if sbpf_version.static_syscalls() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one doesn't need to be gated behind static_syscalls does it?
src/verifier.rs
Outdated
| ebpf::SYSCALL if sbpf_version.static_syscalls() => { | ||
| check_call_target( | ||
| insn.imm as u32, | ||
| syscall_registry, | ||
| VerifierError::InvalidSyscall(insn.imm as u32))?; | ||
| if sbpf_version.stricter_controlflow() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this one need two gates?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One to make it a valid opcode and one for the verification rule. These are two different SIMDs but same SBPF version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The verification rule for static syscalls is in the static syscalls SIMD.
doc/bytecode.md
Outdated
| - Opcodes from the product / quotient / remainder instruction class are forbiden | ||
| - `neg32` and `neg64` are allowed | ||
| - `le` is allowed | ||
| - `lddw` (opcodes `0x18` and `0x00`) are allowed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - `lddw` (opcodes `0x18` and `0x00`) are allowed | |
| - `lddw` (opcodes `0x18` and `0x00`) is allowed |
doc/bytecode.md
Outdated
| - Opcodes from the product / quotient / remainder instruction class are allowed | ||
| - `neg32` and `neg64` are forbidden | ||
| - `le` is forbidden | ||
| - `lddw` (opcodes `0x18` and `0x00`) are forbidden |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - `lddw` (opcodes `0x18` and `0x00`) are forbidden | |
| - `lddw` (opcodes `0x18` and `0x00`) is forbidden |
80aa8e1 to
0442846
Compare
0442846 to
3630a01
Compare
No description provided.