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