Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
e68dd866
Commit
e68dd866
authored
Sep 24, 2021
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only create app_id_map if necessary
parent
73d36fdf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
utils.cpp
native/jni/zygisk/deny/utils.cpp
+15
-9
No files found.
native/jni/zygisk/deny/utils.cpp
View file @
e68dd866
...
...
@@ -24,6 +24,8 @@ static pthread_mutex_t data_lock = PTHREAD_MUTEX_INITIALIZER;
atomic
<
bool
>
denylist_enabled
=
false
;
static
void
rebuild_map
()
{
if
(
!
zygisk_enabled
)
return
;
app_id_proc_map
->
clear
();
string
data_path
(
APP_DATA_DIR
);
size_t
len
=
data_path
.
length
();
...
...
@@ -146,6 +148,8 @@ static bool validate(const char *pkg, const char *proc) {
static
void
add_hide_set
(
const
char
*
pkg
,
const
char
*
proc
)
{
LOGI
(
"denylist add: [%s/%s]
\n
"
,
pkg
,
proc
);
deny_set
->
emplace
(
pkg
,
proc
);
if
(
!
zygisk_enabled
)
return
;
if
(
strcmp
(
pkg
,
ISOLATED_MAGIC
)
==
0
)
{
// Kill all matching isolated processes
kill_process
<&
str_starts
>
(
proc
,
true
);
...
...
@@ -237,7 +241,7 @@ static bool init_list() {
db_err_cmd
(
err
,
return
false
);
// If Android Q+, also kill blastula pool and all app zygotes
if
(
SDK_INT
>=
29
)
{
if
(
SDK_INT
>=
29
&&
zygisk_enabled
)
{
kill_process
(
"usap32"
,
true
);
kill_process
(
"usap64"
,
true
);
kill_process
<&
str_ends_safe
>
(
"_zygote"
,
true
);
...
...
@@ -309,15 +313,17 @@ int enable_deny() {
denylist_enabled
=
true
;
default_new
(
app_id_proc_map
);
rebuild_map
();
if
(
zygisk_enabled
)
{
default_new
(
app_id_proc_map
);
rebuild_map
();
inotify_fd
=
xinotify_init1
(
IN_CLOEXEC
);
if
(
inotify_fd
>=
0
)
{
// Monitor packages.xml
inotify_add_watch
(
inotify_fd
,
"/data/system"
,
IN_CLOSE_WRITE
);
pollfd
inotify_pfd
=
{
inotify_fd
,
POLLIN
,
0
};
register_poll
(
&
inotify_pfd
,
inotify_handler
);
inotify_fd
=
xinotify_init1
(
IN_CLOEXEC
);
if
(
inotify_fd
>=
0
)
{
// Monitor packages.xml
inotify_add_watch
(
inotify_fd
,
"/data/system"
,
IN_CLOSE_WRITE
);
pollfd
inotify_pfd
=
{
inotify_fd
,
POLLIN
,
0
};
register_poll
(
&
inotify_pfd
,
inotify_handler
);
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment