Add vm_safe_mode to dexopt.
The flag enforces interpret-only flag for dex2oat. Bug: 12457423 (cherry picked from commitb1efac1035
) (cherry picked from commit97477d203e
) Change-Id: I215339527e998b24e274c8df42a5024839e6a9fa
This commit is contained in:
parent
c70626a1ef
commit
4f60ac2bbc
@ -663,7 +663,8 @@ static void run_patchoat(int input_fd, int oat_fd, const char* input_file_name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
|
static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
|
||||||
const char* output_file_name, const char *pkgname, const char *instruction_set)
|
const char* output_file_name, const char *pkgname, const char *instruction_set,
|
||||||
|
bool vm_safe_mode)
|
||||||
{
|
{
|
||||||
static const unsigned int MAX_INSTRUCTION_SET_LEN = 7;
|
static const unsigned int MAX_INSTRUCTION_SET_LEN = 7;
|
||||||
|
|
||||||
@ -755,6 +756,9 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
|
|||||||
if (skip_compilation) {
|
if (skip_compilation) {
|
||||||
strcpy(dex2oat_compiler_filter_arg, "--compiler-filter=verify-none");
|
strcpy(dex2oat_compiler_filter_arg, "--compiler-filter=verify-none");
|
||||||
have_dex2oat_compiler_filter_flag = true;
|
have_dex2oat_compiler_filter_flag = true;
|
||||||
|
} else if (vm_safe_mode) {
|
||||||
|
strcpy(dex2oat_compiler_filter_arg, "--compiler-filter=interpret-only");
|
||||||
|
have_dex2oat_compiler_filter_flag = true;
|
||||||
} else if (have_dex2oat_compiler_filter_flag) {
|
} else if (have_dex2oat_compiler_filter_flag) {
|
||||||
sprintf(dex2oat_compiler_filter_arg, "--compiler-filter=%s", dex2oat_compiler_filter_flag);
|
sprintf(dex2oat_compiler_filter_arg, "--compiler-filter=%s", dex2oat_compiler_filter_flag);
|
||||||
}
|
}
|
||||||
@ -832,9 +836,9 @@ static int wait_child(pid_t pid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int dexopt(const char *apk_path, uid_t uid, int is_public,
|
int dexopt(const char *apk_path, uid_t uid, bool is_public,
|
||||||
const char *pkgname, const char *instruction_set,
|
const char *pkgname, const char *instruction_set,
|
||||||
int is_patchoat)
|
bool vm_safe_mode, bool is_patchoat)
|
||||||
{
|
{
|
||||||
struct utimbuf ut;
|
struct utimbuf ut;
|
||||||
struct stat input_stat, dex_stat;
|
struct stat input_stat, dex_stat;
|
||||||
@ -968,7 +972,8 @@ int dexopt(const char *apk_path, uid_t uid, int is_public,
|
|||||||
if (is_patchoat) {
|
if (is_patchoat) {
|
||||||
run_patchoat(input_fd, out_fd, input_file, out_path, pkgname, instruction_set);
|
run_patchoat(input_fd, out_fd, input_file, out_path, pkgname, instruction_set);
|
||||||
} else {
|
} else {
|
||||||
run_dex2oat(input_fd, out_fd, input_file, out_path, pkgname, instruction_set);
|
run_dex2oat(input_fd, out_fd, input_file, out_path, pkgname, instruction_set,
|
||||||
|
vm_safe_mode);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
exit(69); /* Unexpected persist.sys.dalvik.vm.lib value */
|
exit(69); /* Unexpected persist.sys.dalvik.vm.lib value */
|
||||||
|
@ -38,8 +38,8 @@ static int do_install(char **arg, char reply[REPLY_MAX])
|
|||||||
|
|
||||||
static int do_dexopt(char **arg, char reply[REPLY_MAX])
|
static int do_dexopt(char **arg, char reply[REPLY_MAX])
|
||||||
{
|
{
|
||||||
/* apk_path, uid, is_public, pkgname, instruction_set */
|
/* apk_path, uid, is_public, pkgname, instruction_set, vm_safe_mode, should_relocate */
|
||||||
return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], 0);
|
return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], atoi(arg[5]), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int do_move_dex(char **arg, char reply[REPLY_MAX])
|
static int do_move_dex(char **arg, char reply[REPLY_MAX])
|
||||||
@ -147,7 +147,8 @@ static int do_prune_dex_cache(char **arg __attribute__((unused)),
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int do_patchoat(char **arg, char reply[REPLY_MAX]) {
|
static int do_patchoat(char **arg, char reply[REPLY_MAX]) {
|
||||||
return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], 1);
|
/* apk_path, uid, is_public, pkgname, instruction_set, vm_safe_mode, should_relocate */
|
||||||
|
return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct cmdinfo {
|
struct cmdinfo {
|
||||||
@ -159,7 +160,7 @@ struct cmdinfo {
|
|||||||
struct cmdinfo cmds[] = {
|
struct cmdinfo cmds[] = {
|
||||||
{ "ping", 0, do_ping },
|
{ "ping", 0, do_ping },
|
||||||
{ "install", 4, do_install },
|
{ "install", 4, do_install },
|
||||||
{ "dexopt", 5, do_dexopt },
|
{ "dexopt", 6, do_dexopt },
|
||||||
{ "movedex", 3, do_move_dex },
|
{ "movedex", 3, do_move_dex },
|
||||||
{ "rmdex", 2, do_rm_dex },
|
{ "rmdex", 2, do_rm_dex },
|
||||||
{ "remove", 2, do_remove },
|
{ "remove", 2, do_remove },
|
||||||
|
@ -214,8 +214,8 @@ int get_size(const char *pkgname, userid_t userid, const char *apkpath, const ch
|
|||||||
const char *fwdlock_apkpath, const char *asecpath, const char *instruction_set,
|
const char *fwdlock_apkpath, const char *asecpath, const char *instruction_set,
|
||||||
int64_t *codesize, int64_t *datasize, int64_t *cachesize, int64_t *asecsize);
|
int64_t *codesize, int64_t *datasize, int64_t *cachesize, int64_t *asecsize);
|
||||||
int free_cache(int64_t free_size);
|
int free_cache(int64_t free_size);
|
||||||
int dexopt(const char *apk_path, uid_t uid, int is_public, const char *pkgName,
|
int dexopt(const char *apk_path, uid_t uid, bool is_public, const char *pkgName,
|
||||||
const char *instruction_set, int should_relocate);
|
const char *instruction_set, bool vm_safe_mode, bool should_relocate);
|
||||||
int movefiles();
|
int movefiles();
|
||||||
int linklib(const char* target, const char* source, int userId);
|
int linklib(const char* target, const char* source, int userId);
|
||||||
int idmap(const char *target_path, const char *overlay_path, uid_t uid);
|
int idmap(const char *target_path, const char *overlay_path, uid_t uid);
|
||||||
|
Loading…
Reference in New Issue
Block a user