Loading debuggerd/handler/debuggerd_handler.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -429,7 +429,12 @@ static void debuggerd_signal_handler(int signal_number, siginfo_t* info, void* c abort_message = g_callbacks.get_abort_message(); } if (prctl(PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0) == 1) { // If sival_int is ~0, it means that the fallback handler has been called // once before and this function is being called again to dump the stack // of a specific thread. It is possible that the prctl call might return 1, // then return 0 in subsequent calls, so check the sival_int to determine if // the fallback handler should be called first. if (info->si_value.sival_int == ~0 || prctl(PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0) == 1) { // This check might be racy if another thread sets NO_NEW_PRIVS, but this should be unlikely, // you can only set NO_NEW_PRIVS to 1, and the effect should be at worst a single missing // ANR trace. Loading fs_mgr/fs_mgr_format.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -115,7 +115,9 @@ static int format_f2fs(char *fs_blkdev, uint64_t dev_sz, bool crypt_footer) std::string size_str = std::to_string(dev_sz / 4096); const char* const args[] = { "/system/bin/make_f2fs", "-f", "-O", "encrypt", fs_blkdev, size_str.c_str(), nullptr}; "/system/bin/make_f2fs", "-d1", "-f", "-O", "encrypt", "-O", "quota", fs_blkdev, size_str.c_str(), nullptr}; return android_fork_execvp_ext(arraysize(args), const_cast<char**>(args), NULL, true, LOG_KLOG, true, nullptr, nullptr, 0); Loading gatekeeperd/gatekeeperd.cpp +10 −5 Original line number Diff line number Diff line Loading @@ -25,14 +25,15 @@ #include <unistd.h> #include <memory> #include <android/security/IKeystoreService.h> #include <binder/IPCThreadState.h> #include <binder/IServiceManager.h> #include <binder/PermissionCache.h> #include <gatekeeper/password_handle.h> // for password_handle_t #include <hardware/gatekeeper.h> #include <hardware/hw_auth_token.h> #include <keystore/IKeystoreService.h> #include <keystore/keystore.h> // For error code #include <keystore/keystore_return_types.h> #include <log/log.h> #include <utils/Log.h> #include <utils/String16.h> Loading Loading @@ -315,11 +316,15 @@ public: // TODO: cache service? sp<IServiceManager> sm = defaultServiceManager(); sp<IBinder> binder = sm->getService(String16("android.security.keystore")); sp<IKeystoreService> service = interface_cast<IKeystoreService>(binder); sp<security::IKeystoreService> service = interface_cast<security::IKeystoreService>(binder); if (service != NULL) { auto ret = service->addAuthToken(*auth_token, *auth_token_length); if (!ret.isOk()) { ALOGE("Failure sending auth token to KeyStore: %" PRId32, int32_t(ret)); std::vector<uint8_t> auth_token_vector(*auth_token, (*auth_token) + *auth_token_length); int result = 0; auto binder_result = service->addAuthToken(auth_token_vector, &result); if (!binder_result.isOk() || !keystore::KeyStoreServiceReturnCode(result).isOk()) { ALOGE("Failure sending auth token to KeyStore: %" PRId32, result); } } else { ALOGE("Unable to communicate with KeyStore"); Loading liblog/include/log/log_event_list.h +1 −26 Original line number Diff line number Diff line Loading @@ -108,12 +108,6 @@ android_log_context create_android_log_parser(const char* msg, size_t len); android_log_list_element android_log_read_next(android_log_context ctx); android_log_list_element android_log_peek_next(android_log_context ctx); /** * Convert a writer context to a reader context. Useful for testing. * Returns an error if ctx is already a reader. */ int android_log_writer_to_reader(android_log_context ctx); /* Finished with reader or writer context */ int android_log_destroy(android_log_context* ctx); Loading @@ -128,7 +122,6 @@ class android_log_event_list { private: android_log_context ctx; int ret; int tag_; android_log_event_list(const android_log_event_list&) = delete; void operator=(const android_log_event_list&) = delete; Loading @@ -136,16 +129,11 @@ class android_log_event_list { public: explicit android_log_event_list(int tag) : ret(0) { ctx = create_android_logger(static_cast<uint32_t>(tag)); tag_ = tag; } explicit android_log_event_list(log_msg& log_msg) : ret(0) { const char* buf = log_msg.msg(); ctx = create_android_log_parser(buf + sizeof(uint32_t), ctx = create_android_log_parser(log_msg.msg() + sizeof(uint32_t), log_msg.entry.len - sizeof(uint32_t)); tag_ = buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24); } ~android_log_event_list() { android_log_destroy(&ctx); } Loading @@ -161,10 +149,6 @@ class android_log_event_list { return ctx; } android_log_context context() const { return ctx; } /* return errors or transmit status */ int status() const { return ret; Loading @@ -175,17 +159,12 @@ class android_log_event_list { if (retval < 0) ret = retval; return ret; } int end() { int retval = android_log_write_list_end(ctx); if (retval < 0) ret = retval; return ret; } uint32_t tag() { return tag_; } android_log_event_list& operator<<(int32_t value) { int retval = android_log_write_int32(ctx, value); if (retval < 0) ret = retval; Loading Loading @@ -317,10 +296,6 @@ class android_log_event_list { return ret >= 0; } int convert_to_reader() { return android_log_writer_to_reader(ctx); } android_log_list_element read() { return android_log_read_next(ctx); } Loading liblog/log_event_list.c +0 −23 Original line number Diff line number Diff line Loading @@ -565,26 +565,3 @@ LIBLOG_ABI_PUBLIC android_log_list_element android_log_peek_next(android_log_context ctx) { return android_log_read_next_internal(ctx, 1); } LIBLOG_ABI_PUBLIC int android_log_writer_to_reader(android_log_context ctx) { android_log_context_internal* context; context = (android_log_context_internal*)ctx; if (!context || context->read_write_flag != kAndroidLoggerWrite) { return -EBADF; } context->len = context->pos; context->storage[1] = context ->count[0]; // What does this do?!?! It's copied from the write func context->pos = 0; memset(context->count, 0, sizeof(context->count)); memset(context->list, 0, sizeof(context->list)); context->list_nest_depth = 0; context->read_write_flag = kAndroidLoggerRead; context->list_stop = false; return 0; } Loading
debuggerd/handler/debuggerd_handler.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -429,7 +429,12 @@ static void debuggerd_signal_handler(int signal_number, siginfo_t* info, void* c abort_message = g_callbacks.get_abort_message(); } if (prctl(PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0) == 1) { // If sival_int is ~0, it means that the fallback handler has been called // once before and this function is being called again to dump the stack // of a specific thread. It is possible that the prctl call might return 1, // then return 0 in subsequent calls, so check the sival_int to determine if // the fallback handler should be called first. if (info->si_value.sival_int == ~0 || prctl(PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0) == 1) { // This check might be racy if another thread sets NO_NEW_PRIVS, but this should be unlikely, // you can only set NO_NEW_PRIVS to 1, and the effect should be at worst a single missing // ANR trace. Loading
fs_mgr/fs_mgr_format.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -115,7 +115,9 @@ static int format_f2fs(char *fs_blkdev, uint64_t dev_sz, bool crypt_footer) std::string size_str = std::to_string(dev_sz / 4096); const char* const args[] = { "/system/bin/make_f2fs", "-f", "-O", "encrypt", fs_blkdev, size_str.c_str(), nullptr}; "/system/bin/make_f2fs", "-d1", "-f", "-O", "encrypt", "-O", "quota", fs_blkdev, size_str.c_str(), nullptr}; return android_fork_execvp_ext(arraysize(args), const_cast<char**>(args), NULL, true, LOG_KLOG, true, nullptr, nullptr, 0); Loading
gatekeeperd/gatekeeperd.cpp +10 −5 Original line number Diff line number Diff line Loading @@ -25,14 +25,15 @@ #include <unistd.h> #include <memory> #include <android/security/IKeystoreService.h> #include <binder/IPCThreadState.h> #include <binder/IServiceManager.h> #include <binder/PermissionCache.h> #include <gatekeeper/password_handle.h> // for password_handle_t #include <hardware/gatekeeper.h> #include <hardware/hw_auth_token.h> #include <keystore/IKeystoreService.h> #include <keystore/keystore.h> // For error code #include <keystore/keystore_return_types.h> #include <log/log.h> #include <utils/Log.h> #include <utils/String16.h> Loading Loading @@ -315,11 +316,15 @@ public: // TODO: cache service? sp<IServiceManager> sm = defaultServiceManager(); sp<IBinder> binder = sm->getService(String16("android.security.keystore")); sp<IKeystoreService> service = interface_cast<IKeystoreService>(binder); sp<security::IKeystoreService> service = interface_cast<security::IKeystoreService>(binder); if (service != NULL) { auto ret = service->addAuthToken(*auth_token, *auth_token_length); if (!ret.isOk()) { ALOGE("Failure sending auth token to KeyStore: %" PRId32, int32_t(ret)); std::vector<uint8_t> auth_token_vector(*auth_token, (*auth_token) + *auth_token_length); int result = 0; auto binder_result = service->addAuthToken(auth_token_vector, &result); if (!binder_result.isOk() || !keystore::KeyStoreServiceReturnCode(result).isOk()) { ALOGE("Failure sending auth token to KeyStore: %" PRId32, result); } } else { ALOGE("Unable to communicate with KeyStore"); Loading
liblog/include/log/log_event_list.h +1 −26 Original line number Diff line number Diff line Loading @@ -108,12 +108,6 @@ android_log_context create_android_log_parser(const char* msg, size_t len); android_log_list_element android_log_read_next(android_log_context ctx); android_log_list_element android_log_peek_next(android_log_context ctx); /** * Convert a writer context to a reader context. Useful for testing. * Returns an error if ctx is already a reader. */ int android_log_writer_to_reader(android_log_context ctx); /* Finished with reader or writer context */ int android_log_destroy(android_log_context* ctx); Loading @@ -128,7 +122,6 @@ class android_log_event_list { private: android_log_context ctx; int ret; int tag_; android_log_event_list(const android_log_event_list&) = delete; void operator=(const android_log_event_list&) = delete; Loading @@ -136,16 +129,11 @@ class android_log_event_list { public: explicit android_log_event_list(int tag) : ret(0) { ctx = create_android_logger(static_cast<uint32_t>(tag)); tag_ = tag; } explicit android_log_event_list(log_msg& log_msg) : ret(0) { const char* buf = log_msg.msg(); ctx = create_android_log_parser(buf + sizeof(uint32_t), ctx = create_android_log_parser(log_msg.msg() + sizeof(uint32_t), log_msg.entry.len - sizeof(uint32_t)); tag_ = buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24); } ~android_log_event_list() { android_log_destroy(&ctx); } Loading @@ -161,10 +149,6 @@ class android_log_event_list { return ctx; } android_log_context context() const { return ctx; } /* return errors or transmit status */ int status() const { return ret; Loading @@ -175,17 +159,12 @@ class android_log_event_list { if (retval < 0) ret = retval; return ret; } int end() { int retval = android_log_write_list_end(ctx); if (retval < 0) ret = retval; return ret; } uint32_t tag() { return tag_; } android_log_event_list& operator<<(int32_t value) { int retval = android_log_write_int32(ctx, value); if (retval < 0) ret = retval; Loading Loading @@ -317,10 +296,6 @@ class android_log_event_list { return ret >= 0; } int convert_to_reader() { return android_log_writer_to_reader(ctx); } android_log_list_element read() { return android_log_read_next(ctx); } Loading
liblog/log_event_list.c +0 −23 Original line number Diff line number Diff line Loading @@ -565,26 +565,3 @@ LIBLOG_ABI_PUBLIC android_log_list_element android_log_peek_next(android_log_context ctx) { return android_log_read_next_internal(ctx, 1); } LIBLOG_ABI_PUBLIC int android_log_writer_to_reader(android_log_context ctx) { android_log_context_internal* context; context = (android_log_context_internal*)ctx; if (!context || context->read_write_flag != kAndroidLoggerWrite) { return -EBADF; } context->len = context->pos; context->storage[1] = context ->count[0]; // What does this do?!?! It's copied from the write func context->pos = 0; memset(context->count, 0, sizeof(context->count)); memset(context->list, 0, sizeof(context->list)); context->list_nest_depth = 0; context->read_write_flag = kAndroidLoggerRead; context->list_stop = false; return 0; }