Cap interceptable binder payload size at 256KB

Prevents thread starvation from flood attacks targeting the
binder interceptor with oversized payloads.
This commit is contained in:
Enginex0
2026-02-06 21:10:59 +01:00
committed by GKI Builder
parent 1ac08411be
commit 7c4df3e237
+6 -5
View File
@@ -348,15 +348,16 @@ static sp<BinderStub> g_stub_instance = nullptr;
namespace {
/**
* @brief Analyses a binder transaction. If the target is monitored,
* hijacks the transaction by rewriting its destination to our BinderStub.
* @param txn_data Pointer to the transaction data within the ioctl buffer.
*/
constexpr binder_size_t kMaxInterceptableDataSize = 256 * 1024;
void inspectAndRewriteTransaction(binder_transaction_data *txn_data) {
if (!txn_data || txn_data->target.ptr == 0)
return;
// Bypass interception for oversized payloads to prevent thread starvation from flood attacks
if (txn_data->data_size > kMaxInterceptableDataSize)
return;
bool hijack = false;
ThreadTransactionInfo info;