summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2014-09-10 16:48:46 -0700
committerJeff Brown <jeffbrown@google.com>2014-09-11 14:19:52 -0700
commit00c0cd4a24bd0f040055f9e786e2df1fa3b7d2d3 (patch)
tree87654f391f5e9dca11fd5e84901545890d3d5b16 /core
parent98ff7bce66f03da14e39fa7e532a7202bde7dce6 (diff)
downloadframeworks_base-00c0cd4a24bd0f040055f9e786e2df1fa3b7d2d3.zip
frameworks_base-00c0cd4a24bd0f040055f9e786e2df1fa3b7d2d3.tar.gz
frameworks_base-00c0cd4a24bd0f040055f9e786e2df1fa3b7d2d3.tar.bz2
Clean entire arg block when setting process name.
When Android processes fork from Zygote, we rewrite the command line with a new name, eg. "system_server". When we do this, we should fill the entire block with zeros to remove corrupted argument information that may otherwise remain in the /proc/<pid>/cmdline buffer and be seen in tools and stack dumps. Fixed an issue where VM options could be overwritten after setting the nice name if the name was too long. Bug: 17474152 Change-Id: Ie6cf9ed7752a04300a340e26cd6812bb35c59e1b
Diffstat (limited to 'core')
-rw-r--r--core/jni/AndroidRuntime.cpp23
1 files changed, 1 insertions, 22 deletions
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index a63258c..1573106 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -271,6 +271,7 @@ AndroidRuntime::~AndroidRuntime()
}
void AndroidRuntime::setArgv0(const char* argv0) {
+ memset(mArgBlockStart, 0, mArgBlockLength);
strlcpy(mArgBlockStart, argv0, mArgBlockLength);
}
@@ -345,28 +346,6 @@ static bool runtime_isSensitiveThread() {
return state && state->getStrictModePolicy() != 0;
}
-
-/**
- * Add VM arguments to the to-be-executed VM
- * Stops at first non '-' argument (also stops at an argument of '--')
- * Returns the number of args consumed
- */
-int AndroidRuntime::addVmArguments(int argc, const char* const argv[])
-{
- int i;
-
- for (i = 0; i<argc; i++) {
- if (argv[i][0] != '-') {
- return i;
- }
- if (argv[i][1] == '-' && argv[i][2] == 0) {
- return i+1;
- }
- addOption(argv[i]);
- }
- return i;
-}
-
static int hasDir(const char* dir)
{
struct stat s;