blob: 1f7acecb927cf6cfc60a1e5471bdf84281d079b5 [file] [log] [blame]
Narayan Kamath973b4662014-03-31 13:41:26 +01001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Colin Cross18cd9f52014-06-13 12:58:55 -070017#define LOG_TAG "Zygote"
Narayan Kamath973b4662014-03-31 13:41:26 +010018
19// sys/mount.h has to come before linux/fs.h due to redefinition of MS_RDONLY, MS_BIND, etc
20#include <sys/mount.h>
21#include <linux/fs.h>
22
23#include <grp.h>
Colin Cross18cd9f52014-06-13 12:58:55 -070024#include <fcntl.h>
Narayan Kamath973b4662014-03-31 13:41:26 +010025#include <paths.h>
26#include <signal.h>
27#include <stdlib.h>
Narayan Kamath973b4662014-03-31 13:41:26 +010028#include <unistd.h>
Colin Cross18cd9f52014-06-13 12:58:55 -070029#include <sys/capability.h>
30#include <sys/personality.h>
31#include <sys/prctl.h>
32#include <sys/resource.h>
33#include <sys/stat.h>
34#include <sys/types.h>
35#include <sys/utsname.h>
36#include <sys/wait.h>
Narayan Kamath973b4662014-03-31 13:41:26 +010037
Colin Cross18cd9f52014-06-13 12:58:55 -070038
39#include <cutils/fs.h>
40#include <cutils/multiuser.h>
41#include <cutils/sched_policy.h>
Sharvil Nanavati4990e4f2014-06-29 17:06:52 -070042#include <private/android_filesystem_config.h>
Colin Cross18cd9f52014-06-13 12:58:55 -070043#include <utils/String8.h>
44#include <selinux/android.h>
Colin Cross0161bbc2014-06-03 13:26:58 -070045#include <processgroup/processgroup.h>
Colin Cross18cd9f52014-06-13 12:58:55 -070046
47#include "android_runtime/AndroidRuntime.h"
Narayan Kamath973b4662014-03-31 13:41:26 +010048#include "JNIHelp.h"
49#include "ScopedLocalRef.h"
50#include "ScopedPrimitiveArray.h"
51#include "ScopedUtfChars.h"
52
Narayan Kamath973b4662014-03-31 13:41:26 +010053namespace {
54
55using android::String8;
56
57static pid_t gSystemServerPid = 0;
58
59static const char kZygoteClassName[] = "com/android/internal/os/Zygote";
60static jclass gZygoteClass;
61static jmethodID gCallPostForkChildHooks;
62
63// Must match values in com.android.internal.os.Zygote.
64enum MountExternalKind {
65 MOUNT_EXTERNAL_NONE = 0,
66 MOUNT_EXTERNAL_SINGLEUSER = 1,
67 MOUNT_EXTERNAL_MULTIUSER = 2,
68 MOUNT_EXTERNAL_MULTIUSER_ALL = 3,
69};
70
71static void RuntimeAbort(JNIEnv* env) {
72 env->FatalError("RuntimeAbort");
73}
74
75// This signal handler is for zygote mode, since the zygote must reap its children
76static void SigChldHandler(int /*signal_number*/) {
77 pid_t pid;
78 int status;
79
80 while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
81 // Log process-death status that we care about. In general it is
82 // not safe to call LOG(...) from a signal handler because of
83 // possible reentrancy. However, we know a priori that the
84 // current implementation of LOG() is safe to call from a SIGCHLD
85 // handler in the zygote process. If the LOG() implementation
86 // changes its locking strategy or its use of syscalls within the
87 // lazy-init critical section, its use here may become unsafe.
88 if (WIFEXITED(status)) {
89 if (WEXITSTATUS(status)) {
90 ALOGI("Process %d exited cleanly (%d)", pid, WEXITSTATUS(status));
Narayan Kamath973b4662014-03-31 13:41:26 +010091 }
92 } else if (WIFSIGNALED(status)) {
93 if (WTERMSIG(status) != SIGKILL) {
Narayan Kamath160992d2014-04-14 14:46:07 +010094 ALOGI("Process %d exited due to signal (%d)", pid, WTERMSIG(status));
Narayan Kamath973b4662014-03-31 13:41:26 +010095 }
Narayan Kamath973b4662014-03-31 13:41:26 +010096 if (WCOREDUMP(status)) {
97 ALOGI("Process %d dumped core.", pid);
98 }
Narayan Kamath973b4662014-03-31 13:41:26 +010099 }
100
101 // If the just-crashed process is the system_server, bring down zygote
102 // so that it is restarted by init and system server will be restarted
103 // from there.
104 if (pid == gSystemServerPid) {
105 ALOGE("Exit zygote because system server (%d) has terminated");
106 kill(getpid(), SIGKILL);
107 }
108 }
109
Narayan Kamath160992d2014-04-14 14:46:07 +0100110 // Note that we shouldn't consider ECHILD an error because
111 // the secondary zygote might have no children left to wait for.
112 if (pid < 0 && errno != ECHILD) {
113 ALOGW("Zygote SIGCHLD error in waitpid: %s", strerror(errno));
Narayan Kamath973b4662014-03-31 13:41:26 +0100114 }
115}
116
117// Configures the SIGCHLD handler for the zygote process. This is configured
118// very late, because earlier in the runtime we may fork() and exec()
119// other processes, and we want to waitpid() for those rather than
120// have them be harvested immediately.
121//
122// This ends up being called repeatedly before each fork(), but there's
123// no real harm in that.
124static void SetSigChldHandler() {
125 struct sigaction sa;
126 memset(&sa, 0, sizeof(sa));
127 sa.sa_handler = SigChldHandler;
128
129 int err = sigaction(SIGCHLD, &sa, NULL);
130 if (err < 0) {
131 ALOGW("Error setting SIGCHLD handler: %d", errno);
132 }
133}
134
135// Sets the SIGCHLD handler back to default behavior in zygote children.
136static void UnsetSigChldHandler() {
137 struct sigaction sa;
138 memset(&sa, 0, sizeof(sa));
139 sa.sa_handler = SIG_DFL;
140
141 int err = sigaction(SIGCHLD, &sa, NULL);
142 if (err < 0) {
143 ALOGW("Error unsetting SIGCHLD handler: %d", errno);
144 }
145}
146
147// Calls POSIX setgroups() using the int[] object as an argument.
148// A NULL argument is tolerated.
149static void SetGids(JNIEnv* env, jintArray javaGids) {
150 if (javaGids == NULL) {
151 return;
152 }
153
154 ScopedIntArrayRO gids(env, javaGids);
155 if (gids.get() == NULL) {
156 RuntimeAbort(env);
157 }
158 int rc = setgroups(gids.size(), reinterpret_cast<const gid_t*>(&gids[0]));
159 if (rc == -1) {
160 ALOGE("setgroups failed");
161 RuntimeAbort(env);
162 }
163}
164
165// Sets the resource limits via setrlimit(2) for the values in the
166// two-dimensional array of integers that's passed in. The second dimension
167// contains a tuple of length 3: (resource, rlim_cur, rlim_max). NULL is
168// treated as an empty array.
169static void SetRLimits(JNIEnv* env, jobjectArray javaRlimits) {
170 if (javaRlimits == NULL) {
171 return;
172 }
173
174 rlimit rlim;
175 memset(&rlim, 0, sizeof(rlim));
176
177 for (int i = 0; i < env->GetArrayLength(javaRlimits); ++i) {
178 ScopedLocalRef<jobject> javaRlimitObject(env, env->GetObjectArrayElement(javaRlimits, i));
179 ScopedIntArrayRO javaRlimit(env, reinterpret_cast<jintArray>(javaRlimitObject.get()));
180 if (javaRlimit.size() != 3) {
181 ALOGE("rlimits array must have a second dimension of size 3");
182 RuntimeAbort(env);
183 }
184
185 rlim.rlim_cur = javaRlimit[1];
186 rlim.rlim_max = javaRlimit[2];
187
188 int rc = setrlimit(javaRlimit[0], &rlim);
189 if (rc == -1) {
190 ALOGE("setrlimit(%d, {%d, %d}) failed", javaRlimit[0], rlim.rlim_cur, rlim.rlim_max);
191 RuntimeAbort(env);
192 }
193 }
194}
195
Narayan Kamath973b4662014-03-31 13:41:26 +0100196// The debug malloc library needs to know whether it's the zygote or a child.
197extern "C" int gMallocLeakZygoteChild;
198
199static void EnableKeepCapabilities(JNIEnv* env) {
200 int rc = prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);
201 if (rc == -1) {
202 ALOGE("prctl(PR_SET_KEEPCAPS) failed");
203 RuntimeAbort(env);
204 }
205}
206
207static void DropCapabilitiesBoundingSet(JNIEnv* env) {
208 for (int i = 0; prctl(PR_CAPBSET_READ, i, 0, 0, 0) >= 0; i++) {
209 int rc = prctl(PR_CAPBSET_DROP, i, 0, 0, 0);
210 if (rc == -1) {
211 if (errno == EINVAL) {
212 ALOGE("prctl(PR_CAPBSET_DROP) failed with EINVAL. Please verify "
213 "your kernel is compiled with file capabilities support");
214 } else {
215 ALOGE("prctl(PR_CAPBSET_DROP) failed");
216 RuntimeAbort(env);
217 }
218 }
219 }
220}
221
222static void SetCapabilities(JNIEnv* env, int64_t permitted, int64_t effective) {
223 __user_cap_header_struct capheader;
224 memset(&capheader, 0, sizeof(capheader));
225 capheader.version = _LINUX_CAPABILITY_VERSION_3;
226 capheader.pid = 0;
227
228 __user_cap_data_struct capdata[2];
229 memset(&capdata, 0, sizeof(capdata));
230 capdata[0].effective = effective;
231 capdata[1].effective = effective >> 32;
232 capdata[0].permitted = permitted;
233 capdata[1].permitted = permitted >> 32;
234
235 if (capset(&capheader, &capdata[0]) == -1) {
236 ALOGE("capset(%lld, %lld) failed", permitted, effective);
237 RuntimeAbort(env);
238 }
239}
240
241static void SetSchedulerPolicy(JNIEnv* env) {
242 errno = -set_sched_policy(0, SP_DEFAULT);
243 if (errno != 0) {
244 ALOGE("set_sched_policy(0, SP_DEFAULT) failed");
245 RuntimeAbort(env);
246 }
247}
248
Narayan Kamath973b4662014-03-31 13:41:26 +0100249// Create a private mount namespace and bind mount appropriate emulated
250// storage for the given user.
251static bool MountEmulatedStorage(uid_t uid, jint mount_mode) {
252 if (mount_mode == MOUNT_EXTERNAL_NONE) {
253 return true;
254 }
255
256 // See storage config details at http://source.android.com/tech/storage/
257 userid_t user_id = multiuser_get_user_id(uid);
258
259 // Create a second private mount namespace for our process
260 if (unshare(CLONE_NEWNS) == -1) {
261 ALOGW("Failed to unshare(): %d", errno);
262 return false;
263 }
264
265 // Create bind mounts to expose external storage
266 if (mount_mode == MOUNT_EXTERNAL_MULTIUSER || mount_mode == MOUNT_EXTERNAL_MULTIUSER_ALL) {
267 // These paths must already be created by init.rc
268 const char* source = getenv("EMULATED_STORAGE_SOURCE");
269 const char* target = getenv("EMULATED_STORAGE_TARGET");
270 const char* legacy = getenv("EXTERNAL_STORAGE");
271 if (source == NULL || target == NULL || legacy == NULL) {
272 ALOGW("Storage environment undefined; unable to provide external storage");
273 return false;
274 }
275
276 // Prepare source paths
277
278 // /mnt/shell/emulated/0
279 const String8 source_user(String8::format("%s/%d", source, user_id));
280 // /storage/emulated/0
281 const String8 target_user(String8::format("%s/%d", target, user_id));
282
283 if (fs_prepare_dir(source_user.string(), 0000, 0, 0) == -1
284 || fs_prepare_dir(target_user.string(), 0000, 0, 0) == -1) {
285 return false;
286 }
287
288 if (mount_mode == MOUNT_EXTERNAL_MULTIUSER_ALL) {
289 // Mount entire external storage tree for all users
290 if (TEMP_FAILURE_RETRY(mount(source, target, NULL, MS_BIND, NULL)) == -1) {
291 ALOGW("Failed to mount %s to %s :%d", source, target, errno);
292 return false;
293 }
294 } else {
295 // Only mount user-specific external storage
296 if (TEMP_FAILURE_RETRY(
297 mount(source_user.string(), target_user.string(), NULL, MS_BIND, NULL)) == -1) {
298 ALOGW("Failed to mount %s to %s: %d", source_user.string(), target_user.string(), errno);
299 return false;
300 }
301 }
302
303 if (fs_prepare_dir(legacy, 0000, 0, 0) == -1) {
304 return false;
305 }
306
307 // Finally, mount user-specific path into place for legacy users
308 if (TEMP_FAILURE_RETRY(
309 mount(target_user.string(), legacy, NULL, MS_BIND | MS_REC, NULL)) == -1) {
310 ALOGW("Failed to mount %s to %s: %d", target_user.string(), legacy, errno);
311 return false;
312 }
313 } else {
314 ALOGW("Mount mode %d unsupported", mount_mode);
315 return false;
316 }
317
318 return true;
319}
320
Narayan Kamath973b4662014-03-31 13:41:26 +0100321static bool NeedsNoRandomizeWorkaround() {
322#if !defined(__arm__)
323 return false;
324#else
325 int major;
326 int minor;
327 struct utsname uts;
328 if (uname(&uts) == -1) {
329 return false;
330 }
331
332 if (sscanf(uts.release, "%d.%d", &major, &minor) != 2) {
333 return false;
334 }
335
336 // Kernels before 3.4.* need the workaround.
337 return (major < 3) || ((major == 3) && (minor < 4));
338#endif
339}
Narayan Kamath973b4662014-03-31 13:41:26 +0100340
341// Utility to close down the Zygote socket file descriptors while
342// the child is still running as root with Zygote's privileges. Each
343// descriptor (if any) is closed via dup2(), replacing it with a valid
344// (open) descriptor to /dev/null.
345
346static void DetachDescriptors(JNIEnv* env, jintArray fdsToClose) {
347 if (!fdsToClose) {
348 return;
349 }
350 jsize count = env->GetArrayLength(fdsToClose);
351 jint *ar = env->GetIntArrayElements(fdsToClose, 0);
352 if (!ar) {
353 ALOGE("Bad fd array");
354 RuntimeAbort(env);
355 }
356 jsize i;
357 int devnull;
358 for (i = 0; i < count; i++) {
359 devnull = open("/dev/null", O_RDWR);
360 if (devnull < 0) {
361 ALOGE("Failed to open /dev/null");
362 RuntimeAbort(env);
363 continue;
364 }
365 ALOGV("Switching descriptor %d to /dev/null: %d", ar[i], errno);
366 if (dup2(devnull, ar[i]) < 0) {
367 ALOGE("Failed dup2() on descriptor %d", ar[i]);
368 RuntimeAbort(env);
369 }
370 close(devnull);
371 }
372}
373
374void SetThreadName(const char* thread_name) {
375 bool hasAt = false;
376 bool hasDot = false;
377 const char* s = thread_name;
378 while (*s) {
379 if (*s == '.') {
380 hasDot = true;
381 } else if (*s == '@') {
382 hasAt = true;
383 }
384 s++;
385 }
386 const int len = s - thread_name;
387 if (len < 15 || hasAt || !hasDot) {
388 s = thread_name;
389 } else {
390 s = thread_name + len - 15;
391 }
392 // pthread_setname_np fails rather than truncating long strings.
393 char buf[16]; // MAX_TASK_COMM_LEN=16 is hard-coded into bionic
394 strlcpy(buf, s, sizeof(buf)-1);
395 errno = pthread_setname_np(pthread_self(), buf);
396 if (errno != 0) {
397 ALOGW("Unable to set the name of current thread to '%s'", buf);
398 }
399}
400
401// Utility routine to fork zygote and specialize the child process.
402static pid_t ForkAndSpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArray javaGids,
403 jint debug_flags, jobjectArray javaRlimits,
404 jlong permittedCapabilities, jlong effectiveCapabilities,
405 jint mount_external,
406 jstring java_se_info, jstring java_se_name,
407 bool is_system_server, jintArray fdsToClose) {
408 SetSigChldHandler();
409
410 pid_t pid = fork();
411
412 if (pid == 0) {
413 // The child process.
414 gMallocLeakZygoteChild = 1;
415
416 // Clean up any descriptors which must be closed immediately
417 DetachDescriptors(env, fdsToClose);
418
419 // Keep capabilities across UID change, unless we're staying root.
420 if (uid != 0) {
421 EnableKeepCapabilities(env);
422 }
423
424 DropCapabilitiesBoundingSet(env);
425
426 if (!MountEmulatedStorage(uid, mount_external)) {
427 ALOGW("Failed to mount emulated storage: %d", errno);
428 if (errno == ENOTCONN || errno == EROFS) {
429 // When device is actively encrypting, we get ENOTCONN here
430 // since FUSE was mounted before the framework restarted.
431 // When encrypted device is booting, we get EROFS since
432 // FUSE hasn't been created yet by init.
433 // In either case, continue without external storage.
434 } else {
435 ALOGE("Cannot continue without emulated storage");
436 RuntimeAbort(env);
437 }
438 }
439
Colin Cross0161bbc2014-06-03 13:26:58 -0700440 if (!is_system_server) {
441 int rc = createProcessGroup(uid, getpid());
442 if (rc != 0) {
Colin Cross3089bed2014-07-14 15:07:04 -0700443 if (rc == -EROFS) {
444 ALOGW("createProcessGroup failed, kernel missing CONFIG_CGROUP_CPUACCT?");
445 } else {
446 ALOGE("createProcessGroup(%d, %d) failed: %s", uid, pid, strerror(-rc));
447 }
Colin Cross0161bbc2014-06-03 13:26:58 -0700448 }
449 }
450
Narayan Kamath973b4662014-03-31 13:41:26 +0100451 SetGids(env, javaGids);
452
453 SetRLimits(env, javaRlimits);
454
455 int rc = setresgid(gid, gid, gid);
456 if (rc == -1) {
457 ALOGE("setresgid(%d) failed", gid);
458 RuntimeAbort(env);
459 }
460
461 rc = setresuid(uid, uid, uid);
462 if (rc == -1) {
463 ALOGE("setresuid(%d) failed", uid);
464 RuntimeAbort(env);
465 }
466
Narayan Kamath973b4662014-03-31 13:41:26 +0100467 if (NeedsNoRandomizeWorkaround()) {
468 // Work around ARM kernel ASLR lossage (http://b/5817320).
469 int old_personality = personality(0xffffffff);
470 int new_personality = personality(old_personality | ADDR_NO_RANDOMIZE);
471 if (new_personality == -1) {
472 ALOGW("personality(%d) failed", new_personality);
473 }
474 }
Narayan Kamath973b4662014-03-31 13:41:26 +0100475
476 SetCapabilities(env, permittedCapabilities, effectiveCapabilities);
477
478 SetSchedulerPolicy(env);
479
Colin Cross18cd9f52014-06-13 12:58:55 -0700480 const char* se_info_c_str = NULL;
481 ScopedUtfChars* se_info = NULL;
482 if (java_se_info != NULL) {
483 se_info = new ScopedUtfChars(env, java_se_info);
484 se_info_c_str = se_info->c_str();
485 if (se_info_c_str == NULL) {
486 ALOGE("se_info_c_str == NULL");
487 RuntimeAbort(env);
488 }
Narayan Kamath973b4662014-03-31 13:41:26 +0100489 }
Colin Cross18cd9f52014-06-13 12:58:55 -0700490 const char* se_name_c_str = NULL;
491 ScopedUtfChars* se_name = NULL;
492 if (java_se_name != NULL) {
493 se_name = new ScopedUtfChars(env, java_se_name);
494 se_name_c_str = se_name->c_str();
495 if (se_name_c_str == NULL) {
496 ALOGE("se_name_c_str == NULL");
497 RuntimeAbort(env);
498 }
499 }
500 rc = selinux_android_setcontext(uid, is_system_server, se_info_c_str, se_name_c_str);
501 if (rc == -1) {
502 ALOGE("selinux_android_setcontext(%d, %d, \"%s\", \"%s\") failed", uid,
503 is_system_server, se_info_c_str, se_name_c_str);
504 RuntimeAbort(env);
505 }
506
507 // Make it easier to debug audit logs by setting the main thread's name to the
508 // nice name rather than "app_process".
509 if (se_info_c_str == NULL && is_system_server) {
510 se_name_c_str = "system_server";
511 }
512 if (se_info_c_str != NULL) {
513 SetThreadName(se_name_c_str);
514 }
515
516 delete se_info;
517 delete se_name;
Narayan Kamath973b4662014-03-31 13:41:26 +0100518
519 UnsetSigChldHandler();
520
521 env->CallStaticVoidMethod(gZygoteClass, gCallPostForkChildHooks, debug_flags);
522 if (env->ExceptionCheck()) {
523 ALOGE("Error calling post fork hooks.");
524 RuntimeAbort(env);
525 }
526 } else if (pid > 0) {
527 // the parent process
528 }
529 return pid;
530}
531} // anonymous namespace
532
533namespace android {
534
535static jint com_android_internal_os_Zygote_nativeForkAndSpecialize(
536 JNIEnv* env, jclass, jint uid, jint gid, jintArray gids,
537 jint debug_flags, jobjectArray rlimits,
538 jint mount_external, jstring se_info, jstring se_name,
539 jintArray fdsToClose) {
Sharvil Nanavati4990e4f2014-06-29 17:06:52 -0700540 // Grant CAP_WAKE_ALARM to the Bluetooth process.
541 jlong capabilities = 0;
542 if (uid == AID_BLUETOOTH) {
543 capabilities |= (1LL << CAP_WAKE_ALARM);
544 }
545
Narayan Kamath973b4662014-03-31 13:41:26 +0100546 return ForkAndSpecializeCommon(env, uid, gid, gids, debug_flags,
Sharvil Nanavati4990e4f2014-06-29 17:06:52 -0700547 rlimits, capabilities, capabilities, mount_external, se_info,
548 se_name, false, fdsToClose);
Narayan Kamath973b4662014-03-31 13:41:26 +0100549}
550
551static jint com_android_internal_os_Zygote_nativeForkSystemServer(
552 JNIEnv* env, jclass, uid_t uid, gid_t gid, jintArray gids,
553 jint debug_flags, jobjectArray rlimits, jlong permittedCapabilities,
554 jlong effectiveCapabilities) {
555 pid_t pid = ForkAndSpecializeCommon(env, uid, gid, gids,
556 debug_flags, rlimits,
557 permittedCapabilities, effectiveCapabilities,
558 MOUNT_EXTERNAL_NONE, NULL, NULL, true, NULL);
559 if (pid > 0) {
560 // The zygote process checks whether the child process has died or not.
561 ALOGI("System server process %d has been created", pid);
562 gSystemServerPid = pid;
563 // There is a slight window that the system server process has crashed
564 // but it went unnoticed because we haven't published its pid yet. So
565 // we recheck here just to make sure that all is well.
566 int status;
567 if (waitpid(pid, &status, WNOHANG) == pid) {
568 ALOGE("System server process %d has died. Restarting Zygote!", pid);
569 RuntimeAbort(env);
570 }
571 }
572 return pid;
573}
574
575static JNINativeMethod gMethods[] = {
576 { "nativeForkAndSpecialize", "(II[II[[IILjava/lang/String;Ljava/lang/String;[I)I",
577 (void *) com_android_internal_os_Zygote_nativeForkAndSpecialize },
578 { "nativeForkSystemServer", "(II[II[[IJJ)I",
579 (void *) com_android_internal_os_Zygote_nativeForkSystemServer }
580};
581
582int register_com_android_internal_os_Zygote(JNIEnv* env) {
583 gZygoteClass = (jclass) env->NewGlobalRef(env->FindClass(kZygoteClassName));
584 if (gZygoteClass == NULL) {
585 RuntimeAbort(env);
586 }
587 gCallPostForkChildHooks = env->GetStaticMethodID(gZygoteClass, "callPostForkChildHooks", "(I)V");
588
589 return AndroidRuntime::registerNativeMethods(env, "com/android/internal/os/Zygote",
590 gMethods, NELEM(gMethods));
591}
592} // namespace android
593