Skip to content
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 .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build

on:
workflow_dispatch:
push:
branches: [master, workflow]
pull_request:
branches: [master, workflow]

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
profile: [debug, release]
zygisk: [zygisk, no-zygisk]

steps:
- name: Checkout
uses: actions/checkout@v6

- name: Setup just
uses: extractions/setup-just@v3

- name: Setup Protoc
uses: arduino/setup-protoc@v3

- name: Setup Android SDK
uses: android-actions/setup-android@v3

- name: Setup Rust
run: |
rustup update stable
rustup target add aarch64-linux-android
rustup toolchain install nightly --component rust-src

- name: Install bpf-linker
run: cargo install bpf-linker

- name: Build
run: just build-${{ matrix.profile }} ${{ matrix.zygisk }}

- name: Upload artifact
uses: actions/upload-artifact@v6
with:
name: zynx-${{ matrix.profile }}-${{ matrix.zygisk }}
path: |
target/aarch64-linux-android/${{ matrix.profile }}/zynx
target/aarch64-linux-android/${{ matrix.profile }}/zynx.dwp
10 changes: 6 additions & 4 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@ HOST_TAG := (if os() == "macos" { "darwin" } else { os() }) + "-x86_64"

export CC := env("ANDROID_NDK") / "toolchains/llvm/prebuilt" / HOST_TAG / "bin" / ("aarch64-linux-android" + TARGET_SDK + "-clang")

build-debug:
build-debug features="":
cargo build \
--target aarch64-linux-android \
--config target.aarch64-linux-android.linker=\"{{CC}}\"
--config target.aarch64-linux-android.linker=\"{{CC}}\" \
{{ if features == "no-zygisk" { "--no-default-features" } else { "" } }}

build-release:
build-release features="":
PROFILE=release cargo build \
--target aarch64-linux-android \
--config target.aarch64-linux-android.linker=\"{{CC}}\" \
--release
--release \
{{ if features == "no-zygisk" { "--no-default-features" } else { "" } }}

run-emulator: build-debug
adb push target/aarch64-linux-android/debug/zynx /data/local/tmp/zynx
Expand Down
14 changes: 9 additions & 5 deletions src/bridge-shared/src/remote_lib.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use anyhow::{Context, Error, Result, anyhow, bail};
use jni::JNIEnv;
use jni::objects::{GlobalRef, JClass, JObject, JString, JValue};
use jni::objects::{GlobalRef, JClass, JObject, JValue};
use jni::strings::JavaStr;
use log::{info, warn};
use nix::libc::{RTLD_NOW, c_int, off64_t, size_t, PROT_READ, MAP_PRIVATE, MAP_FAILED};
use nix::libc;
use nix::libc::{MAP_FAILED, MAP_PRIVATE, PROT_READ, RTLD_NOW, c_int, off64_t, size_t};
use std::ffi::{CStr, CString, c_void};
use std::fs::File;
use std::os::fd::{AsRawFd, FromRawFd, OwnedFd, RawFd};
use std::ptr;
use nix::libc;

mod system {
use crate::remote_lib::DlextInfo;
Expand Down Expand Up @@ -170,7 +170,11 @@ impl JavaLibrary {
let fd = self.fd.take().context("duplicate called")?;
let file: File = fd.into();

info!("loading java library: {}, fd = {}", self.name, file.as_raw_fd());
info!(
"loading java library: {}, fd = {}",
self.name,
file.as_raw_fd()
);

let file_size = file.metadata()?.len() as usize;
let mut file_data = vec![0; file_size];
Expand All @@ -182,7 +186,7 @@ impl JavaLibrary {
PROT_READ,
MAP_PRIVATE,
file.as_raw_fd(),
0
0,
);

if addr == MAP_FAILED {
Expand Down
1 change: 1 addition & 0 deletions src/bridge/src/injector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use std::collections::HashMap;
use zynx_bridge_shared::injector::ProviderHandler;
use zynx_bridge_shared::remote_lib::Libraries;
use zynx_bridge_shared::zygote::{ProviderType, SpecializeArgs};
#[cfg(feature = "zygisk")]
use zynx_zygisk_compat::ZygiskProviderHandler;

#[allow(clippy::type_complexity)]
Expand Down
1 change: 1 addition & 0 deletions src/core/src/injector/app/policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ mod zygisk;
use crate::android::packages::PackageInfoListLocked;
use crate::injector::app::policy::debugger::DebuggerPolicyProvider;
use crate::injector::app::policy::liteloader::LiteLoaderPolicyProvider;
#[cfg(feature = "zygisk")]
use crate::injector::app::policy::zygisk::ZygiskPolicyProvider;
use anyhow::{Result, anyhow};
use async_trait::async_trait;
Expand Down