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
9c27d691
Commit
9c27d691
authored
Oct 19, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop API 17 (Android 4.2) support
parent
935bd01f
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
29 deletions
+12
-29
build.gradle
build.gradle
+1
-1
applets.cpp
native/jni/core/applets.cpp
+1
-1
rootdir.cpp
native/jni/init/rootdir.cpp
+8
-9
selinux.h
native/jni/utils/include/selinux.h
+1
-2
selinux.cpp
native/jni/utils/selinux.cpp
+0
-15
flash_script.sh
scripts/flash_script.sh
+1
-1
No files found.
build.gradle
View file @
9c27d691
...
@@ -47,7 +47,7 @@ subprojects {
...
@@ -47,7 +47,7 @@ subprojects {
defaultConfig
{
defaultConfig
{
if
(
minSdkVersion
==
null
)
if
(
minSdkVersion
==
null
)
minSdkVersion
1
7
minSdkVersion
1
8
targetSdkVersion
28
targetSdkVersion
28
}
}
...
...
native/jni/core/applets.cpp
View file @
9c27d691
...
@@ -26,7 +26,7 @@ static int (*applet_main[]) (int, char *[]) =
...
@@ -26,7 +26,7 @@ static int (*applet_main[]) (int, char *[]) =
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
umask
(
0
);
umask
(
0
);
dload_selinux
();
selinux_builtin_impl
();
cmdline_logging
();
cmdline_logging
();
init_argv0
(
argc
,
argv
);
init_argv0
(
argc
,
argv
);
...
...
native/jni/init/rootdir.cpp
View file @
9c27d691
...
@@ -153,25 +153,24 @@ void SARCompatInit::setup_rootfs() {
...
@@ -153,25 +153,24 @@ void SARCompatInit::setup_rootfs() {
}
}
bool
MagiskInit
::
patch_sepolicy
(
const
char
*
file
)
{
bool
MagiskInit
::
patch_sepolicy
(
const
char
*
file
)
{
bool
patch_init
=
false
;
bool
require_patch
=
false
;
// Mount selinuxfs to communicate with kernel
xmount
(
"selinuxfs"
,
SELINUX_MNT
,
"selinuxfs"
,
0
,
nullptr
);
if
(
access
(
SPLIT_PLAT_CIL
,
R_OK
)
==
0
)
{
if
(
access
(
SPLIT_PLAT_CIL
,
R_OK
)
==
0
)
{
LOGD
(
"sepol: split policy
\n
"
);
LOGD
(
"sepol: split policy
\n
"
);
patch_init
=
true
;
load_split_cil
();
require_patch
=
true
;
}
else
if
(
access
(
"/sepolicy"
,
R_OK
)
==
0
)
{
}
else
if
(
access
(
"/sepolicy"
,
R_OK
)
==
0
)
{
LOGD
(
"sepol: monolithic policy
\n
"
);
LOGD
(
"sepol: monolithic policy
\n
"
);
load_policydb
(
"/sepolicy"
);
load_policydb
(
"/sepolicy"
);
}
else
{
}
else
{
// Fatal error!!
LOGD
(
"sepol: no selinux
\n
"
);
LOGD
(
"sepol: no selinux
\n
"
);
return
false
;
return
false
;
}
}
// Mount selinuxfs to communicate with kernel
xmount
(
"selinuxfs"
,
SELINUX_MNT
,
"selinuxfs"
,
0
,
nullptr
);
if
(
patch_init
)
load_split_cil
();
sepol_magisk_rules
();
sepol_magisk_rules
();
sepol_allow
(
SEPOL_PROC_DOMAIN
,
ALL
,
ALL
,
ALL
);
sepol_allow
(
SEPOL_PROC_DOMAIN
,
ALL
,
ALL
,
ALL
);
dump_policydb
(
file
);
dump_policydb
(
file
);
...
@@ -182,7 +181,7 @@ bool MagiskInit::patch_sepolicy(const char *file) {
...
@@ -182,7 +181,7 @@ bool MagiskInit::patch_sepolicy(const char *file) {
link
(
"/sepolicy"
,
"/sepolicy_debug"
);
link
(
"/sepolicy"
,
"/sepolicy_debug"
);
}
}
return
patch_init
;
return
require_patch
;
}
}
constexpr
const
char
wrapper
[]
=
constexpr
const
char
wrapper
[]
=
...
...
native/jni/utils/include/selinux.h
View file @
9c27d691
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
__BEGIN_DECLS
__BEGIN_DECLS
extern
void
(
*
freecon
)(
char
*
con
);
#define freecon free
extern
int
(
*
setcon
)(
const
char
*
con
);
extern
int
(
*
setcon
)(
const
char
*
con
);
extern
int
(
*
getfilecon
)(
const
char
*
path
,
char
**
con
);
extern
int
(
*
getfilecon
)(
const
char
*
path
,
char
**
con
);
extern
int
(
*
lgetfilecon
)(
const
char
*
path
,
char
**
con
);
extern
int
(
*
lgetfilecon
)(
const
char
*
path
,
char
**
con
);
...
@@ -32,7 +32,6 @@ void getfilecon_at(int dirfd, const char *name, char **con);
...
@@ -32,7 +32,6 @@ void getfilecon_at(int dirfd, const char *name, char **con);
void
setfilecon_at
(
int
dirfd
,
const
char
*
name
,
const
char
*
con
);
void
setfilecon_at
(
int
dirfd
,
const
char
*
name
,
const
char
*
con
);
void
selinux_builtin_impl
();
void
selinux_builtin_impl
();
void
dload_selinux
();
void
restorecon
();
void
restorecon
();
void
restore_rootcon
();
void
restore_rootcon
();
...
...
native/jni/utils/selinux.cpp
View file @
9c27d691
...
@@ -38,10 +38,6 @@ static int stub(int, char **ctx) {
...
@@ -38,10 +38,6 @@ static int stub(int, char **ctx) {
// Builtin implementation
// Builtin implementation
static
void
__freecon
(
char
*
s
)
{
free
(
s
);
}
static
int
__setcon
(
const
char
*
ctx
)
{
static
int
__setcon
(
const
char
*
ctx
)
{
int
fd
=
open
(
"/proc/self/attr/current"
,
O_WRONLY
|
O_CLOEXEC
);
int
fd
=
open
(
"/proc/self/attr/current"
,
O_WRONLY
|
O_CLOEXEC
);
if
(
fd
<
0
)
if
(
fd
<
0
)
...
@@ -114,7 +110,6 @@ static int __fsetfilecon(int fd, const char *ctx) {
...
@@ -114,7 +110,6 @@ static int __fsetfilecon(int fd, const char *ctx) {
// Function pointers
// Function pointers
void
(
*
freecon
)(
char
*
)
=
__freecon
;
int
(
*
setcon
)(
const
char
*
)
=
stub
;
int
(
*
setcon
)(
const
char
*
)
=
stub
;
int
(
*
getfilecon
)(
const
char
*
,
char
**
)
=
stub
;
int
(
*
getfilecon
)(
const
char
*
,
char
**
)
=
stub
;
int
(
*
lgetfilecon
)(
const
char
*
,
char
**
)
=
stub
;
int
(
*
lgetfilecon
)(
const
char
*
,
char
**
)
=
stub
;
...
@@ -146,16 +141,6 @@ void selinux_builtin_impl() {
...
@@ -146,16 +141,6 @@ void selinux_builtin_impl() {
fsetfilecon
=
__fsetfilecon
;
fsetfilecon
=
__fsetfilecon
;
}
}
void
dload_selinux
()
{
if
(
access
(
"/system/lib/libselinux.so"
,
F_OK
))
return
;
/* We only check whether libselinux.so exists but don't dlopen.
* For some reason calling symbols returned from dlsym
* will result to SEGV_ACCERR on some devices.
* Always use builtin implementations for SELinux stuffs. */
selinux_builtin_impl
();
}
static
void
restore_syscon
(
int
dirfd
)
{
static
void
restore_syscon
(
int
dirfd
)
{
struct
dirent
*
entry
;
struct
dirent
*
entry
;
DIR
*
dir
;
DIR
*
dir
;
...
...
scripts/flash_script.sh
View file @
9c27d691
...
@@ -53,7 +53,7 @@ ui_print "- Target image: $BOOTIMAGE"
...
@@ -53,7 +53,7 @@ ui_print "- Target image: $BOOTIMAGE"
# Detect version and architecture
# Detect version and architecture
api_level_arch_detect
api_level_arch_detect
[
$API
-lt
1
7
]
&&
abort
"! Magisk is only for Android 4.2
and above"
[
$API
-lt
1
8
]
&&
abort
"! Magisk is only for Android 4.3
and above"
ui_print
"- Device platform:
$ARCH
"
ui_print
"- Device platform:
$ARCH
"
...
...
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