Refactor - Restrict callx
to registered functions
#397
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Depends on
Config::static_syscalls
, because it needs function symbols to be registered by their PC not their hash.In the interpreter, simply throw
EbpfError::UnsupportedInstruction
incallx
if thelookup_bpf_function
of thetarget_pc
fails. In the JIT, mark all instructions which are not a function symbol asANCHOR_CALLX_UNSUPPORTED_INSTRUCTION
injit.result.pc_section
.Unfortunately, that also means that the host to guest PC translation (
ANCHOR_TRANSLATE_PC
) used byANCHOR_MEMORY_ACCESS_VIOLATION
won't work anymore and needs to be replaced by an explicit push of the guest / vm PC (resulting in more instructions emitted per memory access, thus longer executables produced by the JIT).