Remove whitelist
This commit is contained in:
parent
91c49dd6d0
commit
1fc683ef3e
|
|
@ -7,15 +7,9 @@
|
|||
namespace art {
|
||||
|
||||
class Runtime : public lspd::HookedObject {
|
||||
|
||||
private:
|
||||
inline static Runtime *instance_;
|
||||
|
||||
CREATE_MEM_FUNC_SYMBOL_ENTRY(void, DeoptimizeBootImage, void *thiz) {
|
||||
if (LIKELY(DeoptimizeBootImageSym))
|
||||
DeoptimizeBootImageSym(thiz);
|
||||
}
|
||||
|
||||
public:
|
||||
Runtime(void *thiz) : HookedObject(thiz) {}
|
||||
|
||||
|
|
@ -25,8 +19,6 @@ namespace art {
|
|||
|
||||
// @ApiSensitive(Level.LOW)
|
||||
static void Setup(void *handle, HookFunType hook_func) {
|
||||
RETRIEVE_MEM_FUNC_SYMBOL(DeoptimizeBootImage,
|
||||
"_ZN3art7Runtime19DeoptimizeBootImageEv");
|
||||
RETRIEVE_FIELD_SYMBOL(instance, "_ZN3art7Runtime9instance_E");
|
||||
void * thiz = *reinterpret_cast<void**>(instance);
|
||||
LOGD("_ZN3art7Runtime9instance_E = %p", thiz);
|
||||
|
|
|
|||
|
|
@ -134,16 +134,6 @@ namespace lspd {
|
|||
return {};
|
||||
}
|
||||
|
||||
bool ConfigManager::IsAppNeedHook(const std::string &package_name) const {
|
||||
if (IsInstaller(package_name)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
auto res = white_list_.count(package_name);
|
||||
LOGD("should hook %s -> %s", package_name.c_str(), BoolToString(res));
|
||||
return res;
|
||||
}
|
||||
|
||||
ConfigManager::ConfigManager(uid_t user, bool initialized) :
|
||||
user_(user),
|
||||
data_path_prefix_(fs::path("/data/user_de") /
|
||||
|
|
@ -153,7 +143,6 @@ namespace lspd {
|
|||
installer_pkg_name_(RetrieveInstallerPkgName()),
|
||||
no_module_log_enabled_(path_exists(GetConfigPath("disable_modules_log"))),
|
||||
resources_hook_enabled_(path_exists(GetConfigPath("enable_resources"))),
|
||||
white_list_(GetAppList(GetConfigPath("whitelist/"))),
|
||||
modules_list_(GetModuleList()),
|
||||
last_write_time_(GetLastWriteTime()),
|
||||
variant_(GetVariant(GetMiscPath() / "variant")) {
|
||||
|
|
@ -162,12 +151,6 @@ namespace lspd {
|
|||
LOGI(" using installer package name: %s", installer_pkg_name_.c_str());
|
||||
LOGI(" no module log: %s", BoolToString(no_module_log_enabled_));
|
||||
LOGI(" resources hook: %s", BoolToString(resources_hook_enabled_));
|
||||
LOGI(" white list: \n %s", ([this]() {
|
||||
std::ostringstream join;
|
||||
std::copy(white_list_.begin(), white_list_.end(),
|
||||
std::ostream_iterator<std::string>(join, "\n"));
|
||||
return join.str();
|
||||
})().c_str());
|
||||
LOGI(" module list: \n %s", ([this]() {
|
||||
std::ostringstream join;
|
||||
std::vector<std::string> module_list;
|
||||
|
|
|
|||
|
|
@ -79,8 +79,6 @@ namespace lspd {
|
|||
|
||||
std::vector<std::string> GetAppModuleList(const std::string &pkg_name) const;
|
||||
|
||||
bool IsAppNeedHook(const std::string &pkg_name) const;
|
||||
|
||||
bool NeedUpdateConfig() const {
|
||||
return last_write_time_ < GetLastWriteTime();
|
||||
}
|
||||
|
|
@ -108,8 +106,6 @@ namespace lspd {
|
|||
const std::filesystem::path installer_pkg_name_;
|
||||
const bool no_module_log_enabled_ = false;
|
||||
const bool resources_hook_enabled_ = false;
|
||||
// snapshot at boot
|
||||
const std::unordered_set<std::string> white_list_;
|
||||
|
||||
const std::unordered_map<std::string, std::pair<std::string, std::unordered_set<std::string>>> modules_list_;
|
||||
|
||||
|
|
|
|||
|
|
@ -191,12 +191,15 @@ namespace lspd {
|
|||
}
|
||||
|
||||
void
|
||||
Context::OnNativeForkSystemServerPre(JNIEnv *env, [[maybe_unused]] jclass clazz, uid_t uid,
|
||||
gid_t gid,
|
||||
jintArray gids,
|
||||
jint runtime_flags, jobjectArray rlimits,
|
||||
jlong permitted_capabilities,
|
||||
jlong effective_capabilities) {
|
||||
Context::OnNativeForkSystemServerPre([[maybe_unused]] JNIEnv *env,
|
||||
[[maybe_unused]] jclass clazz,
|
||||
[[maybe_unused]] uid_t uid,
|
||||
[[maybe_unused]] gid_t gid,
|
||||
[[maybe_unused]] jintArray gids,
|
||||
[[maybe_unused]] jint runtime_flags,
|
||||
[[maybe_unused]] jobjectArray rlimits,
|
||||
[[maybe_unused]] jlong permitted_capabilities,
|
||||
[[maybe_unused]] jlong effective_capabilities) {
|
||||
ConfigManager::SetCurrentUser(0u);
|
||||
app_modules_list_ = ConfigManager::GetInstance()->GetAppModuleList(
|
||||
"android"); // I don't think we need this, but anyway
|
||||
|
|
@ -204,10 +207,6 @@ namespace lspd {
|
|||
if (!ConfigManager::GetInstance()->IsInitialized()) {
|
||||
LOGE("skip injecting into android because configurations are not loaded properly");
|
||||
}
|
||||
if (!skip_ && !ConfigManager::GetInstance()->IsAppNeedHook("android")) {
|
||||
skip_ = true;
|
||||
LOGD("skip injecting into android because it's whitelisted/blacklisted");
|
||||
}
|
||||
if (!skip_ && app_modules_list_.empty()) {
|
||||
skip_ = true;
|
||||
LOGD("skip injecting into android because no module hooks it");
|
||||
|
|
@ -361,12 +360,6 @@ namespace lspd {
|
|||
LOGI("skip injecting into %s because it's isolated", package_name.c_str());
|
||||
}
|
||||
|
||||
if (!skip && !ConfigManager::GetInstance()->IsAppNeedHook(package_name)) {
|
||||
skip = true;
|
||||
LOGD("skip injecting xposed into %s because it's whitelisted/blacklisted",
|
||||
package_name.c_str());
|
||||
}
|
||||
|
||||
if (!skip && empty_list() && !ConfigManager::GetInstance()->IsInstaller(package_name)) {
|
||||
skip = true;
|
||||
LOGD("skip injecting xposed into %s because no module hooks it",
|
||||
|
|
|
|||
Loading…
Reference in New Issue