From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f74.google.com (mail-wr1-f74.google.com [209.85.221.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5BC021DA60F for ; Fri, 13 Feb 2026 07:57:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770969462; cv=none; b=idWLX5+uL7OMxBKN9HcGNpmmUD6iOGF39ii++nJjKkoKWXeriFvab5Y4D0y/pUoUBiCmiMzpX2+ATGUkqiTa1SBfu5/yJSCVXo6J507OSRgA7kxQI44mFoeEFRU/w9PRsxa9ikoiAFBJpYMeHx8AVweNuz/7tgyfvx06MZyazqA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770969462; c=relaxed/simple; bh=faX4c37UJq/IghxiFYJTQA/NLQfMpGvibnLnj60FnyQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=rdeq4rpkwCgFCw2sEuqfMUskKHmvqbG21g//Lop9IJvKHXP3vYnceGxmZYdy2q7R8YwVIYD0xDKLdNIE0b2Mss3a8+GT7FtJr9XZjlAhOGxTpnyST12S1+n7LKohFtEvciZbqklvPB/EzL7m5KpMsmNPMaOkzYMw6fkSAW7nxRY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Q8irZ+ss; arc=none smtp.client-ip=209.85.221.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Q8irZ+ss" Received: by mail-wr1-f74.google.com with SMTP id ffacd0b85a97d-435ab907109so469224f8f.3 for ; Thu, 12 Feb 2026 23:57:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1770969460; x=1771574260; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=VdjISIOyUztyDUdAxqdnyQht9GvvjjW3hn7WzZDyBC8=; b=Q8irZ+ssU530ZhQCk5V2URZMeqxsiJ7+mTR+Gklm7F+6CWF09jYBJiKd9hcpgHuOeV uHfBkhRn6Dk6wNBKB0mZyiE+Vn25i62NsGnljnY0NfLcnKTD21iUH5wD691LCwPtWeGO B31eRFAHU2WvROoZQ5NwTtYq1WXUlvBR3Z/X4jogeik0mL8+QCyAb3eRynbotPxGpCSw Xbci5EWJoxdq53w7X3QjPoo6dU5wWG8L3XwUW6bPfrNks16BeKzNtRW5SISJE/c5TLwk yKuTHmK9B8S0IHaJO3px26OvvhV9mIE0iE/A6erw1MSBdA0ql7BuheAkwztXULkTipER ygkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770969460; x=1771574260; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VdjISIOyUztyDUdAxqdnyQht9GvvjjW3hn7WzZDyBC8=; b=ZqOpn7yBlS0l27Hfh46Rn/wSIxFqkgU3ARV+wvQkev6rfU3taJehNabgVVVDQ8Cb8n o5NxmJ5iU05st06AUdFpq10uqZQgVGkEqLqhFVT3l1J2GuOP03DtL2uoefeW47GBQHvJ 8ElicsKIMSB7y3lVsZPGVTgtv1TNSksbkVCIzmkLDT7XaayZwnvd7Y3z1SZZXnp7wfvI BKdXDF47EbTG6J4Q8+nErqO6dZUtAh3lJm/zc4SwJMBLl9PaGle6Z1ju04GuPceNEMWt Jd9gEp9RbW8p6rQHGZxJGqlSO0A3oKe+IsFw0cERqZaikpIfl8ExkZJtE+rzZiKWOrLs cGpg== X-Forwarded-Encrypted: i=1; AJvYcCW5AY6jGZisAvJh8R+WodcAtHZEZand1qqi2PM4RT02Kf4bQri34FZFdFw2V4HY8lnmpEgMV3b3pv8fyqY=@vger.kernel.org X-Gm-Message-State: AOJu0YzmRkeZIFAa37KFO6CNTsWFmGLgV80bHLn2lSHJrqfqjdbMH028 iyJfqyIwbt5Y0l8znK6lQ1A/2UDX3w/My60oIbhew5RDLOi90J6QL0PvQewYqt111ZoQar4gI9W SPtfsRX+VC/v5nTdIvw== X-Received: from wrrv10.prod.google.com ([2002:a5d:43ca:0:b0:437:729f:8dee]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6000:26d2:b0:436:3707:2be5 with SMTP id ffacd0b85a97d-437978cdfaamr1806967f8f.15.1770969459539; Thu, 12 Feb 2026 23:57:39 -0800 (PST) Date: Fri, 13 Feb 2026 07:57:38 +0000 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260210232949.3770644-1-cmllamas@google.com> Message-ID: Subject: Re: [PATCH] rust_binder: fix oneway spam detection From: Alice Ryhl To: Tiffany Yang Cc: Carlos Llamas , Greg Kroah-Hartman , "Arve =?utf-8?B?SGrDuG5uZXbDpWc=?=" , Todd Kjos , Christian Brauner , Wedson Almeida Filho , Matt Gilbride , Paul Moore , Vitaly Wool , Miguel Ojeda , kernel-team@android.com, linux-kernel@vger.kernel.org, stable@vger.kernel.org Content-Type: text/plain; charset="utf-8" On Wed, Feb 11, 2026 at 11:41:40PM -0800, Tiffany Yang wrote: > Alice Ryhl writes: > > > On Tue, Feb 10, 2026 at 11:28:20PM +0000, Carlos Llamas wrote: > >> The spam detection logic in TreeRange was executed before the current > >> request was inserted into the tree. So the new request was not being > >> factored in the spam calculation. Fix this by moving the logic after > >> the new range has been inserted. > >> > >> Also, the detection logic for ArrayRange was missing altogether which > >> meant large spamming transactions could get away without being detected. > >> Fix this by implementing an equivalent low_oneway_space() in ArrayRange. > >> > >> Note that I looked into centralizing this logic in RangeAllocator but > >> iterating through 'state' and 'size' got a bit too complicated (for me) > >> and I abandoned this effort. > > > > I think current approach is fine. > > > > Is there a pattern that would allow us to avoid so much duplicate code? > Or like... a nice way to call into a shared low_oneway_space? It's > frustrating that the two implementations are basically the same except > for how they iterate over buffers. I've been thinking of rust binder as > binder's chance at a fresh start, so I'm reticent to introduce this kind > of tech debt so early on. > > I don't have a clear idea of what the appropriate fix would be here, but > I'd be happy to help do some plumbing if it'll make things smoother in > the long run! We could potentially have a single low_oneway_space() that takes an iterator over the ranges. Then each impl can pass an iterator specific to its own impl. Alice