Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Commit

Permalink
Merge branch 'main' into Release-8.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamL-Microsoft authored Jul 13, 2023
2 parents de35ea7 + 7a92dab commit 708d371
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ARG VARIANT="ubuntu-22.04"
FROM mcr.microsoft.com/devcontainers/base:${VARIANT}

# note: keep this in sync with .github/workflows/ci.yml
ARG RUSTVERSION="1.70"
ARG RUSTVERSION="1.71"

# Install packages required for build:
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- name: Install specific Rust version
uses: dtolnay/rust-toolchain@55c7845fad90d0ae8b2e83715cb900e5e861e8cb # pinned latest master as of 2022-10-08
with:
toolchain: "1.70" # note: keep this in sync with .devcontainer/Dockerfile
toolchain: "1.71" # note: keep this in sync with .devcontainer/Dockerfile
components: clippy, rustfmt, llvm-tools-preview
- name: Setup Rust problem-matchers
uses: r7kamura/rust-problem-matchers@d58b70c4a13c4866d96436315da451d8106f8f08 # pinned to 1.3.0
Expand Down
22 changes: 22 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
ignore:
- "src/agent/**/examples/"
- "src/ApiService/*Tests/"

component_management:
individual_components:
- component_id: agent
name: OneFuzz Agent
paths:
- src/agent/**
- component_id: cli
name: OneFuzz CLI
paths:
- src/cli/**
- component_id: service
name: OneFuzz Service
paths:
- src/ApiService/**
- component_id: proxy
name: OneFuzz Proxy
paths:
- src/proxy-manager/**
62 changes: 62 additions & 0 deletions src/agent/onefuzz-task/src/tasks/fuzz/libfuzzer/generic.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

use std::path::PathBuf;

use anyhow::Result;
use async_trait::async_trait;
use onefuzz::libfuzzer::LibFuzzer;
Expand Down Expand Up @@ -37,7 +39,67 @@ impl common::LibFuzzerType for GenericLibFuzzer {
config.common.machine_identity.clone(),
))
}

async fn extra_setup(config: &common::Config<Self>) -> Result<()> {
// this is needed on Windows, but we do it unconditionally
let target_exe =
try_resolve_setup_relative_path(&config.common.setup_dir, &config.target_exe).await?;

// Set up a .local file on Windows before invoking the executable,
// so that all DLLs are resolved to the exe’s folder in preference to the Windows/system DLLs.
// The .local file is an empty file that tells DLL resolution to consider the same directory,
// even for system (or KnownDLL) files.
// See: https://learn.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-redirection#how-to-redirect-dlls-for-unpackaged-apps
let dotlocal_file = add_dotlocal_extension(target_exe);
if let Err(e) = tokio::fs::write(&dotlocal_file, &[]).await {
// ignore already-exists error, report anything else
if e.kind() != std::io::ErrorKind::AlreadyExists {
return Err(anyhow::Error::from(e).context("creating .local file"));
}
}

info!("Created .local file: {}", dotlocal_file.display());

Ok(())
}
}

fn add_dotlocal_extension(mut path: PathBuf) -> PathBuf {
if let Some(ext) = path.extension() {
let mut ext = ext.to_os_string();
ext.push(".local");
path.set_extension(ext);
} else {
path.set_extension("local");
}

path
}

pub type Config = common::Config<GenericLibFuzzer>;
pub type LibFuzzerFuzzTask = common::LibFuzzerFuzzTask<GenericLibFuzzer>;

#[cfg(test)]
mod test {
use std::path::PathBuf;

use super::add_dotlocal_extension;

#[test]
fn dotlocal_with_extension() {
let path = PathBuf::from("executable.exe");
assert_eq!(
PathBuf::from("executable.exe.local"),
add_dotlocal_extension(path)
);
}

#[test]
fn dotlocal_without_extension() {
let path = PathBuf::from("executable");
assert_eq!(
PathBuf::from("executable.local"),
add_dotlocal_extension(path)
);
}
}
20 changes: 16 additions & 4 deletions src/proxy-manager/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 708d371

Please sign in to comment.