Skip to content
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

Add new syscall instruction to the verifier #620

Merged
merged 8 commits into from
Oct 22, 2024

Conversation

LucasSte
Copy link

@LucasSte LucasSte commented Oct 18, 2024

This is an alternative implementation of #614 for SIMD-0178.

This PR adds the new syscall instruction to the verifier and write tests for it. It also introduces a dense function registry in the loader and distinguishes it from the sparse registry.

Execution tests for syscalls are only working for SBPFv1 and will be revamped once the instruction is properly implemented in the interpreter and jitter.

@LucasSte LucasSte requested a review from Lichtso October 18, 2024 22:01
@LucasSte LucasSte marked this pull request as ready for review October 18, 2024 22:01
@Lichtso
Copy link

Lichtso commented Oct 21, 2024

How about having get_dense_function_registry() and get_sparse_function_registry(), we instead have get_function_registry(sbpf_version)?

tests/execution.rs Outdated Show resolved Hide resolved
src/program.rs Outdated Show resolved Hide resolved
src/program.rs Outdated Show resolved Hide resolved
@LucasSte LucasSte requested a review from Lichtso October 21, 2024 22:00
@LucasSte LucasSte merged commit 69a52ec into solana-labs:main Oct 22, 2024
12 checks passed
@LucasSte LucasSte deleted the ver-3 branch October 22, 2024 13:18
ebpf::CALL_IMM if sbpf_version.static_syscalls() && insn.src == 0 => { check_call_target(insn.imm as u32, syscall_registry)?; },
ebpf::CALL_IMM if sbpf_version.static_syscalls() => {
check_call_target(
insn.imm as u32,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, I noticed that this uses absolute addressing while the SIMD says: "immediate field must only be interpreted as a relative address to jump from the program counter". So, either one must be changed to match the other.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants