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
6bff6e9c
Commit
6bff6e9c
authored
Oct 03, 2016
by
Pierre-Hugues Husson
Committed by
topjohnwu
Oct 04, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[hidesu] Don't suicide
parent
023d369b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
hidesu.c
jni/hidesu.c
+5
-6
No files found.
jni/hidesu.c
View file @
6bff6e9c
...
@@ -23,21 +23,20 @@ int disableSu(int pid) {
...
@@ -23,21 +23,20 @@ int disableSu(int pid) {
char
*
path
=
NULL
;
char
*
path
=
NULL
;
asprintf
(
&
path
,
"/proc/%d/ns/mnt"
,
pid
);
asprintf
(
&
path
,
"/proc/%d/ns/mnt"
,
pid
);
int
fd
=
open
(
path
,
O_RDONLY
);
int
fd
=
open
(
path
,
O_RDONLY
);
if
(
fd
==
-
1
)
exit
(
2
)
;
if
(
fd
==
-
1
)
return
2
;
//TODO: Fix non arm platforms
//TODO: Fix non arm platforms
#define SYS_setns 375
#define SYS_setns 375
int
res
=
syscall
(
SYS_setns
,
fd
,
0
);
int
res
=
syscall
(
SYS_setns
,
fd
,
0
);
if
(
res
==
-
1
)
exit
(
3
)
;
if
(
res
==
-
1
)
return
3
;
//XXX: What to mount to /sbin...?
//XXX: What to mount to /sbin...?
res
=
mount
(
"/system"
,
"/sbin"
,
"bind"
,
MS_BIND
,
""
);
res
=
mount
(
"/system"
,
"/sbin"
,
"bind"
,
MS_BIND
,
""
);
if
(
res
==
-
1
)
exit
(
4
)
;
if
(
res
==
-
1
)
return
4
;
return
0
;
return
0
;
}
}
int
main
(
int
argc
,
char
**
argv
,
char
**
envp
)
{
int
main
(
int
argc
,
char
**
argv
,
char
**
envp
)
{
system
(
"logcat -b events -c"
);
FILE
*
p
=
popen
(
"while true;do logcat -b events -v raw -s am_proc_start;sleep 1;done"
,
"r"
);
FILE
*
p
=
popen
(
"logcat -b events -v raw -s am_proc_start"
,
"r"
);
while
(
!
feof
(
p
))
{
while
(
!
feof
(
p
))
{
//Format of am_proc_start is (as of Android 5.1 and 6.0)
//Format of am_proc_start is (as of Android 5.1 and 6.0)
//UserID, pid, unix uid, processName, hostingType, hostingName
//UserID, pid, unix uid, processName, hostingType, hostingName
...
@@ -63,7 +62,7 @@ int main(int argc, char **argv, char **envp) {
...
@@ -63,7 +62,7 @@ int main(int argc, char **argv, char **envp) {
if
(
ret
!=
6
)
{
if
(
ret
!=
6
)
{
printf
(
"sscanf returned %d on '%s'
\n
"
,
ret
,
buffer
);
printf
(
"sscanf returned %d on '%s'
\n
"
,
ret
,
buffer
);
exit
(
1
)
;
continue
;
}
}
#define GMS_PROC "com.google.android.gms.unstable"
#define GMS_PROC "com.google.android.gms.unstable"
if
(
strcmp
(
processName
,
GMS_PROC
)
==
0
)
{
if
(
strcmp
(
processName
,
GMS_PROC
)
==
0
)
{
...
...
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