build/make/core/main.mk@@ -281,7 +281,7 @@ enable_target_debugging := true
tags_to_install :=
ifneq (,$(user_variant))
# Target is secure in user builds.
-ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=1
+ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=0
ADDITIONAL_DEFAULT_PROPERTIES += security.perf_harden=1ifeq ($(user_variant),user)
@@ -293,7 +293,7 @@ ifneq (,$(user_variant))
tags_to_install += debug
else
# Disable debugging in plain user builds.
-enable_target_debugging :=
+#enable_target_debugging :=
endif# Disallow mock locations by default for user builds
frameworks/base/core/jni/com_android_internal_os_Zygote.cpp@@ -549,7 +549,7 @@ static void EnableKeepCapabilities(fail_fn_t fail_fn) {
} static void DropCapabilitiesBoundingSet(fail_fn_t fail_fn) {
-for (int i = 0;
prctl(PR_CAPBSET_READ, i, 0, 0, 0) >= 0;
i++) {;
+/*for (int i = 0;
prctl(PR_CAPBSET_READ, i, 0, 0, 0) >= 0;
i++) {;
if (prctl(PR_CAPBSET_DROP, i, 0, 0, 0) == -1) {
if (errno == EINVAL) {
ALOGE("prctl(PR_CAPBSET_DROP) failed with EINVAL. Please verify "
@@ -558,7 +558,7 @@ static void DropCapabilitiesBoundingSet(fail_fn_t fail_fn) {
fail_fn(CREATE_ERROR("prctl(PR_CAPBSET_DROP, %d) failed: %s", i, strerror(errno)));
}
}
-}
+}*/
} static void SetInheritable(uint64_t inheritable, fail_fn_t fail_fn) {
system/core/libcutils/fs_config.cpp@@ -197,7 +197,7 @@ static const struct fs_path_config android_files[] = {
// the following two files are INTENTIONALLY set-uid, but they
// are NOT included on user builds.
{ 06755, AID_ROOT,AID_ROOT,0, "system/xbin/procmem" },
-{ 04750, AID_ROOT,AID_SHELL,0, "system/xbin/su" },
+{ 06755, AID_ROOT,AID_ROOT,0, "system/xbin/su" },// the following files have enhanced capabilities and ARE included
// in user builds.
system/extras/su/su.cpp@@ -80,8 +80,8 @@ void extract_uidgids(const char* uidgids, uid_t* uid, gid_t* gid, gid_t* gids, i
} int main(int argc, char** argv) {
-uid_t current_uid = getuid();
-if (current_uid != AID_ROOT && current_uid != AID_SHELL) error(1, 0, "not allowed");
+//uid_t current_uid = getuid();
+//if (current_uid != AID_ROOT && current_uid != AID_SHELL) error(1, 0, "not allowed");
// Handle -h and --help.
++argv;
参考:https://blog.csdn.net/q1183345443/article/details/77711643?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.compare&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.compare
【android10 su】https://blog.csdn.net/cau_eric/article/details/103086233?utm_medium=distribute.pc_relevant.none-task-blog-baidujs-7&spm=1001.2101.3001.4242