You've already forked ReZygisk
mirror of
https://github.com/PerformanC/ReZygisk.git
synced 2025-09-06 06:37:01 +00:00
Set memfd name to module name on debug
This commit is contained in:
@@ -19,6 +19,17 @@ macro_rules! lp_select {
|
|||||||
($lp32:expr, $lp64:expr) => { $lp32 };
|
($lp32:expr, $lp64:expr) => { $lp32 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! debug_select {
|
||||||
|
($debug:expr, $release:expr) => { $debug };
|
||||||
|
}
|
||||||
|
#[cfg(not(debug_assertions))]
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! debug_select {
|
||||||
|
($debug:expr, $release:expr) => { $release };
|
||||||
|
}
|
||||||
|
|
||||||
pub struct LateInit<T> {
|
pub struct LateInit<T> {
|
||||||
cell: OnceCell<T>,
|
cell: OnceCell<T>,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use crate::constants::DaemonSocketAction;
|
use crate::constants::DaemonSocketAction;
|
||||||
use crate::utils::UnixStreamExt;
|
use crate::utils::UnixStreamExt;
|
||||||
use crate::{constants, lp_select, magic, root_impl, utils};
|
use crate::{constants, debug_select, lp_select, magic, root_impl, utils};
|
||||||
use anyhow::{bail, Result};
|
use anyhow::{bail, Result};
|
||||||
use memfd::Memfd;
|
use memfd::Memfd;
|
||||||
use nix::{
|
use nix::{
|
||||||
@@ -91,7 +91,7 @@ fn load_modules(arch: &str) -> Result<Vec<Module>> {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
log::info!(" Loading module `{name}`...");
|
log::info!(" Loading module `{name}`...");
|
||||||
let memfd = match create_memfd(&so_path) {
|
let memfd = match create_memfd(&so_path, &name) {
|
||||||
Ok(memfd) => memfd,
|
Ok(memfd) => memfd,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
log::warn!(" Failed to create memfd for `{name}`: {e}");
|
log::warn!(" Failed to create memfd for `{name}`: {e}");
|
||||||
@@ -114,9 +114,9 @@ fn load_modules(arch: &str) -> Result<Vec<Module>> {
|
|||||||
Ok(modules)
|
Ok(modules)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_memfd(so_path: &PathBuf) -> Result<Memfd> {
|
fn create_memfd(so_path: &PathBuf, debug_name: &str) -> Result<Memfd> {
|
||||||
let opts = memfd::MemfdOptions::default().allow_sealing(true);
|
let opts = memfd::MemfdOptions::default().allow_sealing(true);
|
||||||
let memfd = opts.create("jit-cache")?;
|
let memfd = opts.create(debug_select!(debug_name, "jit-cache"))?;
|
||||||
let file = fs::File::open(so_path)?;
|
let file = fs::File::open(so_path)?;
|
||||||
let mut reader = std::io::BufReader::new(file);
|
let mut reader = std::io::BufReader::new(file);
|
||||||
let mut writer = memfd.as_file();
|
let mut writer = memfd.as_file();
|
||||||
|
|||||||
Reference in New Issue
Block a user