-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
@@ -402,7 +402,7 @@ impl Verifier for RequisiteVerifier { | |||
ebpf::CALL_REG => { check_callx_register(&insn, insn_ptr, sbpf_version)?; }, | |||
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.
@@ -2068,7 +2070,7 @@ mod test { | |||
assert!(matches!( | |||
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 |
} 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
@@ -402,7 +402,7 @@ impl Verifier for RequisiteVerifier { | |||
ebpf::CALL_REG => { check_callx_register(&insn, insn_ptr, sbpf_version)?; }, | |||
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
src/verifier.rs
Outdated
@@ -391,22 +391,27 @@ impl Verifier for RequisiteVerifier { | |||
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
- `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
- `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.