android init时将此结点设置为2:/proc/sys/kernel/kptr_restrict

Result<Success> SetKptrRestrictAction(const BuiltinArguments&) {
    std::string path = KPTR_RESTRICT_PATH;

    if (!SetHighestAvailableOptionValue(path, KPTR_RESTRICT_MINVALUE, KPTR_RESTRICT_MAXVALUE)) {
        LOG(FATAL) << "Unable to set adequate kptr_restrict value!";
        return Error();
    }
    return Success();
}

#define KPTR_RESTRICT_PATH "/proc/sys/kernel/kptr_restrict"
#define KPTR_RESTRICT_MINVALUE 2
#define KPTR_RESTRICT_MAXVALUE 4

system\core\init\Security.cpp

 

android平台上,Android会将如下结点设置为2:

/proc/sys/kernel/kptr_restrict

 

posted @ 2021-10-02 19:40  aspirs  阅读(164)  评论(0编辑  收藏  举报