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
00a9f18a
Commit
00a9f18a
authored
Apr 30, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Build with -Wall
parent
8d68ebb0
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
25 additions
and
26 deletions
+25
-26
Application.mk
native/jni/Application.mk
+1
-1
bootstages.cpp
native/jni/core/bootstages.cpp
+1
-1
compress.cpp
native/jni/magiskboot/compress.cpp
+4
-4
ramdisk.cpp
native/jni/magiskboot/ramdisk.cpp
+1
-1
connect.cpp
native/jni/su/connect.cpp
+8
-8
pts.cpp
native/jni/su/pts.cpp
+0
-1
su.h
native/jni/su/su.h
+6
-6
su_daemon.cpp
native/jni/su/su_daemon.cpp
+4
-4
No files found.
native/jni/Application.mk
View file @
00a9f18a
APP_ABI := armeabi-v7a x86
APP_CFLAGS := -Oz -fomit-frame-pointer -flto \
APP_CFLAGS := -
Wall -
Oz -fomit-frame-pointer -flto \
-D__MVSTR=${MAGISK_VERSION} -D__MCODE=${MAGISK_VER_CODE}
APP_LDFLAGS := -flto
APP_CPPFLAGS := -std=c++17
...
...
native/jni/core/bootstages.cpp
View file @
00a9f18a
...
...
@@ -207,7 +207,7 @@ void node_entry::create_module_tree(const char *module) {
void
node_entry
::
clone_skeleton
()
{
DIR
*
dir
;
struct
dirent
*
entry
;
struct
node_entry
*
dummy
;
node_entry
*
dummy
;
// Clone the structure
auto
full_path
=
get_path
();
...
...
native/jni/magiskboot/compress.cpp
View file @
00a9f18a
...
...
@@ -422,8 +422,8 @@ void LZ4FEncoder::write_header() {
FilterOutStream
::
write
(
outbuf
,
write
);
}
LZ4Decoder
::
LZ4Decoder
()
:
init
(
false
),
buf_off
(
0
),
total
(
0
),
block_sz
(
0
),
outbuf
(
new
char
[
LZ4_UNCOMPRESSED
]),
buf
(
new
char
[
LZ4_COMPRESSED
]
)
{}
LZ4Decoder
::
LZ4Decoder
()
:
outbuf
(
new
char
[
LZ4_UNCOMPRESSED
]),
buf
(
new
char
[
LZ4_COMPRESSED
]
),
init
(
false
),
block_sz
(
0
),
buf_off
(
0
),
total
(
0
)
{}
LZ4Decoder
::~
LZ4Decoder
()
{
delete
[]
outbuf
;
...
...
@@ -476,8 +476,8 @@ uint64_t LZ4Decoder::finalize() {
return
total
;
}
LZ4Encoder
::
LZ4Encoder
()
:
init
(
false
),
buf_off
(
0
),
out_total
(
0
),
in_total
(
0
),
outbuf
(
new
char
[
LZ4_COMPRESSED
]),
buf
(
new
char
[
LZ4_UNCOMPRESSED
]
)
{}
LZ4Encoder
::
LZ4Encoder
()
:
outbuf
(
new
char
[
LZ4_COMPRESSED
]),
buf
(
new
char
[
LZ4_UNCOMPRESSED
]
),
init
(
false
),
buf_off
(
0
),
out_total
(
0
),
in_total
(
0
)
{}
LZ4Encoder
::~
LZ4Encoder
()
{
delete
[]
outbuf
;
...
...
native/jni/magiskboot/ramdisk.cpp
View file @
00a9f18a
...
...
@@ -165,7 +165,7 @@ void magisk_cpio::backup(const char *orig) {
res
=
lhs
->
first
.
compare
(
rhs
->
first
);
}
else
if
(
lhs
==
o
.
entries
.
end
())
{
res
=
1
;
}
else
if
(
rhs
==
entries
.
end
())
{
}
else
{
res
=
-
1
;
}
...
...
native/jni/su/connect.cpp
View file @
00a9f18a
...
...
@@ -17,7 +17,7 @@
// 0x18000020 = FLAG_ACTIVITY_NEW_TASK|FLAG_ACTIVITY_MULTIPLE_TASK|FLAG_INCLUDE_STOPPED_PACKAGES
static
inline
const
char
*
get_command
(
const
s
truct
s
u_request
*
to
)
{
static
inline
const
char
*
get_command
(
const
su_request
*
to
)
{
if
(
to
->
command
[
0
])
return
to
->
command
;
if
(
to
->
shell
[
0
])
...
...
@@ -25,21 +25,21 @@ static inline const char *get_command(const struct su_request *to) {
return
DEFAULT_SHELL
;
}
static
inline
void
get_user
(
char
*
user
,
s
truct
s
u_info
*
info
)
{
static
inline
void
get_user
(
char
*
user
,
su_info
*
info
)
{
sprintf
(
user
,
"%d"
,
info
->
cfg
[
SU_MULTIUSER_MODE
]
==
MULTIUSER_MODE_USER
?
info
->
uid
/
100000
:
0
);
}
static
inline
void
get_uid
(
char
*
uid
,
s
truct
s
u_info
*
info
)
{
static
inline
void
get_uid
(
char
*
uid
,
su_info
*
info
)
{
sprintf
(
uid
,
"%d"
,
info
->
cfg
[
SU_MULTIUSER_MODE
]
==
MULTIUSER_MODE_OWNER_MANAGED
?
info
->
uid
%
100000
:
info
->
uid
);
}
static
void
silent_run
(
const
char
**
args
,
s
truct
s
u_info
*
info
)
{
static
void
silent_run
(
const
char
**
args
,
su_info
*
info
)
{
char
component
[
128
];
sprintf
(
component
,
"%s/a.m"
,
info
->
str
[
SU_MANAGER
].
data
());
char
user
[
8
];
...
...
@@ -62,7 +62,7 @@ static void silent_run(const char **args, struct su_info *info) {
exec_command
(
exec
);
}
void
app_log
(
s
truct
s
u_context
*
ctx
)
{
void
app_log
(
su_context
*
ctx
)
{
char
fromUid
[
8
];
get_uid
(
fromUid
,
ctx
->
info
);
...
...
@@ -88,7 +88,7 @@ void app_log(struct su_context *ctx) {
silent_run
(
cmd
,
ctx
->
info
);
}
void
app_notify
(
s
truct
s
u_context
*
ctx
)
{
void
app_notify
(
su_context
*
ctx
)
{
char
fromUid
[
8
];
get_uid
(
fromUid
,
ctx
->
info
);
...
...
@@ -104,7 +104,7 @@ void app_notify(struct su_context *ctx) {
silent_run
(
cmd
,
ctx
->
info
);
}
void
app_connect
(
const
char
*
socket
,
s
truct
s
u_info
*
info
)
{
void
app_connect
(
const
char
*
socket
,
su_info
*
info
)
{
const
char
*
cmd
[]
=
{
START_ACTIVITY
,
"request"
,
"--es"
,
"socket"
,
socket
,
...
...
@@ -113,7 +113,7 @@ void app_connect(const char *socket, struct su_info *info) {
silent_run
(
cmd
,
info
);
}
void
socket_send_request
(
int
fd
,
s
truct
s
u_info
*
info
)
{
void
socket_send_request
(
int
fd
,
su_info
*
info
)
{
write_key_token
(
fd
,
"uid"
,
info
->
uid
);
write_string_be
(
fd
,
"eof"
);
}
native/jni/su/pts.cpp
View file @
00a9f18a
...
...
@@ -83,7 +83,6 @@ static void pump_async(int input, int output) {
*/
int
pts_open
(
char
*
slave_name
,
size_t
slave_name_size
)
{
int
fdm
;
char
sn_tmp
[
256
];
// Open master ptmx device
fdm
=
open
(
"/dev/ptmx"
,
O_RDWR
);
...
...
native/jni/su/su.h
View file @
00a9f18a
...
...
@@ -60,16 +60,16 @@ struct su_request : public su_req_base {
}
__attribute__
((
packed
));
struct
su_context
{
s
truct
s
u_info
*
info
;
s
truct
s
u_request
req
;
su_info
*
info
;
su_request
req
;
pid_t
pid
;
};
// connect.c
void
app_log
(
s
truct
s
u_context
*
ctx
);
void
app_notify
(
s
truct
s
u_context
*
ctx
);
void
app_connect
(
const
char
*
socket
,
s
truct
s
u_info
*
info
);
void
socket_send_request
(
int
fd
,
s
truct
s
u_info
*
info
);
void
app_log
(
su_context
*
ctx
);
void
app_notify
(
su_context
*
ctx
);
void
app_connect
(
const
char
*
socket
,
su_info
*
info
);
void
socket_send_request
(
int
fd
,
su_info
*
info
);
#endif
native/jni/su/su_daemon.cpp
View file @
00a9f18a
...
...
@@ -26,8 +26,8 @@ static pthread_mutex_t cache_lock = PTHREAD_MUTEX_INITIALIZER;
static
su_info
*
cache
;
su_info
::
su_info
(
unsigned
uid
)
:
uid
(
uid
),
access
(
DEFAULT_SU_ACCESS
),
_lock
(
PTHREAD_MUTEX_INITIALIZER
),
count
(
0
),
ref
(
0
),
timestamp
(
0
),
mgr_st
({}
)
{}
uid
(
uid
),
count
(
0
),
access
(
DEFAULT_SU_ACCESS
),
mgr_st
({}),
ref
(
0
),
timestamp
(
0
),
_lock
(
PTHREAD_MUTEX_INITIALIZER
)
{}
su_info
::~
su_info
()
{
pthread_mutex_destroy
(
&
_lock
);
...
...
@@ -90,7 +90,7 @@ static void database_check(su_info *info) {
validate_manager
(
info
->
str
[
SU_MANAGER
],
uid
/
100000
,
&
info
->
mgr_st
);
}
static
s
truct
s
u_info
*
get_su_info
(
unsigned
uid
)
{
static
su_info
*
get_su_info
(
unsigned
uid
)
{
su_info
*
info
=
nullptr
;
// Get from cache or new instance
...
...
@@ -235,7 +235,7 @@ void su_daemon_handler(int client, struct ucred *credential) {
// Abort upon any error occurred
log_cb
.
ex
=
exit
;
s
truct
s
u_context
ctx
=
{
su_context
ctx
=
{
.
info
=
info
,
.
pid
=
credential
->
pid
};
...
...
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