Skip to content

Update fuzzing test to check for simpleguest in same directory as executable - #324

Merged
marosset merged 4 commits into
hyperlight-dev:mainfrom
marosset:get-simple-guest-for-fuzzing
Mar 6, 2025
Merged

Update fuzzing test to check for simpleguest in same directory as executable#324
marosset merged 4 commits into
hyperlight-dev:mainfrom
marosset:get-simple-guest-for-fuzzing

Conversation

@marosset

@marosset marosset commented Mar 4, 2025

Copy link
Copy Markdown
Contributor

Some fuzzing scenarios we want to report require building a fuzzing binary with cargo fuzz build and submitting that binary to a fuzzing harness. In those instances we also want to submit a guestbinary and this PR makes sure that the guestbinary can be found in the same directory as the fuzzing binary.

@marosset
marosset marked this pull request as ready for review March 4, 2025 20:01
@marosset marosset added the rust label Mar 4, 2025
@marosset
marosset force-pushed the get-simple-guest-for-fuzzing branch from 9564dc0 to 001a36d Compare March 4, 2025 20:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

PR Overview

This PR enhances the fuzzing test by updating the mechanism for locating the simple guest binary. Key changes include:

  • Introducing simple_guest_for_fuzzing_as_string to try locating the guest binary in the same directory as the executable.
  • Falling back to the existing simple_guest_as_string method if the binary isn’t found.
  • Updating the fuzz target to use the new function.

Reviewed Changes

File Description
src/hyperlight_testing/src/lib.rs Added simple_guest_for_fuzzing_as_string using env::current_exe to locate the guest binary at runtime.
src/hyperlight_host/fuzz/fuzz_targets/fuzz_target_1.rs Updated fuzz target to obtain the guest binary via simple_guest_for_fuzzing_as_string.

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

src/hyperlight_testing/src/lib.rs:2

  • The function call to 'rust_guest_as_pathbuf' in simple_guest_as_string is inconsistent with the earlier defined 'c_guest_as_pathbuf'. Please confirm if this discrepancy is intentional or update for naming consistency.
    let buf = rust_guest_as_pathbuf("simpleguest");

ludfjig
ludfjig previously approved these changes Mar 4, 2025
Comment thread src/hyperlight_testing/src/lib.rs Outdated
@marosset
marosset force-pushed the get-simple-guest-for-fuzzing branch 2 times, most recently from a2033ea to bd1b172 Compare March 4, 2025 20:29
ludfjig
ludfjig previously approved these changes Mar 4, 2025
ludfjig
ludfjig previously approved these changes Mar 6, 2025
@marosset
marosset force-pushed the get-simple-guest-for-fuzzing branch 2 times, most recently from 4c16bbf to a9c5f22 Compare March 6, 2025 19:58
marosset added 3 commits March 6, 2025 13:13
Signed-off-by: Mark Rossett <marosset@microsoft.com>
Signed-off-by: Mark Rossett <marosset@microsoft.com>
Signed-off-by: Mark Rossett <marosset@microsoft.com>
@marosset
marosset force-pushed the get-simple-guest-for-fuzzing branch from a9c5f22 to 20b6949 Compare March 6, 2025 21:13
@marosset
marosset requested a review from Copilot March 6, 2025 21:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

PR Overview

This PR updates the fuzzing tests to ensure that the guest binary (simpleguest) is located in the same directory as the fuzzing executable, and it adjusts various configuration files to align with the new naming conventions. Key changes include:

  • Adding a new function in lib.rs to prefer a local guest binary during fuzzing.
  • Updating references across fuzz targets to use the new function and binary names.
  • Modifying workflow and Cargo.toml configurations to reflect updated target names.

Reviewed Changes

File Description
src/hyperlight_testing/src/lib.rs Introduced simple_guest_for_fuzzing_as_string to locate the guest binary
.github/workflows/ValidatePullRequest.yml Updated target names for fuzzing
.github/workflows/Fuzzing.yml Updated target names for fuzzing
fuzz/fuzz_targets/*.rs Replaced usage of simple_guest_as_string with new function usage
fuzz/Cargo.toml Renamed binaries to include fuzz_ prefix
fuzz/README.md Updated command examples to reflect new binary names

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/hyperlight_testing/src/lib.rs:149

  • [nitpick] The error message 'Invalid path string' could be more descriptive by including contextual information about the path conversion failure.
.ok_or(anyhow("Invalid path string"))?

Comment thread src/hyperlight_testing/src/lib.rs
@marosset
marosset enabled auto-merge (squash) March 6, 2025 22:38
@marosset
marosset merged commit 0094812 into hyperlight-dev:main Mar 6, 2025
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