LiteSVM / litesvm

Apache License 2.0
117 stars 22 forks source link

Missing implementation of syscall stubs #107

Open michprev opened 3 weeks ago

michprev commented 3 weeks ago

Solana SDK syscall stubs are not currently implemented, see Solana program-test as a reference https://github.com/solana-labs/solana/blob/27eff8408b7223bb3c4ab70523f8a8dca3ca6645/program-test/src/lib.rs#L226, https://github.com/solana-labs/solana/blob/27eff8408b7223bb3c4ab70523f8a8dca3ca6645/program-test/src/lib.rs#L755.

This is an issue in the case when a program is added as buit-in (target OS is not Solana) and the program invokes a syscall.

kevinheavey commented 3 weeks ago

Is there a specific thing you're trying to accomplish here?

michprev commented 3 weeks ago

We are developing a coverage-guided fuzzer (https://github.com/Ackee-Blockchain/trident). For coverage analysis to work, we need to compile the target program with instrumentation (some extra very specific compiler options).

cargo build-sbf does not give us an option to specify compiler options (most likely for a good reason). So our approach is to add the program being tested as a dependency, compile it in our own way and load it as a built-in via entry point.

kevinheavey commented 3 weeks ago

cargo build-sbf does not give us an option to specify compiler options (most likely for a good reason)

fwiw I would not assume there is a good reason

kevinheavey commented 3 weeks ago

The reason we are reluctant to add this is that the program stubs code is very hacky and cursed