Skip to content

fix: preserve fixed metadata state when set_program fails - #154

Open
pro-utkarshM wants to merge 1 commit into
qmonnet:mainfrom
pro-utkarshM:fix/fixed-mbuff-failed-set-program
Open

pro-utkarshM wants to merge 1 commit into
qmonnet:mainfrom
pro-utkarshM:fix/fixed-mbuff-failed-set-program

Conversation

@pro-utkarshM

Copy link
Copy Markdown

A rejected replacement program currently leaves EbpfVmFixedMbuff running its old bytecode with the replacement's metadata buffer and offsets. For example, a program reading pointers at offsets 8 and 16 returns 0 instead of the packet length after set_program(&[], 0, 24) fails.

Validate the replacement through the parent VM before committing the new metadata state. Add a regression test covering rejection by both the default verifier and a custom verifier.

Fixes #153.

Validation:

  • Regression failed before the fix (0 instead of 3) and passes afterward.
  • cargo test --all-features
  • cargo test --no-default-features -j 2
  • cargo clippy --all-features --all-targets -j 2 (existing style warnings)
  • git diff --check

Validate the replacement program before installing its metadata buffer
and pointer offsets. Otherwise a verifier error leaves the old bytecode
loaded with the replacement's metadata layout.

Cover default and custom verifier rejection with a regression test that
checks the original program still reads the correct packet length.

Signed-off-by: Utkarsh Maurya <projects.utkarshMaurya@gmail.com>
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.

EbpfVmFixedMbuff::set_program changes metadata state when verification fails

1 participant