|
| 1 | +--- |
| 2 | +simd: 'XXXX' |
| 3 | +title: Privileged Syscalls |
| 4 | +authors: |
| 5 | + - Joe Caulfield | Anza |
| 6 | +category: Standard |
| 7 | +type: Core |
| 8 | +status: Draft |
| 9 | +created: 2024-10-02 |
| 10 | +feature: (fill in with feature tracking issues once accepted) |
| 11 | +supersedes: (optional - fill this in if the SIMD supersedes a previous SIMD) |
| 12 | +superseded-by: (optional - fill this in if the SIMD is superseded by a subsequent |
| 13 | + SIMD) |
| 14 | +extends: (optional - fill this in if the SIMD extends the design of a previous |
| 15 | + SIMD) |
| 16 | +--- |
| 17 | + |
| 18 | +## Summary |
| 19 | + |
| 20 | +Support for privileged syscalls, to perform special-cased runtime activities, |
| 21 | +for enshrined program IDs only. |
| 22 | + |
| 23 | +## Motivation |
| 24 | + |
| 25 | +As we continue the effort to migrate all builtin programs to on-chain BPF |
| 26 | +programs (Core BPF), the ability for some of these programs to perform |
| 27 | +privileged operations becomes immediately relevant. |
| 28 | + |
| 29 | +Some examples of such operations are: |
| 30 | + |
| 31 | +- Allocating very large accounts (System program) |
| 32 | +- Marking accounts as `executable` (loaders) |
| 33 | + |
| 34 | +In order to accomplish the aforementioned goal, some programs - such as System |
| 35 | +and loaders - will need the ability to perform activites that are not permitted |
| 36 | +to all on-chain BPF programs. |
| 37 | + |
| 38 | +Similar to the purpose of [SIMD 0088](./0088-enable-core-bpf-programs.md), this |
| 39 | +SIMD serves to establish the existence of "privileged syscalls", which are |
| 40 | +syscalls only available to enshrined programs. |
| 41 | + |
| 42 | +## New Terminology |
| 43 | + |
| 44 | +- **Privileged Syscall**: A virtual machine builtin function only available to |
| 45 | + runtime-enshrined program IDs. |
| 46 | + |
| 47 | +## Detailed Design |
| 48 | + |
| 49 | +The Solana Virtual Machine (SVM) follows a well-defined Instruction Set |
| 50 | +Architecture (ISA) for supported VM op codes. Additionally, the Solana protocol |
| 51 | +also dictates a set of interfaces for VM builtin functions known as System |
| 52 | +Calls, or "syscalls". |
| 53 | + |
| 54 | +All of the protocol-defined syscalls are made available to all on-chain programs |
| 55 | +through a loader, which implements each syscall interface at the runtime level, |
| 56 | +allowing on-chain programs to call into them to perform certain actions, such as |
| 57 | +logging and invoking other programs. |
| 58 | + |
| 59 | +This proposal suggests adding interfaces for "priviledged" syscall interfaces to |
| 60 | +the Solana protocol. These syscalls would specifically _not_ be made available |
| 61 | +to all on-chain programs, but rather a subset of programs, represented by an |
| 62 | +enshrined set of program IDs within the runtime. |
| 63 | + |
| 64 | +These privileged syscalls must _only_ be registered VM builtin functions for |
| 65 | +enshrined programs. When the runtime encounters an enshrined program to be |
| 66 | +executed, it must register the necessary privileged syscalls as VM builtin |
| 67 | +functions for the provisioned VM instance. When any non-enshrined program is |
| 68 | +encountered, these functions must not be registered. |
| 69 | + |
| 70 | +Each new privileged syscall introduced to the protocol must have its own SIMD. |
| 71 | +The program IDs that must be granted access to that particular privileged |
| 72 | +syscall must be included in the proposal. |
| 73 | + |
| 74 | +## Alternatives Considered |
| 75 | + |
| 76 | +The primary alternative to privileged syscalls is for any builtin programs that |
| 77 | +perform privileged operations to remain builtins, and not be migrated to Core |
| 78 | +BPF. However, this would force validator client teams to maintain these builtins |
| 79 | +with their clients. |
| 80 | + |
| 81 | +With the suggested approach for priviledged syscalls, validator client teams |
| 82 | +would instead only have to maintain these syscalls themselves, not entire |
| 83 | +programs. |
| 84 | + |
| 85 | +## Impact |
| 86 | + |
| 87 | +As mentioned above, privileged syscalls would further enable all builtin |
| 88 | +programs to be migrated to Core BPF, reducing the maintenance burdern for |
| 89 | +core contributors from various validator client teams. |
| 90 | + |
| 91 | +Developers and validators are unaffected. All on-chain programs that are not |
| 92 | +granted access to privileged syscalls are unaffected. Those programs that are |
| 93 | +granted access would be backwards compatible. |
| 94 | + |
| 95 | +## Security Considerations |
| 96 | + |
| 97 | +The primary security consideration is ensuring that only those enshrined |
| 98 | +programs can access these privileged syscalls. If not implemented correctly, |
| 99 | +core contributors could mistakenly grant privileged abilities to ordinary |
| 100 | +on-chain programs, which could have consequential implications on consensus. |
| 101 | + |
0 commit comments