kernel: fix debug set manager
This commit is contained in:
@@ -251,14 +251,18 @@ static __always_inline bool check_v2_signature(char *path,
|
|||||||
// http://aospxref.com/android-14.0.0_r2/xref/frameworks/base/core/java/android/util/apk/ApkSignatureSchemeV3Verifier.java#74
|
// http://aospxref.com/android-14.0.0_r2/xref/frameworks/base/core/java/android/util/apk/ApkSignatureSchemeV3Verifier.java#74
|
||||||
v3_1_signing_exist = true;
|
v3_1_signing_exist = true;
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef CONFIG_KSU_DEBUG
|
||||||
pr_info("Unknown id: 0x%08x\n", id);
|
pr_info("Unknown id: 0x%08x\n", id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
pos += (size8 - offset);
|
pos += (size8 - offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (v2_signing_blocks != 1) {
|
if (v2_signing_blocks != 1) {
|
||||||
|
#ifdef CONFIG_KSU_DEBUG
|
||||||
pr_err("Unexpected v2 signature count: %d\n",
|
pr_err("Unexpected v2 signature count: %d\n",
|
||||||
v2_signing_blocks);
|
v2_signing_blocks);
|
||||||
|
#endif
|
||||||
v2_signing_valid = false;
|
v2_signing_valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,7 +278,9 @@ clean:
|
|||||||
filp_close(fp, 0);
|
filp_close(fp, 0);
|
||||||
|
|
||||||
if (v3_signing_exist || v3_1_signing_exist) {
|
if (v3_signing_exist || v3_1_signing_exist) {
|
||||||
|
#ifdef CONFIG_KSU_DEBUG
|
||||||
pr_err("Unexpected v3 signature scheme found!\n");
|
pr_err("Unexpected v3 signature scheme found!\n");
|
||||||
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -283,25 +289,15 @@ clean:
|
|||||||
|
|
||||||
#ifdef CONFIG_KSU_DEBUG
|
#ifdef CONFIG_KSU_DEBUG
|
||||||
|
|
||||||
unsigned ksu_expected_size = EXPECTED_SIZE;
|
int ksu_debug_manager_uid = -1;
|
||||||
const char *ksu_expected_hash = EXPECTED_HASH;
|
|
||||||
|
|
||||||
#include "manager.h"
|
#include "manager.h"
|
||||||
|
|
||||||
static int set_expected_size(const char *val, const struct kernel_param *kp)
|
static int set_expected_size(const char *val, const struct kernel_param *kp)
|
||||||
{
|
{
|
||||||
int rv = param_set_uint(val, kp);
|
int rv = param_set_uint(val, kp);
|
||||||
ksu_invalidate_manager_uid();
|
ksu_set_manager_uid(ksu_debug_manager_uid);
|
||||||
pr_info("ksu_expected_size set to %x\n", ksu_expected_size);
|
pr_info("ksu_manager_uid set to %d\n", ksu_debug_manager_uid);
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int set_expected_hash(const char *val, const struct kernel_param *kp)
|
|
||||||
{
|
|
||||||
pr_info("set_expected_hash: %s\n", val);
|
|
||||||
int rv = param_set_charp(val, kp);
|
|
||||||
ksu_invalidate_manager_uid();
|
|
||||||
pr_info("ksu_expected_hash set to %s\n", ksu_expected_hash);
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,27 +306,12 @@ static struct kernel_param_ops expected_size_ops = {
|
|||||||
.get = param_get_uint,
|
.get = param_get_uint,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct kernel_param_ops expected_hash_ops = {
|
module_param_cb(ksu_debug_manager_uid, &expected_size_ops, &ksu_debug_manager_uid,
|
||||||
.set = set_expected_hash,
|
|
||||||
.get = param_get_charp,
|
|
||||||
.free = param_free_charp,
|
|
||||||
};
|
|
||||||
|
|
||||||
module_param_cb(ksu_expected_size, &expected_size_ops, &ksu_expected_size,
|
|
||||||
S_IRUSR | S_IWUSR);
|
|
||||||
module_param_cb(ksu_expected_hash, &expected_hash_ops, &ksu_expected_hash,
|
|
||||||
S_IRUSR | S_IWUSR);
|
S_IRUSR | S_IWUSR);
|
||||||
|
|
||||||
bool is_manager_apk(char *path)
|
#endif
|
||||||
{
|
|
||||||
return check_v2_signature(path, ksu_expected_size, ksu_expected_hash);
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
bool is_manager_apk(char *path)
|
bool is_manager_apk(char *path)
|
||||||
{
|
{
|
||||||
return check_v2_signature(path, EXPECTED_SIZE, EXPECTED_HASH);
|
return check_v2_signature(path, EXPECTED_SIZE, EXPECTED_HASH);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
Reference in New Issue
Block a user