blob: 5781765786cce0a4e46d3469a354353229d3ae87 [file] [log] [blame]
Andres Morales2d08dce2015-04-03 16:40:15 -07001/*
2 * Copyright (C) 2015 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
17#define LOG_TAG "gatekeeperd"
18
19#include "IGateKeeperService.h"
20
Andres Morales6a49c2f2015-04-16 13:16:24 -070021#include <errno.h>
Andres Morales6a49c2f2015-04-16 13:16:24 -070022#include <fcntl.h>
Mark Salyzyn66ce3e02016-09-28 10:07:20 -070023#include <inttypes.h>
24#include <stdint.h>
Andres Morales6a49c2f2015-04-16 13:16:24 -070025#include <unistd.h>
Justin Yun68b0ec62017-08-16 18:54:20 +090026#include <memory>
Andres Morales6a49c2f2015-04-16 13:16:24 -070027
Dmitry Dementyev0dd259c2017-11-14 12:53:39 -080028#include <android/security/IKeystoreService.h>
Andres Morales2d08dce2015-04-03 16:40:15 -070029#include <binder/IPCThreadState.h>
30#include <binder/IServiceManager.h>
31#include <binder/PermissionCache.h>
Andres Morales6a49c2f2015-04-16 13:16:24 -070032#include <gatekeeper/password_handle.h> // for password_handle_t
Andres Morales2d08dce2015-04-03 16:40:15 -070033#include <hardware/gatekeeper.h>
Andres Morales6a49c2f2015-04-16 13:16:24 -070034#include <hardware/hw_auth_token.h>
Mark Salyzyn66ce3e02016-09-28 10:07:20 -070035#include <keystore/keystore.h> // For error code
Dmitry Dementyev0dd259c2017-11-14 12:53:39 -080036#include <keystore/keystore_return_types.h>
Mark Salyzyn30f991f2017-01-10 13:19:54 -080037#include <log/log.h>
Mark Salyzyn66ce3e02016-09-28 10:07:20 -070038#include <utils/Log.h>
39#include <utils/String16.h>
Andres Morales2d08dce2015-04-03 16:40:15 -070040
Andres Morales33dfdc72015-05-12 15:37:20 -070041#include "SoftGateKeeperDevice.h"
42
Alexey Polyudov275aece2016-10-18 13:59:26 -070043#include <hidl/HidlSupport.h>
44#include <android/hardware/gatekeeper/1.0/IGatekeeper.h>
45
46using android::sp;
47using android::hardware::gatekeeper::V1_0::IGatekeeper;
48using android::hardware::gatekeeper::V1_0::GatekeeperStatusCode;
49using android::hardware::gatekeeper::V1_0::GatekeeperResponse;
50using android::hardware::Return;
51
Andres Morales2d08dce2015-04-03 16:40:15 -070052namespace android {
53
54static const String16 KEYGUARD_PERMISSION("android.permission.ACCESS_KEYGUARD_SECURE_STORAGE");
55static const String16 DUMP_PERMISSION("android.permission.DUMP");
56
57class GateKeeperProxy : public BnGateKeeperService {
58public:
59 GateKeeperProxy() {
Adrian Rooscb4ed1b2017-04-12 13:03:04 -070060 clear_state_if_needed_done = false;
Chris Phoenixa84ce0c2017-01-24 13:09:39 -080061 hw_device = IGatekeeper::getService();
Andres Moralesfef908e2015-07-07 10:28:15 -070062
Alexey Polyudov275aece2016-10-18 13:59:26 -070063 if (hw_device == nullptr) {
Andres Morales33dfdc72015-05-12 15:37:20 -070064 ALOGW("falling back to software GateKeeper");
65 soft_device.reset(new SoftGateKeeperDevice());
Andres Morales33dfdc72015-05-12 15:37:20 -070066 }
Andres Morales2d08dce2015-04-03 16:40:15 -070067 }
68
69 virtual ~GateKeeperProxy() {
Andres Morales2d08dce2015-04-03 16:40:15 -070070 }
71
Andres Morales6a49c2f2015-04-16 13:16:24 -070072 void store_sid(uint32_t uid, uint64_t sid) {
73 char filename[21];
George Burgess IVe7aa2b22016-03-02 14:02:55 -080074 snprintf(filename, sizeof(filename), "%u", uid);
Andres Morales6a49c2f2015-04-16 13:16:24 -070075 int fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR);
76 if (fd < 0) {
Andres Moralesdcb3fbd2015-04-17 09:00:28 -070077 ALOGE("could not open file: %s: %s", filename, strerror(errno));
Andres Morales6a49c2f2015-04-16 13:16:24 -070078 return;
79 }
80 write(fd, &sid, sizeof(sid));
81 close(fd);
82 }
83
Adrian Rooscb4ed1b2017-04-12 13:03:04 -070084 void clear_state_if_needed() {
85 if (clear_state_if_needed_done) {
86 return;
87 }
88
89 if (mark_cold_boot()) {
90 ALOGI("cold boot: clearing state");
91 if (hw_device != nullptr) {
92 hw_device->deleteAllUsers([](const GatekeeperResponse &){});
93 }
94 }
95
96 clear_state_if_needed_done = true;
97 }
98
Andres Morales3c2086d2015-06-24 10:21:16 -070099 bool mark_cold_boot() {
100 const char *filename = ".coldboot";
101 if (access(filename, F_OK) == -1) {
102 int fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR);
103 if (fd < 0) {
104 ALOGE("could not open file: %s : %s", filename, strerror(errno));
105 return false;
106 }
107 close(fd);
108 return true;
109 }
110 return false;
111 }
112
Andres Morales6a49c2f2015-04-16 13:16:24 -0700113 void maybe_store_sid(uint32_t uid, uint64_t sid) {
114 char filename[21];
George Burgess IVe7aa2b22016-03-02 14:02:55 -0800115 snprintf(filename, sizeof(filename), "%u", uid);
Andres Morales6a49c2f2015-04-16 13:16:24 -0700116 if (access(filename, F_OK) == -1) {
117 store_sid(uid, sid);
118 }
119 }
120
121 uint64_t read_sid(uint32_t uid) {
122 char filename[21];
123 uint64_t sid;
George Burgess IVe7aa2b22016-03-02 14:02:55 -0800124 snprintf(filename, sizeof(filename), "%u", uid);
Andres Morales6a49c2f2015-04-16 13:16:24 -0700125 int fd = open(filename, O_RDONLY);
126 if (fd < 0) return 0;
127 read(fd, &sid, sizeof(sid));
Andres Morales0b0435e2015-07-10 09:47:09 -0700128 close(fd);
Andres Morales6a49c2f2015-04-16 13:16:24 -0700129 return sid;
130 }
131
Andres Moralesdcb3fbd2015-04-17 09:00:28 -0700132 void clear_sid(uint32_t uid) {
133 char filename[21];
George Burgess IVe7aa2b22016-03-02 14:02:55 -0800134 snprintf(filename, sizeof(filename), "%u", uid);
Andres Moralesdcb3fbd2015-04-17 09:00:28 -0700135 if (remove(filename) < 0) {
136 ALOGE("%s: could not remove file [%s], attempting 0 write", __func__, strerror(errno));
137 store_sid(uid, 0);
138 }
139 }
140
Andres Moralesae242922015-05-18 09:26:19 -0700141 virtual int enroll(uint32_t uid,
Andres Morales2d08dce2015-04-03 16:40:15 -0700142 const uint8_t *current_password_handle, uint32_t current_password_handle_length,
143 const uint8_t *current_password, uint32_t current_password_length,
144 const uint8_t *desired_password, uint32_t desired_password_length,
145 uint8_t **enrolled_password_handle, uint32_t *enrolled_password_handle_length) {
146 IPCThreadState* ipc = IPCThreadState::self();
147 const int calling_pid = ipc->getCallingPid();
148 const int calling_uid = ipc->getCallingUid();
149 if (!PermissionCache::checkPermission(KEYGUARD_PERMISSION, calling_pid, calling_uid)) {
150 return PERMISSION_DENIED;
151 }
152
Adrian Rooscb4ed1b2017-04-12 13:03:04 -0700153 // Make sure to clear any state from before factory reset as soon as a credential is
154 // enrolled (which may happen during device setup).
155 clear_state_if_needed();
156
Andres Morales2d08dce2015-04-03 16:40:15 -0700157 // need a desired password to enroll
158 if (desired_password_length == 0) return -EINVAL;
Andres Morales33dfdc72015-05-12 15:37:20 -0700159
160 int ret;
Alexey Polyudov275aece2016-10-18 13:59:26 -0700161 if (hw_device != nullptr) {
Andres Morales835d96e2015-06-03 15:06:24 -0700162 const gatekeeper::password_handle_t *handle =
163 reinterpret_cast<const gatekeeper::password_handle_t *>(current_password_handle);
164
Andres Morales7f6dcf62015-06-24 18:40:24 -0700165 if (handle != NULL && handle->version != 0 && !handle->hardware_backed) {
Andres Morales835d96e2015-06-03 15:06:24 -0700166 // handle is being re-enrolled from a software version. HAL probably won't accept
167 // the handle as valid, so we nullify it and enroll from scratch
168 current_password_handle = NULL;
169 current_password_handle_length = 0;
170 current_password = NULL;
171 current_password_length = 0;
172 }
173
Alexey Polyudov275aece2016-10-18 13:59:26 -0700174 android::hardware::hidl_vec<uint8_t> curPwdHandle;
175 curPwdHandle.setToExternal(const_cast<uint8_t*>(current_password_handle),
176 current_password_handle_length);
177 android::hardware::hidl_vec<uint8_t> curPwd;
178 curPwd.setToExternal(const_cast<uint8_t*>(current_password),
179 current_password_length);
180 android::hardware::hidl_vec<uint8_t> newPwd;
181 newPwd.setToExternal(const_cast<uint8_t*>(desired_password),
182 desired_password_length);
183
184 Return<void> hwRes = hw_device->enroll(uid, curPwdHandle, curPwd, newPwd,
185 [&ret, enrolled_password_handle, enrolled_password_handle_length]
186 (const GatekeeperResponse &rsp) {
187 ret = static_cast<int>(rsp.code); // propagate errors
188 if (rsp.code >= GatekeeperStatusCode::STATUS_OK) {
189 if (enrolled_password_handle != nullptr &&
190 enrolled_password_handle_length != nullptr) {
191 *enrolled_password_handle = new uint8_t[rsp.data.size()];
192 *enrolled_password_handle_length = rsp.data.size();
193 memcpy(*enrolled_password_handle, rsp.data.data(),
194 *enrolled_password_handle_length);
195 }
196 ret = 0; // all success states are reported as 0
197 } else if (rsp.code == GatekeeperStatusCode::ERROR_RETRY_TIMEOUT && rsp.timeout > 0) {
198 ret = rsp.timeout;
199 }
200 });
Steven Moreland81330932017-01-03 17:01:27 -0800201 if (!hwRes.isOk()) {
Alexey Polyudov275aece2016-10-18 13:59:26 -0700202 ALOGE("enroll transaction failed\n");
203 ret = -1;
204 }
Andres Morales33dfdc72015-05-12 15:37:20 -0700205 } else {
206 ret = soft_device->enroll(uid,
207 current_password_handle, current_password_handle_length,
208 current_password, current_password_length,
209 desired_password, desired_password_length,
210 enrolled_password_handle, enrolled_password_handle_length);
211 }
212
Alexey Polyudov8c635362016-09-07 18:51:28 -0700213 if (ret == GATEKEEPER_RESPONSE_OK && (*enrolled_password_handle == nullptr ||
214 *enrolled_password_handle_length != sizeof(password_handle_t))) {
215 ret = GATEKEEPER_RESPONSE_ERROR;
216 ALOGE("HAL: password_handle=%p size_of_handle=%" PRIu32 "\n",
217 *enrolled_password_handle, *enrolled_password_handle_length);
218 }
219
220 if (ret == GATEKEEPER_RESPONSE_OK) {
Andres Morales6a49c2f2015-04-16 13:16:24 -0700221 gatekeeper::password_handle_t *handle =
222 reinterpret_cast<gatekeeper::password_handle_t *>(*enrolled_password_handle);
223 store_sid(uid, handle->user_id);
Andres Morales531e3e82015-06-01 17:23:04 -0700224 bool rr;
225
226 // immediately verify this password so we don't ask the user to enter it again
227 // if they just created it.
228 verify(uid, *enrolled_password_handle, sizeof(password_handle_t), desired_password,
229 desired_password_length, &rr);
Andres Morales6a49c2f2015-04-16 13:16:24 -0700230 }
Andres Moralesae242922015-05-18 09:26:19 -0700231
232 return ret;
Andres Morales2d08dce2015-04-03 16:40:15 -0700233 }
234
Andres Moralesae242922015-05-18 09:26:19 -0700235 virtual int verify(uint32_t uid,
Andres Morales2d08dce2015-04-03 16:40:15 -0700236 const uint8_t *enrolled_password_handle, uint32_t enrolled_password_handle_length,
Andres Moralesae242922015-05-18 09:26:19 -0700237 const uint8_t *provided_password, uint32_t provided_password_length, bool *request_reenroll) {
Andres Moralesc828ae82015-04-10 21:03:07 -0700238 uint8_t *auth_token;
239 uint32_t auth_token_length;
240 return verifyChallenge(uid, 0, enrolled_password_handle, enrolled_password_handle_length,
241 provided_password, provided_password_length,
Andres Moralesae242922015-05-18 09:26:19 -0700242 &auth_token, &auth_token_length, request_reenroll);
Andres Moralesc828ae82015-04-10 21:03:07 -0700243 }
244
Andres Moralesae242922015-05-18 09:26:19 -0700245 virtual int verifyChallenge(uint32_t uid, uint64_t challenge,
Andres Moralesc828ae82015-04-10 21:03:07 -0700246 const uint8_t *enrolled_password_handle, uint32_t enrolled_password_handle_length,
247 const uint8_t *provided_password, uint32_t provided_password_length,
Andres Moralesae242922015-05-18 09:26:19 -0700248 uint8_t **auth_token, uint32_t *auth_token_length, bool *request_reenroll) {
Andres Morales2d08dce2015-04-03 16:40:15 -0700249 IPCThreadState* ipc = IPCThreadState::self();
250 const int calling_pid = ipc->getCallingPid();
251 const int calling_uid = ipc->getCallingUid();
252 if (!PermissionCache::checkPermission(KEYGUARD_PERMISSION, calling_pid, calling_uid)) {
253 return PERMISSION_DENIED;
254 }
255
256 // can't verify if we're missing either param
257 if ((enrolled_password_handle_length | provided_password_length) == 0)
258 return -EINVAL;
259
Andres Morales33dfdc72015-05-12 15:37:20 -0700260 int ret;
Alexey Polyudov275aece2016-10-18 13:59:26 -0700261 if (hw_device != nullptr) {
Andres Morales835d96e2015-06-03 15:06:24 -0700262 const gatekeeper::password_handle_t *handle =
263 reinterpret_cast<const gatekeeper::password_handle_t *>(enrolled_password_handle);
Andres Morales7f6dcf62015-06-24 18:40:24 -0700264 // handle version 0 does not have hardware backed flag, and thus cannot be upgraded to
265 // a HAL if there was none before
266 if (handle->version == 0 || handle->hardware_backed) {
Alexey Polyudov275aece2016-10-18 13:59:26 -0700267 android::hardware::hidl_vec<uint8_t> curPwdHandle;
268 curPwdHandle.setToExternal(const_cast<uint8_t*>(enrolled_password_handle),
269 enrolled_password_handle_length);
270 android::hardware::hidl_vec<uint8_t> enteredPwd;
271 enteredPwd.setToExternal(const_cast<uint8_t*>(provided_password),
272 provided_password_length);
273 Return<void> hwRes = hw_device->verify(uid, challenge, curPwdHandle, enteredPwd,
274 [&ret, request_reenroll, auth_token, auth_token_length]
275 (const GatekeeperResponse &rsp) {
276 ret = static_cast<int>(rsp.code); // propagate errors
277 if (auth_token != nullptr && auth_token_length != nullptr &&
278 rsp.code >= GatekeeperStatusCode::STATUS_OK) {
279 *auth_token = new uint8_t[rsp.data.size()];
280 *auth_token_length = rsp.data.size();
281 memcpy(*auth_token, rsp.data.data(), *auth_token_length);
282 if (request_reenroll != nullptr) {
283 *request_reenroll = (rsp.code == GatekeeperStatusCode::STATUS_REENROLL);
284 }
285 ret = 0; // all success states are reported as 0
286 } else if (rsp.code == GatekeeperStatusCode::ERROR_RETRY_TIMEOUT &&
287 rsp.timeout > 0) {
288 ret = rsp.timeout;
289 }
290 });
Steven Moreland81330932017-01-03 17:01:27 -0800291 if (!hwRes.isOk()) {
Alexey Polyudov275aece2016-10-18 13:59:26 -0700292 ALOGE("verify transaction failed\n");
293 ret = -1;
294 }
Andres Morales835d96e2015-06-03 15:06:24 -0700295 } else {
296 // upgrade scenario, a HAL has been added to this device where there was none before
297 SoftGateKeeperDevice soft_dev;
298 ret = soft_dev.verify(uid, challenge,
299 enrolled_password_handle, enrolled_password_handle_length,
300 provided_password, provided_password_length, auth_token, auth_token_length,
301 request_reenroll);
302
303 if (ret == 0) {
304 // success! re-enroll with HAL
305 *request_reenroll = true;
306 }
307 }
Andres Morales33dfdc72015-05-12 15:37:20 -0700308 } else {
309 ret = soft_device->verify(uid, challenge,
310 enrolled_password_handle, enrolled_password_handle_length,
Andres Moralesae242922015-05-18 09:26:19 -0700311 provided_password, provided_password_length, auth_token, auth_token_length,
312 request_reenroll);
Andres Morales33dfdc72015-05-12 15:37:20 -0700313 }
Andres Morales2d08dce2015-04-03 16:40:15 -0700314
Andres Moralesae242922015-05-18 09:26:19 -0700315 if (ret == 0 && *auth_token != NULL && *auth_token_length > 0) {
Andres Morales2d08dce2015-04-03 16:40:15 -0700316 // TODO: cache service?
317 sp<IServiceManager> sm = defaultServiceManager();
318 sp<IBinder> binder = sm->getService(String16("android.security.keystore"));
Dmitry Dementyev0dd259c2017-11-14 12:53:39 -0800319 sp<security::IKeystoreService> service =
320 interface_cast<security::IKeystoreService>(binder);
Andres Morales2d08dce2015-04-03 16:40:15 -0700321 if (service != NULL) {
Dmitry Dementyev0dd259c2017-11-14 12:53:39 -0800322 std::vector<uint8_t> auth_token_vector(*auth_token,
323 (*auth_token) + *auth_token_length);
324 int result = 0;
Brian Young8dc03f62018-02-22 23:35:48 +0000325 auto binder_result = service->addAuthToken(auth_token_vector, &result);
Dmitry Dementyev0dd259c2017-11-14 12:53:39 -0800326 if (!binder_result.isOk() || !keystore::KeyStoreServiceReturnCode(result).isOk()) {
327 ALOGE("Failure sending auth token to KeyStore: %" PRId32, result);
Andres Morales2d08dce2015-04-03 16:40:15 -0700328 }
329 } else {
330 ALOGE("Unable to communicate with KeyStore");
331 }
332 }
333
Andres Moralesae242922015-05-18 09:26:19 -0700334 if (ret == 0) {
Andres Morales6a49c2f2015-04-16 13:16:24 -0700335 maybe_store_sid(uid, reinterpret_cast<const gatekeeper::password_handle_t *>(
336 enrolled_password_handle)->user_id);
Andres Morales6a49c2f2015-04-16 13:16:24 -0700337 }
338
Andres Moralesae242922015-05-18 09:26:19 -0700339 return ret;
Andres Morales6a49c2f2015-04-16 13:16:24 -0700340 }
341
Pavel Grafov9890f892017-06-28 19:03:58 +0100342 virtual uint64_t getSecureUserId(uint32_t uid) { return read_sid(uid); }
Andres Morales2d08dce2015-04-03 16:40:15 -0700343
Andres Morales7c9c3bc2015-04-16 15:57:17 -0700344 virtual void clearSecureUserId(uint32_t uid) {
345 IPCThreadState* ipc = IPCThreadState::self();
346 const int calling_pid = ipc->getCallingPid();
347 const int calling_uid = ipc->getCallingUid();
348 if (!PermissionCache::checkPermission(KEYGUARD_PERMISSION, calling_pid, calling_uid)) {
349 ALOGE("%s: permission denied for [%d:%d]", __func__, calling_pid, calling_uid);
350 return;
351 }
Andres Moralesdcb3fbd2015-04-17 09:00:28 -0700352 clear_sid(uid);
Andres Morales3c2086d2015-06-24 10:21:16 -0700353
Alexey Polyudov275aece2016-10-18 13:59:26 -0700354 if (hw_device != nullptr) {
355 hw_device->deleteUser(uid, [] (const GatekeeperResponse &){});
Andres Morales3c2086d2015-06-24 10:21:16 -0700356 }
Andres Morales7c9c3bc2015-04-16 15:57:17 -0700357 }
358
Adrian Rooscb4ed1b2017-04-12 13:03:04 -0700359 virtual void reportDeviceSetupComplete() {
360 IPCThreadState* ipc = IPCThreadState::self();
361 const int calling_pid = ipc->getCallingPid();
362 const int calling_uid = ipc->getCallingUid();
363 if (!PermissionCache::checkPermission(KEYGUARD_PERMISSION, calling_pid, calling_uid)) {
364 ALOGE("%s: permission denied for [%d:%d]", __func__, calling_pid, calling_uid);
365 return;
366 }
367
368 clear_state_if_needed();
369 }
370
Andres Morales2d08dce2015-04-03 16:40:15 -0700371 virtual status_t dump(int fd, const Vector<String16> &) {
372 IPCThreadState* ipc = IPCThreadState::self();
373 const int pid = ipc->getCallingPid();
374 const int uid = ipc->getCallingUid();
375 if (!PermissionCache::checkPermission(DUMP_PERMISSION, pid, uid)) {
376 return PERMISSION_DENIED;
377 }
378
Alexey Polyudov275aece2016-10-18 13:59:26 -0700379 if (hw_device == NULL) {
Andres Morales2d08dce2015-04-03 16:40:15 -0700380 const char *result = "Device not available";
381 write(fd, result, strlen(result) + 1);
382 } else {
383 const char *result = "OK";
384 write(fd, result, strlen(result) + 1);
385 }
386
387 return NO_ERROR;
388 }
389
390private:
Alexey Polyudov275aece2016-10-18 13:59:26 -0700391 sp<IGatekeeper> hw_device;
Justin Yun68b0ec62017-08-16 18:54:20 +0900392 std::unique_ptr<SoftGateKeeperDevice> soft_device;
Adrian Rooscb4ed1b2017-04-12 13:03:04 -0700393
394 bool clear_state_if_needed_done;
Andres Morales2d08dce2015-04-03 16:40:15 -0700395};
396}// namespace android
397
Andres Morales6a49c2f2015-04-16 13:16:24 -0700398int main(int argc, char* argv[]) {
Andres Morales2d08dce2015-04-03 16:40:15 -0700399 ALOGI("Starting gatekeeperd...");
Andres Morales6a49c2f2015-04-16 13:16:24 -0700400 if (argc < 2) {
401 ALOGE("A directory must be specified!");
402 return 1;
403 }
404 if (chdir(argv[1]) == -1) {
405 ALOGE("chdir: %s: %s", argv[1], strerror(errno));
406 return 1;
407 }
408
Andres Morales2d08dce2015-04-03 16:40:15 -0700409 android::sp<android::IServiceManager> sm = android::defaultServiceManager();
410 android::sp<android::GateKeeperProxy> proxy = new android::GateKeeperProxy();
411 android::status_t ret = sm->addService(
412 android::String16("android.service.gatekeeper.IGateKeeperService"), proxy);
413 if (ret != android::OK) {
414 ALOGE("Couldn't register binder service!");
415 return -1;
416 }
417
418 /*
419 * We're the only thread in existence, so we're just going to process
420 * Binder transaction as a single-threaded program.
421 */
422 android::IPCThreadState::self()->joinThreadPool();
423 return 0;
424}