-
Notifications
You must be signed in to change notification settings - Fork 82
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
SIMD-0178: SBPF Static Syscalls #178
base: main
Are you sure you want to change the base?
Conversation
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.
Looks great to me! I think we just need to land on which SBPF version this goes into?
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 is awesome! Removing relocations is a big win. My only comment is the opcode change - this feels a bit unnecessary. But it is not a deal-breaker.
The opcode `0x9D` must represent the return instruction, which supersedes the | ||
`exit` instruction. The opcode (opcode `0x95`), previously assigned to the | ||
`exit` instruction, must now be interpreted as the new syscall instruction. |
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.
What is the motivation behind changing this?
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.
Also, changing the name from exit
to return
when it is the same instruction could be confusing. I have already seen this confused in other SIMDs.
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.
Side note - we should bundle large sets of proposed ISA changes together into the same SBPF version upgrade, so that clients don't have to support a mis-mash of ISAs based on feature flags. I believe this is the intent of #161, but just re-iterating 🙏
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.
Motivation is that exit
was occupying the slot in the instruction class for controlflow with immediate values and it does not take an immediate value. The new syscall
opcode however does, so it took its place.
## Detailed Design | ||
|
||
The following must go into effect if and only if a program indicates the SBPF | ||
version XX or higher in its ELF header e_flags field, according to the |
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 we specify which version XX is?
The resolution of syscalls during ELF loading requires relocating addresses, | ||
which is a performance burden for the validator. Relocations require an entire | ||
copy of the ELF file in memory to either relocate addresses we fetch from the | ||
symbol table or offset addresses to after the start of the virtual machine’s | ||
memory. Moreover, relocations pose security concerns, as they allow the | ||
arbitrary modification of program headers and programs sections. A new | ||
separate opcode for syscalls modifies the behavior of the ELF loader, allowing | ||
us to resolve syscalls without relocations. |
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.
🎉
phase. `call imm` (opcode `0x85`) instructions must only refer to internal | ||
calls and its immediate field must only be interpreted as a relative address | ||
to jump from the program counter. |
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 mean there is no longer a need to hash the immediates?
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.
It does and is the intention.
No description provided.