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
b51feffe
Commit
b51feffe
authored
Mar 01, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Limit process name match to cmdline only
We are only interested in Zygote forked processed
parent
b1afd554
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
hide_utils.cpp
native/jni/magiskhide/hide_utils.cpp
+5
-3
No files found.
native/jni/magiskhide/hide_utils.cpp
View file @
b51feffe
...
...
@@ -68,6 +68,7 @@ void crawl_procfs(const function<bool (int)> &fn) {
bool
proc_name_match
(
int
pid
,
const
char
*
name
)
{
char
buf
[
4019
];
FILE
*
f
;
#if 0
sprintf(buf, "/proc/%d/comm", pid);
if ((f = fopen(buf, "re"))) {
fgets(buf, sizeof(buf), f);
...
...
@@ -78,6 +79,7 @@ bool proc_name_match(int pid, const char *name) {
// The PID is already killed
return false;
}
#endif
sprintf
(
buf
,
"/proc/%d/cmdline"
,
pid
);
if
((
f
=
fopen
(
buf
,
"re"
)))
{
...
...
@@ -85,17 +87,17 @@ bool proc_name_match(int pid, const char *name) {
fclose
(
f
);
if
(
strcmp
(
basename
(
buf
),
name
)
==
0
)
return
true
;
}
else
{
// The PID is already killed
return
false
;
}
return
false
;
#if 0
sprintf(buf, "/proc/%d/exe", pid);
ssize_t len;
if ((len = readlink(buf, buf, sizeof(buf))) < 0)
return false;
buf[len] = '\0';
return strcmp(basename(buf), name) == 0;
#endif
}
static
void
kill_process
(
const
char
*
name
)
{
...
...
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