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
c3b4678f
Commit
c3b4678f
authored
Oct 11, 2022
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly detect SysUI
parent
978216ea
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
4 deletions
+14
-4
deny.hpp
native/src/zygisk/deny/deny.hpp
+1
-0
utils.cpp
native/src/zygisk/deny/utils.cpp
+8
-2
entry.cpp
native/src/zygisk/entry.cpp
+2
-0
hook.cpp
native/src/zygisk/hook.cpp
+1
-1
module.hpp
native/src/zygisk/module.hpp
+2
-1
No files found.
native/src/zygisk/deny/deny.hpp
View file @
c3b4678f
...
...
@@ -49,4 +49,5 @@ void ls_list(int client);
bool
is_deny_target
(
int
uid
,
std
::
string_view
process
);
void
revert_unmount
();
extern
int
sys_ui_app_id
;
extern
std
::
atomic
<
bool
>
denylist_enforced
;
native/src/zygisk/deny/utils.cpp
View file @
c3b4678f
...
...
@@ -27,6 +27,8 @@ static unique_ptr<map<string, set<string, StringCmp>, StringCmp>> pkg_to_procs_;
static
unique_ptr
<
map
<
int
,
set
<
string_view
>>>
app_id_to_pkgs_
;
#define app_id_to_pkgs (*app_id_to_pkgs_)
int
sys_ui_app_id
=
-
1
;
// Locks the data structures above
static
pthread_mutex_t
data_lock
=
PTHREAD_MUTEX_INITIALIZER
;
...
...
@@ -39,6 +41,10 @@ static void rescan_apps() {
app_id_to_pkgs
.
clear
();
struct
stat
st
{};
if
(
xstat
(
"/data/data/com.android.systemui"
,
&
st
)
==
0
)
sys_ui_app_id
=
to_app_id
(
st
.
st_uid
);
auto
data_dir
=
xopen_dir
(
APP_DATA_DIR
);
if
(
!
data_dir
)
return
;
...
...
@@ -49,8 +55,8 @@ static void rescan_apps() {
if
(
auto
dir
=
xopen_dir
(
dfd
))
{
while
((
entry
=
xreaddir
(
dir
.
get
())))
{
// For each package
struct
stat
st
{};
xfstatat
(
dfd
,
entry
->
d_name
,
&
st
,
0
)
;
if
(
xfstatat
(
dfd
,
entry
->
d_name
,
&
st
,
0
))
continue
;
int
app_id
=
to_app_id
(
st
.
st_uid
);
if
(
auto
it
=
pkg_to_procs
.
find
(
entry
->
d_name
);
it
!=
pkg_to_procs
.
end
())
{
app_id_to_pkgs
[
app_id
].
insert
(
it
->
first
);
...
...
native/src/zygisk/entry.cpp
View file @
c3b4678f
...
...
@@ -304,6 +304,8 @@ static void get_process_info(int client, const sock_cred *cred) {
int
manager_app_id
=
get_manager
();
if
(
to_app_id
(
uid
)
==
manager_app_id
)
{
flags
|=
PROCESS_IS_MAGISK_APP
;
}
else
if
(
to_app_id
(
uid
)
==
sys_ui_app_id
)
{
flags
|=
PROCESS_IS_SYS_UI
;
}
if
(
denylist_enforced
)
{
flags
|=
DENYLIST_ENFORCING
;
...
...
native/src/zygisk/hook.cpp
View file @
c3b4678f
...
...
@@ -165,7 +165,7 @@ DCL_HOOK_FUNC(int, unshare, int flags) {
// For some unknown reason, unmounting app_process in SysUI can break.
// This is reproducible on the official AVD running API 26 and 27.
// Simply avoid doing any unmounts for SysUI to avoid potential issues.
g_ctx
->
process
&&
g_ctx
->
process
!=
"com.android.systemui"
sv
)
{
(
g_ctx
->
info_flags
&
PROCESS_IS_SYS_UI
)
)
{
if
(
g_ctx
->
flags
[
DO_REVERT_UNMOUNT
])
{
revert_unmount
();
}
else
{
...
...
native/src/zygisk/module.hpp
View file @
c3b4678f
...
...
@@ -108,11 +108,12 @@ enum : uint32_t {
PROCESS_GRANTED_ROOT
=
zygisk
::
StateFlag
::
PROCESS_GRANTED_ROOT
,
PROCESS_ON_DENYLIST
=
zygisk
::
StateFlag
::
PROCESS_ON_DENYLIST
,
PROCESS_IS_SYS_UI
=
(
1u
<<
29
),
DENYLIST_ENFORCING
=
(
1u
<<
30
),
PROCESS_IS_MAGISK_APP
=
(
1u
<<
31
),
UNMOUNT_MASK
=
(
PROCESS_ON_DENYLIST
|
DENYLIST_ENFORCING
),
PRIVATE_MASK
=
(
DENYLIST_ENFORCING
|
PROCESS_IS_MAGISK_APP
)
PRIVATE_MASK
=
(
PROCESS_IS_SYS_UI
|
DENYLIST_ENFORCING
|
PROCESS_IS_MAGISK_APP
)
};
struct
api_abi_base
{
...
...
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