Loading libs/binder/Constants.h +3 −0 Original line number Diff line number Diff line Loading @@ -36,4 +36,7 @@ constexpr size_t kLogTransactionsOverBytes = 300 * 1024; */ constexpr size_t kRpcTransactionLimitBytes = 600 * 1024; // TODO(b/424526253): remove high limit again constexpr size_t kRpcTransactionTemporaryLimitBytes = 20 * 1024 * 1024; } // namespace android::binder libs/binder/RpcState.cpp +7 −2 Original line number Diff line number Diff line Loading @@ -361,9 +361,14 @@ RpcState::CommandData::CommandData(size_t size) : mSize(size) { // transaction (in some cases, additional fixed size amounts are added), // though for rough consistency, we should avoid cases where this data type // is used for multiple dynamic allocations for a single transaction. if (size > binder::kRpcTransactionLimitBytes) { ALOGE("Transaction requested too much data allocation: %zu bytes, failing.", size); if (size > binder::kRpcTransactionTemporaryLimitBytes) { ALOGE("Transaction requested WAY WAY WAY too much data allocation: %zu bytes, failing.", size); return; } else if (size > binder::kRpcTransactionLimitBytes) { ALOGE("Transaction requested too much data allocation: %zu bytes, this will become a " "failure!!!", size); } else if (size > binder::kLogTransactionsOverBytes) { ALOGW("Transaction too large: inefficient and in danger of breaking: %zu bytes.", size); } Loading libs/binder/tests/binderRpcTest.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -713,6 +713,7 @@ TEST_P(BinderRpc, OnewayCallExhaustion) { } // TODO(b/392717039): can we move this to universal tests? // TODO(b/424526253): restore limit down TEST_P(BinderRpc, SendTooLargeVector) { if (GetParam().singleThreaded) { GTEST_SKIP() << "Requires multi-threaded server to test one of the sessions crashing."; Loading @@ -724,7 +725,7 @@ TEST_P(BinderRpc, SendTooLargeVector) { EXPECT_EQ(OK, proc.rootBinder->pingBinder()); // see libbinder internal Constants.h const size_t kTooLargeSize = 650 * 1024; const size_t kTooLargeSize = 25 * 1024 * 1024; const std::vector<uint8_t> kTestValue(kTooLargeSize / sizeof(uint8_t), 42); // TODO(b/392717039): Telling a server to allocate too much data currently causes the session to Loading Loading
libs/binder/Constants.h +3 −0 Original line number Diff line number Diff line Loading @@ -36,4 +36,7 @@ constexpr size_t kLogTransactionsOverBytes = 300 * 1024; */ constexpr size_t kRpcTransactionLimitBytes = 600 * 1024; // TODO(b/424526253): remove high limit again constexpr size_t kRpcTransactionTemporaryLimitBytes = 20 * 1024 * 1024; } // namespace android::binder
libs/binder/RpcState.cpp +7 −2 Original line number Diff line number Diff line Loading @@ -361,9 +361,14 @@ RpcState::CommandData::CommandData(size_t size) : mSize(size) { // transaction (in some cases, additional fixed size amounts are added), // though for rough consistency, we should avoid cases where this data type // is used for multiple dynamic allocations for a single transaction. if (size > binder::kRpcTransactionLimitBytes) { ALOGE("Transaction requested too much data allocation: %zu bytes, failing.", size); if (size > binder::kRpcTransactionTemporaryLimitBytes) { ALOGE("Transaction requested WAY WAY WAY too much data allocation: %zu bytes, failing.", size); return; } else if (size > binder::kRpcTransactionLimitBytes) { ALOGE("Transaction requested too much data allocation: %zu bytes, this will become a " "failure!!!", size); } else if (size > binder::kLogTransactionsOverBytes) { ALOGW("Transaction too large: inefficient and in danger of breaking: %zu bytes.", size); } Loading
libs/binder/tests/binderRpcTest.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -713,6 +713,7 @@ TEST_P(BinderRpc, OnewayCallExhaustion) { } // TODO(b/392717039): can we move this to universal tests? // TODO(b/424526253): restore limit down TEST_P(BinderRpc, SendTooLargeVector) { if (GetParam().singleThreaded) { GTEST_SKIP() << "Requires multi-threaded server to test one of the sessions crashing."; Loading @@ -724,7 +725,7 @@ TEST_P(BinderRpc, SendTooLargeVector) { EXPECT_EQ(OK, proc.rootBinder->pingBinder()); // see libbinder internal Constants.h const size_t kTooLargeSize = 650 * 1024; const size_t kTooLargeSize = 25 * 1024 * 1024; const std::vector<uint8_t> kTestValue(kTooLargeSize / sizeof(uint8_t), 42); // TODO(b/392717039): Telling a server to allocate too much data currently causes the session to Loading