forked from lbdroid/AOSP-SU-PATCH
/
system_core.patch
46 lines (44 loc) · 1.87 KB
/
system_core.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
diff --git a/init/init.cpp b/init/init.cpp
index 84da2b9..df71760 100644
--- a/init/init.cpp
+++ b/init/init.cpp
@@ -665,6 +665,7 @@ int main(int argc, char** argv) {
restorecon("/dev/__properties__");
restorecon("/property_contexts");
restorecon_recursive("/sys");
+ restorecon_recursive("/sbin");
epoll_fd = epoll_create1(EPOLL_CLOEXEC);
if (epoll_fd == -1) {
diff --git a/libcutils/fs_config.c b/libcutils/fs_config.c
index 840ac86..509bcda 100644
--- a/libcutils/fs_config.c
+++ b/libcutils/fs_config.c
@@ -94,7 +94,7 @@ static const struct fs_path_config android_dirs[] = {
{ 00771, AID_SYSTEM, AID_SYSTEM, 0, "data" },
{ 00755, AID_ROOT, AID_SYSTEM, 0, "mnt" },
{ 00755, AID_ROOT, AID_ROOT, 0, "root" },
- { 00750, AID_ROOT, AID_SHELL, 0, "sbin" },
+ { 00755, AID_ROOT, AID_SHELL, 0, "sbin" },
{ 00751, AID_ROOT, AID_SDCARD_R, 0, "storage" },
{ 00755, AID_ROOT, AID_SHELL, 0, "system/bin" },
{ 00755, AID_ROOT, AID_SHELL, 0, "system/vendor" },
@@ -137,6 +137,7 @@ static const struct fs_path_config android_files[] = {
* are NOT included on user builds. */
{ 04750, AID_ROOT, AID_SHELL, 0, "system/xbin/su" },
{ 06755, AID_ROOT, AID_ROOT, 0, "system/xbin/procmem" },
+ { 06755, AID_ROOT, AID_ROOT, 0, "sbin/su" },
/* the following files have enhanced capabilities and ARE included in user builds. */
{ 00750, AID_ROOT, AID_SHELL, CAP_MASK_LONG(CAP_SETUID) | CAP_MASK_LONG(CAP_SETGID), "system/bin/run-as" },
diff --git a/rootdir/init.rc b/rootdir/init.rc
index 3466dce..3699933 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -639,3 +639,8 @@ on property:ro.debuggable=1
service flash_recovery /system/bin/install-recovery.sh
class main
oneshot
+
+service daemonsu /sbin/su --daemon
+ class main
+ user root
+ seclabel u:r:su:s0