diff options
author | Nick Kralevich <nnk@google.com> | 2012-10-05 11:17:21 -0700 |
---|---|---|
committer | The Android Automerger <android-build@android.com> | 2012-10-05 15:16:57 -0700 |
commit | 33978c428310d4ecbf8cb45cabb3c906e800b3e9 (patch) | |
tree | ccbb65a6c843941197a6161b979a61923c7431cb | |
parent | 6fe9240d8c5ecc65ae06426e174cba17d3b9918d (diff) | |
download | core-33978c428310d4ecbf8cb45cabb3c906e800b3e9.tar.gz |
init: Set ADDR_COMPAT_LAYOUT before spawning processes.
Some Android programs have problems with memory which grows
from the top down. Temporarily set ADDR_COMPAT_LAYOUT to
avoid breaking those programs.
Bug: 7188322
Change-Id: I61760500e670b4563838c63b82d4a0b6e354a86e
-rwxr-xr-x | init/init.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/init/init.c b/init/init.c index 6127fd38e..1c80d9cc4 100755 --- a/init/init.c +++ b/init/init.c @@ -31,6 +31,7 @@ #include <sys/types.h> #include <sys/socket.h> #include <sys/un.h> +#include <sys/personality.h> #ifdef HAVE_SELINUX #include <selinux/selinux.h> @@ -242,6 +243,21 @@ void service_start(struct service *svc, const char *dynamic_args) int fd, sz; umask(077); +#ifdef __arm__ + /* + * b/7188322 - Temporarily revert to the compat memory layout + * to avoid breaking third party apps. + * + * THIS WILL GO AWAY IN A FUTURE ANDROID RELEASE. + * + * http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=7dbaa466 + * changes the kernel mapping from bottom up to top-down. + * This breaks some programs which improperly embed + * an out of date copy of Android's linker. + */ + int current = personality(0xffffFFFF); + personality(current | ADDR_COMPAT_LAYOUT); +#endif if (properties_inited()) { get_property_workspace(&fd, &sz); sprintf(tmp, "%d,%d", dup(fd), sz); |