summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2015-01-07 22:12:26 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-01-07 22:12:26 +0000
commitee7ed02077f1acd5d27575177f4edf2c6939c2e4 (patch)
tree3a5bfe6ac379f8ddd700d4c7c566c2d2776990a9 /cmds
parent106547c1e33453b7e20b7b387087092d36aa6a72 (diff)
parent96e4409e8c38b1d79285eca9886d44ff850b5748 (diff)
downloadframeworks_native-ee7ed02077f1acd5d27575177f4edf2c6939c2e4.zip
frameworks_native-ee7ed02077f1acd5d27575177f4edf2c6939c2e4.tar.gz
frameworks_native-ee7ed02077f1acd5d27575177f4edf2c6939c2e4.tar.bz2
am 96e4409e: Merge "Installd: Disallow relocation for decryption"
* commit '96e4409e8c38b1d79285eca9886d44ff850b5748': Installd: Disallow relocation for decryption
Diffstat (limited to 'cmds')
-rw-r--r--cmds/installd/commands.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c
index 3fc9f21..42422e7 100644
--- a/cmds/installd/commands.c
+++ b/cmds/installd/commands.c
@@ -641,7 +641,7 @@ static int split_count(const char *str)
return count;
}
-static int split(char *buf, char **argv)
+static int split(char *buf, const char **argv)
{
char *ctx;
int count = 0;
@@ -733,6 +733,9 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
bool have_dex2oat_isa_variant = property_get(dex2oat_isa_variant_key,
dex2oat_isa_variant, NULL) > 0;
+ const char *dex2oat_norelocation = "-Xnorelocate";
+ bool have_dex2oat_relocation_skip_flag = false;
+
char dex2oat_flags[PROPERTY_VALUE_MAX];
int dex2oat_flags_count = property_get("dalvik.vm.dex2oat-flags",
dex2oat_flags, NULL) <= 0 ? 0 : split_count(dex2oat_flags);
@@ -805,6 +808,7 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
if (skip_compilation) {
strcpy(dex2oat_compiler_filter_arg, "--compiler-filter=verify-none");
have_dex2oat_compiler_filter_flag = true;
+ have_dex2oat_relocation_skip_flag = true;
} else if (vm_safe_mode) {
strcpy(dex2oat_compiler_filter_arg, "--compiler-filter=interpret-only");
have_dex2oat_compiler_filter_flag = true;
@@ -814,18 +818,19 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
ALOGV("Running %s in=%s out=%s\n", DEX2OAT_BIN, input_file_name, output_file_name);
- char* argv[7 // program name, mandatory arguments and the final NULL
- + (have_dex2oat_isa_variant ? 1 : 0)
- + (have_dex2oat_isa_features ? 1 : 0)
- + (have_profile_file ? 1 : 0)
- + (have_top_k_profile_threshold ? 1 : 0)
- + (have_dex2oat_Xms_flag ? 2 : 0)
- + (have_dex2oat_Xmx_flag ? 2 : 0)
- + (have_dex2oat_compiler_filter_flag ? 1 : 0)
- + (have_dex2oat_swap_fd ? 1 : 0)
- + dex2oat_flags_count];
+ const char* argv[7 // program name, mandatory arguments and the final NULL
+ + (have_dex2oat_isa_variant ? 1 : 0)
+ + (have_dex2oat_isa_features ? 1 : 0)
+ + (have_profile_file ? 1 : 0)
+ + (have_top_k_profile_threshold ? 1 : 0)
+ + (have_dex2oat_Xms_flag ? 2 : 0)
+ + (have_dex2oat_Xmx_flag ? 2 : 0)
+ + (have_dex2oat_compiler_filter_flag ? 1 : 0)
+ + (have_dex2oat_swap_fd ? 1 : 0)
+ + (have_dex2oat_relocation_skip_flag ? 2 : 0)
+ + dex2oat_flags_count];
int i = 0;
- argv[i++] = (char*)DEX2OAT_BIN;
+ argv[i++] = DEX2OAT_BIN;
argv[i++] = zip_fd_arg;
argv[i++] = zip_location_arg;
argv[i++] = oat_fd_arg;
@@ -844,11 +849,11 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
argv[i++] = top_k_profile_threshold_arg;
}
if (have_dex2oat_Xms_flag) {
- argv[i++] = (char*)RUNTIME_ARG;
+ argv[i++] = RUNTIME_ARG;
argv[i++] = dex2oat_Xms_arg;
}
if (have_dex2oat_Xmx_flag) {
- argv[i++] = (char*)RUNTIME_ARG;
+ argv[i++] = RUNTIME_ARG;
argv[i++] = dex2oat_Xmx_arg;
}
if (have_dex2oat_compiler_filter_flag) {
@@ -860,10 +865,14 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
if (dex2oat_flags_count) {
i += split(dex2oat_flags, argv + i);
}
+ if (have_dex2oat_relocation_skip_flag) {
+ argv[i++] = RUNTIME_ARG;
+ argv[i++] = dex2oat_norelocation;
+ }
// Do not add after dex2oat_flags, they should override others for debugging.
argv[i] = NULL;
- execv(DEX2OAT_BIN, (char* const *)argv);
+ execv(DEX2OAT_BIN, (char * const *)argv);
ALOGE("execv(%s) failed: %s\n", DEX2OAT_BIN, strerror(errno));
}