From 6bd2a47e548dbc48c1755c047e697ffe59d4d6e1 Mon Sep 17 00:00:00 2001 From: ko1N Date: Thu, 31 Dec 2020 16:58:42 +0100 Subject: [PATCH 01/15] Updated readme and leechcore dependency --- README.md | 2 -- leechcore-sys/src/leechcore | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index d908948..313fb49 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -# This repository is currently work-in-progress and might not fully work. - # memflow-pcileech This connector implements a rust-native implementation of the pcileech interface. diff --git a/leechcore-sys/src/leechcore b/leechcore-sys/src/leechcore index 9b859f1..e31a508 160000 --- a/leechcore-sys/src/leechcore +++ b/leechcore-sys/src/leechcore @@ -1 +1 @@ -Subproject commit 9b859f127784961882ab8ea8803043b37fd1ab61 +Subproject commit e31a5084e264b4ab3c21238a95f703e994ec3384 From 6f55c169097488122b37054b0216cb2390894bfe Mon Sep 17 00:00:00 2001 From: ko1N Date: Fri, 1 Jan 2021 02:27:00 +0100 Subject: [PATCH 02/15] Added macports --- .github/workflows/build.yml | 67 +++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0a27471..44a939f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,25 +7,45 @@ env: jobs: - build: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [macos-latest, ubuntu-latest, windows-latest] + build-windows: + runs-on: windows-latest steps: - uses: actions/checkout@v2 + - name: build + run: cargo build --workspace --verbose + - name: run tests + run: cargo test --workspace --verbose + - name: build examples + run: cargo build --workspace --examples --verbose - - name: Install libusb-1.0 + build-ubuntu: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: install libusb-1.0 run: sudo apt-get install libusb-1.0-0-dev - if: runner.os != 'Windows' - - - name: Build + - name: build run: cargo build --workspace --verbose + - name: run tests + run: cargo test --workspace --verbose + - name: build examples + run: cargo build --workspace --examples --verbose - - name: Build examples + build-macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - uses: keepitsimpletech/actions/setup-macports@setup-macports/releases/v1 + - name: install libusb-1.0 + run: sudo port -vs install libusb libusb-devel + - name: build + run: cargo build --workspace --verbose + - name: run tests + run: cargo test --workspace --verbose + - name: build examples run: cargo build --workspace --examples --verbose - build-arm: + build-ubuntu-aarch64: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -40,32 +60,13 @@ jobs: use-cross: true command: build args: --target aarch64-unknown-linux-gnu --workspace --verbose - - test: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [macos-latest, ubuntu-latest, windows-latest] - steps: - - uses: actions/checkout@v2 - - - name: Install libusb-1.0 - run: sudo apt-get install libusb-1.0-0-dev - if: runner.os != 'Windows' - - - name: Run all tests - run: cargo test --workspace --verbose - if: runner.os == 'Linux' - - - name: Run all tests - run: cargo test --workspace --exclude memflow-derive --verbose lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - run: rustup component add clippy - - name: Check formatting + - name: check formatting run: cargo fmt -- --check - uses: actions-rs/clippy-check@v1 with: @@ -76,14 +77,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Set up Rust nightly + - name: setup rust nightly uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: nightly override: true - run: cargo install grcov - - name: Run tests with coverage + - name: run tests with coverage run: | export CARGO_INCREMENTAL=0 export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" From 6b55f1b9e0ae2cdcebe6d6cb882b7188cbe6b6ca Mon Sep 17 00:00:00 2001 From: ko1N Date: Fri, 1 Jan 2021 02:29:23 +0100 Subject: [PATCH 03/15] Enforced macos version 10.14 in ci --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 44a939f..702dc04 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,7 +32,7 @@ jobs: run: cargo build --workspace --examples --verbose build-macos: - runs-on: macos-latest + runs-on: macOS-10.14 steps: - uses: actions/checkout@v2 - uses: keepitsimpletech/actions/setup-macports@setup-macports/releases/v1 From a681307712fbd9f240d7384c7576ec8f9bb53aff Mon Sep 17 00:00:00 2001 From: ko1N Date: Fri, 1 Jan 2021 02:31:02 +0100 Subject: [PATCH 04/15] Added submodule checkout to ci --- .github/workflows/build.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 702dc04..f8bcc1f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,6 +11,8 @@ jobs: runs-on: windows-latest steps: - uses: actions/checkout@v2 + with: + submodules: 'true' - name: build run: cargo build --workspace --verbose - name: run tests @@ -22,6 +24,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + with: + submodules: 'true' - name: install libusb-1.0 run: sudo apt-get install libusb-1.0-0-dev - name: build @@ -35,6 +39,8 @@ jobs: runs-on: macOS-10.14 steps: - uses: actions/checkout@v2 + with: + submodules: 'true' - uses: keepitsimpletech/actions/setup-macports@setup-macports/releases/v1 - name: install libusb-1.0 run: sudo port -vs install libusb libusb-devel @@ -49,6 +55,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + with: + submodules: 'true' - uses: actions-rs/toolchain@v1 with: toolchain: stable @@ -65,6 +73,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + with: + submodules: 'true' - run: rustup component add clippy - name: check formatting run: cargo fmt -- --check @@ -77,6 +87,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + with: + submodules: 'true' - name: setup rust nightly uses: actions-rs/toolchain@v1 with: From 97d56bfc1cf5c10378e4224ad293a551aee9395e Mon Sep 17 00:00:00 2001 From: ko1N Date: Fri, 1 Jan 2021 02:36:43 +0100 Subject: [PATCH 05/15] Added clip lint exclusion --- memflow-pcileech/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/memflow-pcileech/src/lib.rs b/memflow-pcileech/src/lib.rs index 0ad9af9..4d7d240 100644 --- a/memflow-pcileech/src/lib.rs +++ b/memflow-pcileech/src/lib.rs @@ -46,6 +46,7 @@ const fn calc_num_pages(start: u64, size: u64) -> u64 { ((start & (PAGE_SIZE as u64 - 1)) + size + (PAGE_SIZE as u64 - 1)) >> 12 } +#[allow(clippy::mutex_atomic)] #[derive(Debug)] pub struct PciLeech { handle: Arc>, @@ -81,6 +82,7 @@ impl PciLeech { Self::with_mapping(device, memmap) } + #[allow(clippy::mutex_atomic)] fn with_mapping(device: &str, mem_map: MemoryMap<(Address, usize)>) -> Result { // open device let mut conf = build_lc_config(device); From 5569a2e3fa77070376eaa9279ef4517a4209807e Mon Sep 17 00:00:00 2001 From: ko1N Date: Fri, 1 Jan 2021 02:41:21 +0100 Subject: [PATCH 06/15] Removed aarch64 ci and added llvm/libclang installation for windows --- .github/workflows/build.yml | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f8bcc1f..3a93bdf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,6 +13,10 @@ jobs: - uses: actions/checkout@v2 with: submodules: 'true' + - name: install libclang + uses: crazy-max/ghaction-chocolatey@v1 + with: + args: install llvm - name: build run: cargo build --workspace --verbose - name: run tests @@ -51,24 +55,6 @@ jobs: - name: build examples run: cargo build --workspace --examples --verbose - build-ubuntu-aarch64: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - submodules: 'true' - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: aarch64-unknown-linux-gnu - override: true - - run: sudo apt-get install libusb-1.0-0-dev - - uses: actions-rs/cargo@v1 - with: - use-cross: true - command: build - args: --target aarch64-unknown-linux-gnu --workspace --verbose - lint: runs-on: ubuntu-latest steps: @@ -89,6 +75,8 @@ jobs: - uses: actions/checkout@v2 with: submodules: 'true' + - name: install libusb-1.0 + run: sudo apt-get install libusb-1.0-0-dev - name: setup rust nightly uses: actions-rs/toolchain@v1 with: From 2f0009751b3b15825c9bc49653146fa9eda45cbb Mon Sep 17 00:00:00 2001 From: ko1N Date: Fri, 1 Jan 2021 02:54:07 +0100 Subject: [PATCH 07/15] Added manual llvm installation on windows --- .github/workflows/build.yml | 31 +++---------------------------- leechcore-sys/build.rs | 4 ++-- 2 files changed, 5 insertions(+), 30 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3a93bdf..e3aeba0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,9 +14,9 @@ jobs: with: submodules: 'true' - name: install libclang - uses: crazy-max/ghaction-chocolatey@v1 - with: - args: install llvm + run: | + curl -Ls -o "LLVM-10.0.0-win64.exe" "https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/LLVM-10.0.0-win64.exe" + LLVM-10.0.0-win64.exe /S - name: build run: cargo build --workspace --verbose - name: run tests @@ -68,28 +68,3 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} args: --all-targets - - build-coverage: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - submodules: 'true' - - name: install libusb-1.0 - run: sudo apt-get install libusb-1.0-0-dev - - name: setup rust nightly - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly - override: true - - run: cargo install grcov - - name: run tests with coverage - run: | - export CARGO_INCREMENTAL=0 - export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" - export RUSTDOCFLAGS="-Cpanic=abort" - cargo build --workspace --exclude memflow-derive - cargo test --workspace --exclude memflow-derive - grcov ./target/debug/ -s . -t lcov --llvm --branch --ignore-not-existing -o ./target/debug/coverage - bash <(curl -s https://codecov.io/bash) -f ./target/debug/coverage -t ${{ secrets.CODECOV_TOKEN }}; diff --git a/leechcore-sys/build.rs b/leechcore-sys/build.rs index 8465fe2..3ee2e5b 100644 --- a/leechcore-sys/build.rs +++ b/leechcore-sys/build.rs @@ -64,7 +64,7 @@ fn build_leechcore(target: &str) { for flag in String::from_utf8_lossy(&libusb_flags.stdout) .trim() - .split(" ") + .split(' ') { cfg.flag(flag); } @@ -91,7 +91,7 @@ fn build_leechcore(target: &str) { println!("cargo:rustc-link-lib=static=leechcore"); } -fn main() -> () { +fn main() { let target = env::var("TARGET").unwrap(); let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap()); From 647e5d77fd442de55b79397e73d23d263e73538f Mon Sep 17 00:00:00 2001 From: ko1N Date: Fri, 1 Jan 2021 03:00:11 +0100 Subject: [PATCH 08/15] Updated to latest choco installer --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e3aeba0..3900f05 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,9 +14,9 @@ jobs: with: submodules: 'true' - name: install libclang - run: | - curl -Ls -o "LLVM-10.0.0-win64.exe" "https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/LLVM-10.0.0-win64.exe" - LLVM-10.0.0-win64.exe /S + uses: crazy-max/ghaction-chocolatey@master + with: + args: install llvm - name: build run: cargo build --workspace --verbose - name: run tests From c52bd8354cfcfede67b89a959061b130b66f4efb Mon Sep 17 00:00:00 2001 From: ko1N Date: Fri, 1 Jan 2021 03:02:45 +0100 Subject: [PATCH 09/15] Changed macports installation --- .github/workflows/build.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3900f05..91fc03f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,12 +40,15 @@ jobs: run: cargo build --workspace --examples --verbose build-macos: - runs-on: macOS-10.14 + runs-on: macos-latest steps: - uses: actions/checkout@v2 with: submodules: 'true' - - uses: keepitsimpletech/actions/setup-macports@setup-macports/releases/v1 + - name: install macports + run: | + curl -LO https://raw.githubusercontent.com/GiovanniBussi/macports-ci/master/macports-ci + source ./macports-ci install - name: install libusb-1.0 run: sudo port -vs install libusb libusb-devel - name: build From a9369ad0ee500d5b0ed38c19ba1fa7c034e3955e Mon Sep 17 00:00:00 2001 From: ko1N Date: Fri, 1 Jan 2021 03:21:04 +0100 Subject: [PATCH 10/15] Added mingw path to ci --- .github/workflows/build.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 91fc03f..4444331 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,11 +17,17 @@ jobs: uses: crazy-max/ghaction-chocolatey@master with: args: install llvm + - name: add clang path to $PATH env + shell: bash + run: echo "PATH=$PATH:C:\msys64\mingw64\bin" >> $GITHUB_ENV - name: build + shell: bash run: cargo build --workspace --verbose - name: run tests + shell: bash run: cargo test --workspace --verbose - name: build examples + shell: bash run: cargo build --workspace --examples --verbose build-ubuntu: @@ -50,7 +56,7 @@ jobs: curl -LO https://raw.githubusercontent.com/GiovanniBussi/macports-ci/master/macports-ci source ./macports-ci install - name: install libusb-1.0 - run: sudo port -vs install libusb libusb-devel + run: sudo port -vs install libusb-devel - name: build run: cargo build --workspace --verbose - name: run tests @@ -64,6 +70,8 @@ jobs: - uses: actions/checkout@v2 with: submodules: 'true' + - name: install libusb-1.0 + run: sudo apt-get install libusb-1.0-0-dev - run: rustup component add clippy - name: check formatting run: cargo fmt -- --check From 119a9de022281ea0c1f1bad82876f2444080de9e Mon Sep 17 00:00:00 2001 From: ko1N Date: Fri, 1 Jan 2021 03:36:36 +0100 Subject: [PATCH 11/15] Added clang compiler to windows build --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4444331..ab89c28 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,6 +9,7 @@ jobs: build-windows: runs-on: windows-latest + compiler: clang steps: - uses: actions/checkout@v2 with: From 931e421a0f7a496d01a1cd05ba12267b490b0da4 Mon Sep 17 00:00:00 2001 From: ko1N Date: Fri, 1 Jan 2021 03:41:46 +0100 Subject: [PATCH 12/15] Fixed ci script --- .github/workflows/build.yml | 3 +-- leechcore-sys/build.rs | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ab89c28..b4c2d07 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,6 @@ jobs: build-windows: runs-on: windows-latest - compiler: clang steps: - uses: actions/checkout@v2 with: @@ -20,7 +19,7 @@ jobs: args: install llvm - name: add clang path to $PATH env shell: bash - run: echo "PATH=$PATH:C:\msys64\mingw64\bin" >> $GITHUB_ENV + run: echo "PATH=$PATH:C:\msys64\mingw32\bin" >> $GITHUB_ENV - name: build shell: bash run: cargo build --workspace --verbose diff --git a/leechcore-sys/build.rs b/leechcore-sys/build.rs index 3ee2e5b..8c8d32f 100644 --- a/leechcore-sys/build.rs +++ b/leechcore-sys/build.rs @@ -16,6 +16,11 @@ fn os_define() -> &'static str { "LINUX" } +#[cfg(target_os = "macos")] +fn os_define() -> &'static str { + "LINUX" +} + fn build_leechcore(target: &str) { let mut files = vec![ "oscompatibility.c", From 98da62e3dc4f9cb475775d74730d334f83caecfd Mon Sep 17 00:00:00 2001 From: ko1N Date: Fri, 1 Jan 2021 03:52:31 +0100 Subject: [PATCH 13/15] Updated build dependencies --- .github/workflows/build.yml | 3 --- leechcore-sys/Cargo.toml | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b4c2d07..52fcec1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,9 +17,6 @@ jobs: uses: crazy-max/ghaction-chocolatey@master with: args: install llvm - - name: add clang path to $PATH env - shell: bash - run: echo "PATH=$PATH:C:\msys64\mingw32\bin" >> $GITHUB_ENV - name: build shell: bash run: cargo build --workspace --verbose diff --git a/leechcore-sys/Cargo.toml b/leechcore-sys/Cargo.toml index 80449bf..469e47b 100644 --- a/leechcore-sys/Cargo.toml +++ b/leechcore-sys/Cargo.toml @@ -12,6 +12,6 @@ links = "leechcore" ctor = "0.1" [build-dependencies] -cc = "1.0.62" -bindgen = "0.55" +cc = "1.0" +bindgen = "0.56" pkg-config = "0.3" From bc1ab377e6ffdd541ba2380de4ac83cf76686c9c Mon Sep 17 00:00:00 2001 From: ko1N Date: Mon, 15 Feb 2021 22:14:01 +0100 Subject: [PATCH 14/15] Added workaround for missing libclang on github ci --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 52fcec1..a3c4c54 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,6 +17,8 @@ jobs: uses: crazy-max/ghaction-chocolatey@master with: args: install llvm + - name: set LIBCLANG_PATH + run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV - name: build shell: bash run: cargo build --workspace --verbose From 51074701e32c0b45ed7419203062db8a4ca8926b Mon Sep 17 00:00:00 2001 From: ko1N Date: Mon, 15 Feb 2021 22:20:56 +0100 Subject: [PATCH 15/15] Changed llvm installation --- .github/workflows/build.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a3c4c54..97e3583 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,10 +13,11 @@ jobs: - uses: actions/checkout@v2 with: submodules: 'true' - - name: install libclang - uses: crazy-max/ghaction-chocolatey@master + - name: install llvm and clang + uses: KyleMayes/install-llvm-action@v1 with: - args: install llvm + version: "10.0" + directory: ${{ runner.temp }}/llvm - name: set LIBCLANG_PATH run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV - name: build