android 6.0 源码修改su

1、路径:

android6.0\system\extras\su\su.c

修改:

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");

2、路径:

android6.0\system\core\init\init.cpp

修改:

static bool selinux_is_disabled(void)
{
    if (ALLOW_DISABLE_SELINUX) {
        if (access("/sys/fs/selinux", F_OK) != 0) {
            // SELinux is not compiled into the kernel, or has been disabled
            // via the kernel command line "selinux=0".
            return true;
        }
      - //return selinux_status_from_cmdline() == SELINUX_DISABLED;
      + return true;
    }

    return false;
}

3、路径:

android6.0\frameworks\base\core\jni\com_android_internal_os_Zygote.cpp

修改:

static void DropCapabilitiesBoundingSet(JNIEnv* env) {
+/*	
  for (int i = 0; prctl(PR_CAPBSET_READ, i, 0, 0, 0) >= 0; i++) {
    int rc = prctl(PR_CAPBSET_DROP, i, 0, 0, 0);
    if (rc == -1) {
      if (errno == EINVAL) {
        ALOGE("prctl(PR_CAPBSET_DROP) failed with EINVAL. Please verify "
              "your kernel is compiled with file capabilities support");
      } else {
        ALOGE("prctl(PR_CAPBSET_DROP) failed");
        RuntimeAbort(env);
      }
    }
  }
+*/  
}

 4、路径:

android6.0\frameworks\base\cmds\app_process\app_main.cpp

 修改:

int main(int argc, char* const argv[])
{
    +/*
    if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) < 0) {
        // Older kernels don't understand PR_SET_NO_NEW_PRIVS and return
        // EINVAL. Don't die on such kernels.
        if (errno != EINVAL) {
            LOG_ALWAYS_FATAL("PR_SET_NO_NEW_PRIVS failed: %s", strerror(errno));
            return 12;
        }
    }
   +*/ 

    AppRuntime runtime(argv[0], computeArgBlockSize(argc, argv));
    // Process command line arguments
    // ignore argv[0]
    argc--;
    argv++;

5、路径:

android6.0\system\core\libcutils\fs_config.c

修改:

-//{ 04750, AID_ROOT,      AID_SHELL,     0, "system/xbin/su" },
+{ 06755, AID_ROOT,      AID_SHELL,     0, "system/xbin/su" },

参考:

https://blog.csdn.net/alianqiugui/article/details/79392101

https://blog.csdn.net/q1183345443/article/details/77711643

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值