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

flamenco, fuzz: Fuzz VM CPI syscalls #2513

Merged
merged 1 commit into from
Aug 9, 2024
Merged

Conversation

ravyu-jump
Copy link
Contributor

@ravyu-jump ravyu-jump commented Jul 24, 2024

Introduces a "stubbed" version of libfd_exec_sol_compat that wraps around fd_execute_instr for CPI syscall fuzzing.

Supporting CPI syscalls implements the following:

  • Performing a full _instr_context_create (i.e, is_syscall = false) specifically for CPI calls
  • Summing up account lamports during _instr_context_create
  • Capturing of data from input_data_regions into SyscallEffects
  • Tool to dump SyscallContext at CPI entrypoint

Further cleanup:

  • Fixed scratch frame mismanagement, particularly use-after-free when writing to output buffer

@ravyu-jump ravyu-jump force-pushed the fuzz-vm-cpi-syscall-squashed branch 2 times, most recently from f4db74a to 88ea249 Compare July 24, 2024 22:22
@ravyu-jump ravyu-jump force-pushed the fuzz-vm-cpi-syscall-squashed branch 2 times, most recently from 01dbd8c to 26169ce Compare July 30, 2024 00:56
@ravyu-jump ravyu-jump force-pushed the fuzz-vm-cpi-syscall-squashed branch from 26169ce to cb62802 Compare July 30, 2024 01:01
@ravyu-jump ravyu-jump marked this pull request as ready for review July 30, 2024 01:03
@ravyu-jump ravyu-jump force-pushed the fuzz-vm-cpi-syscall-squashed branch 3 times, most recently from 3409427 to 9413f67 Compare July 30, 2024 22:59
@ripatel-fd ripatel-fd added the vm label Aug 1, 2024
Copy link
Contributor

@ripatel-fd ripatel-fd left a comment

Choose a reason for hiding this comment

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

src/flamenco/runtime/tests/Local.mk Outdated Show resolved Hide resolved
src/flamenco/runtime/tests/Local.mk Outdated Show resolved Hide resolved
src/flamenco/runtime/tests/generated/invoke.pb.h Outdated Show resolved Hide resolved
src/flamenco/vm/syscall/fd_vm_syscall_cpi.c Outdated Show resolved Hide resolved
src/flamenco/vm/fd_vm_base.h Outdated Show resolved Hide resolved
src/flamenco/runtime/fd_executor.h Outdated Show resolved Hide resolved
src/flamenco/runtime/tests/fd_exec_sol_compat.c Outdated Show resolved Hide resolved
src/flamenco/runtime/tests/fd_exec_sol_compat.c Outdated Show resolved Hide resolved
ripatel-fd
ripatel-fd previously approved these changes Aug 5, 2024
@ravyu-jump
Copy link
Contributor Author

ravyu-jump commented Aug 5, 2024

@ripatel-fd, had to re-implement capturing of input data regions after the direct-mapping merge. Sorry about that here's the diff: https://github.com/firedancer-io/firedancer/compare/0a3fd0c1b6bfd429f065277e4152c847c0fb6eeb..c1b4187d4794d3b3b8a42efe4c74bb81a8d60189

@ravyu-jump ravyu-jump added this pull request to the merge queue Aug 9, 2024
Merged via the queue into main with commit a2ca6a2 Aug 9, 2024
11 checks passed
@ravyu-jump ravyu-jump deleted the fuzz-vm-cpi-syscall-squashed branch August 9, 2024 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants