Skip to content
This repository was archived by the owner on Nov 1, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Troubleshooting issues with binaries

The agent exposes some validation tools to help troubleshoot issues with a binary.
This allows the user to debug and fix errors that could prevent a job from running.

## Using the validation tools
Download a zip file containing the agent binaries:

```
onefuzz tools get <destination_folder>
```

Extract the zip file in a folder of your choice.
Navigate to the folder that matches your os.
Run the following command to see the tools available:
`onefuzz-agent.exe validate --help`
The current list of commands are:
- run_setup : Run the setup script
- validate_libfuzzer: Validate the libfuzzer target
- execution_log: Get the execution logs to debug loading issues

More tools might be added in the future so please refer the help command to get the most up to date list.


## In a docker container

It could also be helpful to run the those command in an environment to closely match the vm where the agent is deployed.
A docker container can help with that scenario.

Make sure [docker](https://docs.docker.com/desktop/) is installed and runs properly.

Navigate to the folder that matches your os in the tools folder created earlier and build the docker container:

```cmd
docker build --t <container_name> .
```

Use the container interactively to execute the validation command:

windows

```
docker run --it --rm --entrypoint powershell <image_name>
```

linux

```
docker run --it --rm --entrypoint bash <image_name>
```

From there you can navigate to the onefuzz directory and execute the validation commands

8 changes: 4 additions & 4 deletions docs/unmanaged-nodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Under the `client_credential` section of the agent config file, update `client_i

Save the config to the file.

### Start the agent.
### Start the agent

Navigate to the folder corresponding to your OS.
Set the necessary environment variable by running the script `set-env.ps1` (for Windows) or `set-env.sh` (for Linux).
Expand Down Expand Up @@ -111,7 +111,7 @@ From here you will be able to schedule jobs on that pool and they will run.

## Troubleshooting

### increase the verbosity of the logs
### Increase the verbosity of the logs

It can help when investigating issues to increase the log verbosity. you will need to set the [RUST_LOG](https://docs.rs/env_logger/latest/env_logger/#enabling-logging) environment variable when starting docker

Expand All @@ -127,7 +127,7 @@ log_level can be any of
- debug
- trace

### use the container interactively
### Use the container interactively

you can use the container interactively by with the following command

Expand All @@ -143,7 +143,7 @@ linux
docker run --it --rm --entrypoint bash <image_name>
```

### mount a local folder in the container
### Mount a local folder in the container

docker allows you to [mount](https://docs.docker.com/storage/bind-mounts/#mount-into-a-non-empty-directory-on-the-container) a local folder when running a container

Expand Down
6 changes: 2 additions & 4 deletions src/agent/onefuzz-agent/src/validations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ use uuid::Uuid;
pub enum ValidationCommand {
/// Run the setup script
RunSetup { setup_folder: PathBuf },
/// Validate the libfuzzer target
/// Validate the libfuzzer target by attempting to run the target by itself and with some of the supplied seeds if provided
ValidateLibfuzzer(ValidationConfig),
/// Get the execution logs to debug loading issues
/// Get the execution logs to debug dll loading issues
ExecutionLog(ValidationConfig),
}

Expand All @@ -30,8 +30,6 @@ where
.find('=')
.ok_or_else(|| format!("invalid KEY=value: no `=` found in `{s}`"))?;

println!("******** pos: {}", pos);

Ok((s[..pos].parse()?, s[pos + 1..].parse()?))
}

Expand Down