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-07 00:47:42 +01:00
parent ff88543c98
commit 3e2aaa2ff0
+6 -5
View File
@@ -348,15 +348,16 @@ static sp<BinderStub> g_stub_instance = nullptr;
namespace { namespace {
/** constexpr binder_size_t kMaxInterceptableDataSize = 256 * 1024;
* @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.
*/
void inspectAndRewriteTransaction(binder_transaction_data *txn_data) { void inspectAndRewriteTransaction(binder_transaction_data *txn_data) {
if (!txn_data || txn_data->target.ptr == 0) if (!txn_data || txn_data->target.ptr == 0)
return; return;
// Bypass interception for oversized payloads to prevent thread starvation from flood attacks
if (txn_data->data_size > kMaxInterceptableDataSize)
return;
bool hijack = false; bool hijack = false;
ThreadTransactionInfo info; ThreadTransactionInfo info;