[android]MT6835 Android 关闭selinux方法

Selinux

SELinux is an optional feature of the Linux kernel that provides support to enforce access control security policies to enforce MAC. It is based on the LSM framework.

Working with SELinux on Android -- LineageOS

Android 关闭selinux

MT6835 Android系统默认是开启selinux的,由于selinux限制比较多,所以需要关闭selinux

MT6835 关闭SeLinux方法

软件代码直接关闭

target/system/core/init/selinux.cpp

复制代码
bool IsEnforcing() {
    if (ALLOW_PERMISSIVE_SELINUX) {
        return StatusFromProperty() == SELINUX_ENFORCING;
    }
    return true;
}

修改为

复制代码
bool IsEnforcing() {
    /*if (ALLOW_PERMISSIVE_SELINUX) {
        return StatusFromProperty() == SELINUX_ENFORCING;
    }*/
    return false;
}

mssi/system/core/init/selinux.cpp

复制代码
bool IsEnforcing() {
    if (ALLOW_PERMISSIVE_SELINUX) {
        return StatusFromProperty() == SELINUX_ENFORCING;
    }
    return true;
}

修改为

复制代码
bool IsEnforcing() {
    /*if (ALLOW_PERMISSIVE_SELINUX) {
        return StatusFromProperty() == SELINUX_ENFORCING;
    }*/
    return false;
}

内核配置启动参数

修改BOARD_KERNEL_CMDLINE增加androidboot.selinux = permissive

查看

./target/build/make/core/board_config.mk

_board_strip_readonly_list += BOARD_KERNEL_CMDLINE

INTERNAL_KERNEL_CMDLINE:= $(BOARD_KERNEL_CMDLINE)

发现BOARD_KERNEL_CMDLINE最终赋值给到INTERNAL_KERNEL_CMDLINE

所以我们只需要修改INTERNAL_KERNEL_CMDLINE接口

修改方法

./target/build/make/core/config.mk

复制代码
ifneq ($(BOARD_SUPER_PARTITION_METADATA_DEVICE),super)
INTERNAL_KERNEL_CMDLINE += androidboot.super_partition=$(BOARD_SUPER_PARTITION_METADATA_DEVICE)
endif

修改为

复制代码
ifneq ($(BOARD_SUPER_PARTITION_METADATA_DEVICE),super)
INTERNAL_KERNEL_CMDLINE += androidboot.super_partition=$(BOARD_SUPER_PARTITION_METADATA_DEVICE)
endif
INTERNAL_KERNEL_CMDLINE += androidboot.selinux = permissive

./mssi/build/make/core/config.mk

复制代码
# The metadata device must be supplied to init via the kernel command-line.
INTERNAL_KERNEL_CMDLINE += androidboot.super_partition=$(BOARD_SUPER_PARTITION_METADATA_DEVICE)

修改为

复制代码
# The metadata device must be supplied to init via the kernel command-line.
INTERNAL_KERNEL_CMDLINE += androidboot.selinux = permissive
INTERNAL_KERNEL_CMDLINE += androidboot.super_partition=$(BOARD_SUPER_PARTITION_METADATA_DEVICE)
相关推荐
深盾安全16 分钟前
Android SO导出符号的深度解析与安全防护指南
android
顾林海36 分钟前
Android安全防护:Runtime 调试检测与反制手段
android·安全·面试
什么半岛铁盒41 分钟前
MySQL 约束知识体系:八大约束类型详细讲解
android·数据库·mysql
丐中丐9991 小时前
Android系统中如何在Native层调用java实现的系统服务
android·操作系统
stringwu1 小时前
Flutter plugin开发小知识之:ActivityAware 详解
android
whysqwhw1 小时前
Matrix.setPolyToPoly() 函数使用指南
android
丐中丐9991 小时前
在Android中利用抽象类对外提供系统接口
android·操作系统
张可1 小时前
在 Voyager 中使用 SharedElement 共享元素动画
android·前端·kotlin
且随疾风前行.2 小时前
在安卓中使用 FFmpegKit 剪切视频并添加文字水印
android·音视频
Yang-Never2 小时前
设计模式 -> 策略模式(Strategy Pattern)
android·开发语言·设计模式·kotlin·android studio·策略模式