android系列-init SetupSelinux

1.FirstStageMain

cpp 复制代码
//android10\system\core\init\first_stage_init.cpp

int FirstStageMain(int argc, char** argv) {
    const char* path = "/system/bin/init";
    const char* args[] = {path, "selinux_setup", nullptr};
    execv(path, const_cast<char**>(args));
}

2.main

cpp 复制代码
//android10\system\core\init\main.cpp
int main(int argc, char** argv) {

    if (argc > 1) {

        if (!strcmp(argv[1], "selinux_setup")) {
            return SetupSelinux(argv);
        }
    }
}

3.SetupSelinux

java 复制代码
//android10\system\core\init\selinux.cpp

int SetupSelinux(char** argv) {
    InitKernelLogging(argv); //为啥调用多次

    // Set up SELinux, loading the SELinux policy.
    SelinuxSetupKernelLogging();
    SelinuxInitialize();

    const char* path = "/system/bin/init";
    const char* args[] = {path, "second_stage", nullptr};//4.second_stage
    execv(path, const_cast<char**>(args));
}
相关推荐
携欢2 小时前
PortSwigger靶场之Web shell upload via path traversal靶场通关秘籍
android
消失的旧时光-194310 小时前
Android ADB指令大全详解
android·adb
ashcn200112 小时前
opengl 播放视频的android c++ 方案
android·c++ opengl es
abner.Li12 小时前
android 反编译
android
Digitally12 小时前
如何删除 realme 手机上的短信
android
2501_9160088912 小时前
提高 iOS 应用逆向难度的工程实践,多工具联动的全栈安全方案
android·安全·ios·小程序·uni-app·cocoa·iphone
沐怡旸12 小时前
【底层机制】Android图形渲染体系深度解析:VSync信号机制
android·面试
BoomHe13 小时前
Android 13 (API 33)上自定义广播
android
来来走走14 小时前
Android开发(Kotlin) ViewModel基本用法
android·开发语言·kotlin
Digitally14 小时前
在荣耀手机上删除短信的完整指南
android