From e020e5692532cdc2cca5e0985f332bf0bf8fe1a9 Mon Sep 17 00:00:00 2001 From: psrok1 Date: Thu, 5 Sep 2024 12:29:30 +0200 Subject: [PATCH 1/4] CI: Consistent linking with XTF --- .gitmodules | 3 +++ drakrun/drakrun/tools/xtf | 1 + 2 files changed, 4 insertions(+) create mode 160000 drakrun/drakrun/tools/xtf diff --git a/.gitmodules b/.gitmodules index 4c0b92c9..3510e52d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "drakrun/drakrun/lib/postprocessing/capa_plugin/capa-rules"] path = drakrun/drakrun/data/capa-rules url = https://github.com/mandiant/capa-rules/ +[submodule "drakrun/drakrun/tools/xtf"] + path = drakrun/drakrun/tools/xtf + url = https://xenbits.xen.org/git-http/xtf.git diff --git a/drakrun/drakrun/tools/xtf b/drakrun/drakrun/tools/xtf new file mode 160000 index 00000000..bf1c4eb6 --- /dev/null +++ b/drakrun/drakrun/tools/xtf @@ -0,0 +1 @@ +Subproject commit bf1c4eb6cb52785cf539eb83752dfcecfe66c5d1 From 9fa5a70512799ef7aee018ae19444b346a939691 Mon Sep 17 00:00:00 2001 From: psrok1 Date: Thu, 5 Sep 2024 12:36:38 +0200 Subject: [PATCH 2/4] Change Makefile --- drakrun/Makefile | 6 +++++- drakrun/drakrun/tools/Makefile | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drakrun/Makefile b/drakrun/Makefile index fcadfddd..cad5dbf0 100644 --- a/drakrun/Makefile +++ b/drakrun/Makefile @@ -4,7 +4,7 @@ PYTHON_SOURCE_FILES := $( wildcard *.py ) drakrun/data pyproject.toml MANIFEST.i .PHONY: all all: dist/*.whl -dist/*.whl: $(PYTHON_SOURCE_FILES) drakrun/web/frontend/build drakrun/tools/get-explorer-pid drakrun/tools/test-altp2m +dist/*.whl: $(PYTHON_SOURCE_FILES) drakrun/web/frontend/build drakrun/tools/get-explorer-pid drakrun/tools/test-altp2m drakrun/tools/test-hvm64-example rm -f dist/*.whl ifndef DIST DRAKRUN_VERSION_TAG=$(shell git rev-parse --short HEAD) python3 setup.py bdist_wheel @@ -24,6 +24,10 @@ drakrun/tools/get-explorer-pid: drakrun/tools/get-explorer-pid.c drakrun/tools/test-altp2m: drakrun/tools/test-altp2m.c gcc $< -o $@ -lvmi `pkg-config --cflags --libs glib-2.0` +drakrun/tools/test-hvm64-example: drakrun/tools/xtf + $(MAKE) -C drakrun/tools/xtf + cp drakrun/tools/xtf/tests/example/test-hvm64-example drakrun/tools/test-hvm64-example + .PHONY: clean clean: rm -rf dist drakvuf_sandbox.egg-info build diff --git a/drakrun/drakrun/tools/Makefile b/drakrun/drakrun/tools/Makefile index 2762fbd8..dc50960b 100644 --- a/drakrun/drakrun/tools/Makefile +++ b/drakrun/drakrun/tools/Makefile @@ -8,3 +8,6 @@ get-explorer-pid: get-explorer-pid.c test-altp2m: test-altp2m.c gcc $< -o $@ -lvmi `pkg-config --cflags --libs glib-2.0` +test-hvm64-example: xtf + $(MAKE) -C xtf + cp xtf/tests/example/test-hvm64-example . From fa115ddf2bef45d55ac98e984d850d0ac429e9b5 Mon Sep 17 00:00:00 2001 From: psrok1 Date: Thu, 5 Sep 2024 12:37:52 +0200 Subject: [PATCH 3/4] Adapt workflow --- .github/workflows/build.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2d964a28..e2e5f271 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -91,23 +91,13 @@ jobs: /build/usr/lib/libvmi* /build/usr/include/libvmi/* key: drakvuf-bundle-${{ env.DRAKVUF_COMMIT }}-${{ matrix.distro }}-${{ matrix.version }} - - if: ${{ steps.cache-drakvuf-bundle.outputs.cache-hit != 'true' }} - name: Build Xen Test Framework - working-directory: /opt - run: | - apt install -y make pkg-config gcc libglib2.0-dev - git clone https://xenbits.xen.org/git-http/xtf.git - cd xtf - git checkout bf1c4eb6cb52785cf539eb83752dfcecfe66c5d1 - make -j4 - name: Build draksetup tools run: | - apt install -y libjson-c-dev + apt install -y make pkg-config gcc libglib2.0-dev libjson-c-dev cp -v /build/usr/lib/libvmi* /usr/lib/ mkdir /usr/include/libvmi cp -v /build/usr/include/libvmi/* /usr/include/libvmi/ make -C ./drakrun/drakrun/tools - cp /opt/xtf/tests/example/test-hvm64-example ./drakrun/drakrun/tools/ - uses: actions/upload-artifact@v3 with: name: drakvuf-bundle-debs-${{ matrix.distro }}-${{ matrix.version }} From a7e4cd7bbfb27393f5afea5265454f1f751aa4c5 Mon Sep 17 00:00:00 2001 From: psrok1 Date: Thu, 5 Sep 2024 13:00:23 +0200 Subject: [PATCH 4/4] Change submodule to Github fork - xenbits don't offer clone from commits without refs --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 3510e52d..1549c7d6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,4 +6,4 @@ url = https://github.com/mandiant/capa-rules/ [submodule "drakrun/drakrun/tools/xtf"] path = drakrun/drakrun/tools/xtf - url = https://xenbits.xen.org/git-http/xtf.git + url = https://github.com/andyhhp/xtf.git