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));
}
相关推荐
2501_9160088918 小时前
前端工具全景实战指南,从开发到调试的效率闭环
android·前端·小程序·https·uni-app·iphone·webview
浅影歌年19 小时前
Android和h5页面相互传参
android
用户693717500138419 小时前
搞懂 Kotlin 软关键字与硬关键字:灵活命名与语法陷阱全解析
android
下位子20 小时前
『OpenGL学习滤镜相机』- Day2: 渲染第一个三角形
android·opengl
风语者日志21 小时前
[LitCTF 2023]这是什么?SQL !注一下 !
android·数据库·sql
2501_9159214321 小时前
iOS 26 CPU 使用率监控策略 多工具协同构建性能探索体系
android·ios·小程序·https·uni-app·iphone·webview
狂团商城小师妹21 小时前
JAVA国际版同城打车源码同城服务线下结账系统源码适配PAD支持Android+IOS+H5
android·java·ios·小程序·交友
游戏开发爱好者81 天前
iOS 应用逆向对抗手段,多工具组合实战(iOS 逆向防护/IPA 混淆/无源码加固/Ipa Guard CLI 实操)
android·ios·小程序·https·uni-app·iphone·webview
虚伪的空想家1 天前
ip网段扫描机器shell脚本
android·linux·网络协议·tcp/ip·shell·脚本·network
generallizhong1 天前
android TAB切换
android·gitee