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

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

Merged
merged 4 commits into from
Mar 6, 2025

Conversation

marosset
Copy link
Contributor

@marosset marosset commented Mar 4, 2025

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
Copy link

@Copilot Copilot AI left a comment

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
@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
Copy link

@Copilot Copilot AI left a comment

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"))?

@marosset marosset enabled auto-merge (squash) March 6, 2025 22:38
@marosset marosset merged commit 0094812 into hyperlight-dev:main Mar 6, 2025
33 of 46 checks passed
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.

3 participants