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

Simplify syscall register and bind #24546

Merged
merged 1 commit into from
Apr 21, 2022

Conversation

jackcmay
Copy link
Contributor

Problem

Syscall registration and binding are currently disjoint operations requiring the callers to explicitly do both for each syscall.

This can lead to mismatch or missing registration/binds and complicates the code. Another side effect is that it is difficult/impossible given the current API for callers to filter syscalls at the registration stage but allow them at the binding stage. One example is the effort to deprecate/disallow syscalls by preventing new deployments of programs that rely on a disallowed syscall while continuing to support existing programs that already rely on them.

Summary of Changes

These changes depend and build off the changes here: solana-labs/rbpf#293

Syscalls are registered once, and later the bind operation uses a common context to bind all the previously registered syscalls. Thus, no longer requires an explicit bind for each syscall and without the complications of keeping two identical lists of syscalls for registration and bind.

Fixes #

@jackcmay jackcmay requested a review from Lichtso April 21, 2022 03:34
@@ -146,6 +146,9 @@ pub fn create_executor(
reject_callx_r10: invoke_context
.feature_set
.is_active(&reject_callx_r10::id()),
dynamic_stack_frames: false,
enable_sdiv: false,
optimize_rodata: false,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can add features for these items in later PRs, @alessandrod I think these are all yours correct?

Copy link
Contributor

Choose a reason for hiding this comment

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

Correct! Yup sure there's no rush. For the first two we don't have a (released) toolchain that can exercise those features yet anyway, and for optimize_rodata I want to land solana-labs/rbpf#301 first

@jackcmay jackcmay merged commit 28ed2a9 into solana-labs:master Apr 21, 2022
@jackcmay jackcmay deleted the simpliy-syscall-register-bind branch April 21, 2022 16:09
jeffwashington pushed a commit to jeffwashington/solana that referenced this pull request Apr 22, 2022
Lichtso added a commit to Lichtso/solana that referenced this pull request Apr 25, 2022
jeffwashington added a commit that referenced this pull request Apr 25, 2022
* Revert "declare syscalls with macro (#24564)"

38bdb40

* Revert "Simplify syscall register and bind (#24546)"

28ed2a9

Co-authored-by: Alexander Meißner <AlexanderMeissner@gmx.net>
.register_syscall_by_name(b"sol_get_rent_sysvar", SyscallGetRentSysvar::call)?;
register_feature_gated_syscall!(
syscall_registry,
disable_fees_sysvar,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Lichtso I suspect this is the issue; invert of the logic on the disable_fees_sysvar, should be !disable_fees_sysvar.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, looks promising. Can you test that?

Copy link
Contributor

@jeffwashington jeffwashington Apr 27, 2022

Choose a reason for hiding this comment

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

jeffwashington added a commit to jeffwashington/solana that referenced this pull request Apr 27, 2022
jackcmay added a commit to jackcmay/solana that referenced this pull request Apr 27, 2022
jeffwashington pushed a commit to jackcmay/solana that referenced this pull request Apr 27, 2022
jeffwashington added a commit to jeffwashington/solana that referenced this pull request Apr 27, 2022
* Revert "declare syscalls with macro (solana-labs#24564)"

38bdb40

* Revert "Simplify syscall register and bind (solana-labs#24546)"

28ed2a9

Co-authored-by: Alexander Meißner <AlexanderMeissner@gmx.net>
jackcmay added a commit to jackcmay/solana that referenced this pull request Apr 27, 2022
Lichtso pushed a commit that referenced this pull request Apr 28, 2022
* Revert "Bumps solana_rbpf to v0.2.27 (#24694)"

This reverts commit f3d27cc.

* Simplify syscall register and bind (#24546)

* declare syscalls with macro (#24564)
jeffwashington added a commit to jeffwashington/solana that referenced this pull request Jun 29, 2022
* Revert "declare syscalls with macro (solana-labs#24564)"

38bdb40

* Revert "Simplify syscall register and bind (solana-labs#24546)"

28ed2a9

Co-authored-by: Alexander Meißner <AlexanderMeissner@gmx.net>
jeffwashington pushed a commit to jeffwashington/solana that referenced this pull request Jun 29, 2022
* Revert "Bumps solana_rbpf to v0.2.27 (solana-labs#24694)"

This reverts commit f3d27cc.

* Simplify syscall register and bind (solana-labs#24546)

* declare syscalls with macro (solana-labs#24564)
jeffwashington added a commit to jeffwashington/solana that referenced this pull request Jun 29, 2022
* Revert "declare syscalls with macro (solana-labs#24564)"

38bdb40

* Revert "Simplify syscall register and bind (solana-labs#24546)"

28ed2a9

Co-authored-by: Alexander Meißner <AlexanderMeissner@gmx.net>
jeffwashington added a commit to jeffwashington/solana that referenced this pull request Jun 29, 2022
* Revert "declare syscalls with macro (solana-labs#24564)"

38bdb40

* Revert "Simplify syscall register and bind (solana-labs#24546)"

28ed2a9

Co-authored-by: Alexander Meißner <AlexanderMeissner@gmx.net>
jeffwashington added a commit to jeffwashington/solana that referenced this pull request Jun 29, 2022
* Revert "declare syscalls with macro (solana-labs#24564)"

38bdb40

* Revert "Simplify syscall register and bind (solana-labs#24546)"

28ed2a9

Co-authored-by: Alexander Meißner <AlexanderMeissner@gmx.net>
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.

4 participants