From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 259703E2756; Thu, 16 Jul 2026 08:38:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784191081; cv=none; b=dD2uzv30nbXH4NQ0VX/Cq9Zvd2AEagxmeWaJQ/xbS4stNDaBttBgOatnIHUxEQTsoaTvldvcwQsBMHQJPYpRQcGa4HaYjXnlBhMD/glm/hbmARVNMj6BD5O8oJIB82WkomfS9braAKpB7A6w4nBkLSniuUJL9zvV5DpJflo1TkQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784191081; c=relaxed/simple; bh=odShkOaICLyJhGyMzAqUXfcvc03fIy2kAkkmXUoohaY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bimkvA1GLlSDOoOStFPL2DSsfsGtZ1VTJ2tSWUtGEfC0CxMHJq6Y9WJphKoEPlsxzzbnaTC+Ll/PhYAb9wErCMg70O6TN/ibxlN2xTbl5AHoNCPXBSEUMzlBEF/tReSHKVdXLn2mvonWMIbMFbCcOTcngHZALpEcqpRBS7PYqVs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TliY/cpP; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TliY/cpP" Received: by smtp.kernel.org (Postfix) with ESMTPS id 48031C2BCF5; Thu, 16 Jul 2026 08:38:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1784191080; bh=odShkOaICLyJhGyMzAqUXfcvc03fIy2kAkkmXUoohaY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=TliY/cpPaR1Is+NyKvaVjvN1lppgV2S7/2/JGiQiWH5cDxbG3Nk+P/hbJyRH7F2iP leX6JhUf3yLkaRTu29mimXu9eTnQyJVotpZpcig0LgYMXvcv5W9PiMTVoce/eHRQsD 1kz6XdhWvCHA9z6p0TKh9nkU1/S6NBndviEsSIBYSyjkg6nCDJNsK2+lKb0isVbcn4 tjkmwaZNXRShL/6z6kWg2p+m4bwUQc8e/djXrG0bJ3+/kK2il8dmZ7PRhH+Q7U4gkU WjAm9TPrtq1g26ruOYNycvCoWlxUMbeiEAu0SR1xhLJx5m/FgJjrKk/cjFSWgSkkx9 ySCOtZ/YCtf8g== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2843DC44514; Thu, 16 Jul 2026 08:38:00 +0000 (UTC) From: Jahnavi MN via B4 Relay Date: Thu, 16 Jul 2026 08:37:44 +0000 Subject: [PATCH v4 2/7] rust_binder: Implement BINDER_DEBUG_USER_ERROR for freezer-related operation Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260716-rust_binder_debug_mask-v4-2-3d7436c2d2f2@google.com> References: <20260716-rust_binder_debug_mask-v4-0-3d7436c2d2f2@google.com> In-Reply-To: <20260716-rust_binder_debug_mask-v4-0-3d7436c2d2f2@google.com> To: Greg Kroah-Hartman , =?utf-8?q?Arve_Hj=C3=B8nnev=C3=A5g?= , Todd Kjos , Christian Brauner , Carlos Llamas , Alice Ryhl , Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Trevor Gross , Danilo Krummrich , Daniel Almeida , Tamir Duberstein , Alexandre Courbot , =?utf-8?q?Onur_=C3=96zkan?= Cc: linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, Jahnavi MN X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1784191078; l=4969; i=jahnavimn@google.com; s=20260702; h=from:subject:message-id; bh=UfyiXS9trfI9iQd4i5+rrLa2l3J3zKA1b1RhZsQegXY=; b=9gRkcoVT2fuP2u/CcvQV6K3KAQVEnZd/EsaUFflrQTCqAQuEwWo4DHaaSltg4Wx+j37bM2eLd JgUQc/kI9jTAudPA+3lblUUQqPrsrDcpPFk2PSOj1WKZrdLLFTzIQL4 X-Developer-Key: i=jahnavimn@google.com; a=ed25519; pk=9aLfw3FepTOJwTS7jRXm7pDH87eBeZMXBPrqwU0//RE= X-Endpoint-Received: by B4 Relay for jahnavimn@google.com/20260702 with auth_id=849 X-Original-From: Jahnavi MN Reply-To: jahnavimn@google.com From: Jahnavi MN This adds dynamic debug logs for: - Requesting freeze notifications on invalid references, duplicate cookies, or already active registrations. - Completing freeze notifications that are not pending or not found. - Clearing freeze notifications on invalid references, inactive notifications, or cookie mismatches. Reviewed-by: Carlos Llamas Reviewed-by: Alice Ryhl Signed-off-by: Jahnavi MN --- drivers/android/binder/freeze.rs | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/drivers/android/binder/freeze.rs b/drivers/android/binder/freeze.rs index f43388ed6ae2..318a9d2bb261 100644 --- a/drivers/android/binder/freeze.rs +++ b/drivers/android/binder/freeze.rs @@ -189,12 +189,15 @@ pub(crate) fn request_freeze_notif( info = match node_refs.by_handle.get_mut(&handle) { Some(info) => info, None => { - pr_warn!("BC_REQUEST_FREEZE_NOTIFICATION invalid ref {}\n", handle); + binder_debug!( + UserError, + "BC_REQUEST_FREEZE_NOTIFICATION invalid ref {handle}" + ); return Err(EINVAL); } }; if info.freeze().is_some() { - pr_warn!("BC_REQUEST_FREEZE_NOTIFICATION already set\n"); + binder_debug!(UserError, "BC_REQUEST_FREEZE_NOTIFICATION already set"); return Err(EINVAL); } let node_ref = info.node_ref(); @@ -202,7 +205,7 @@ pub(crate) fn request_freeze_notif( if let rbtree::Entry::Occupied(ref dupe) = freeze_entry { if !dupe.get().allow_duplicate(&node_ref.node) { - pr_warn!("BC_REQUEST_FREEZE_NOTIFICATION duplicate cookie\n"); + binder_debug!(UserError, "BC_REQUEST_FREEZE_NOTIFICATION duplicate cookie"); return Err(EINVAL); } } @@ -267,7 +270,11 @@ pub(crate) fn freeze_notif_done(self: &Arc, reader: &mut UserSliceReader) let mut node_refs_guard = self.node_refs.lock(); let node_refs = &mut *node_refs_guard; let Some(freeze) = node_refs.freeze_listeners.get_mut(&cookie) else { - pr_warn!("BC_FREEZE_NOTIFICATION_DONE {:016x} not found\n", cookie.0); + binder_debug!( + UserError, + "BC_FREEZE_NOTIFICATION_DONE {:016x} not found", + cookie.0 + ); return Err(EINVAL); }; let mut clear_msg = None; @@ -277,8 +284,9 @@ pub(crate) fn freeze_notif_done(self: &Arc, reader: &mut UserSliceReader) freeze.num_cleared_duplicates += 1; } else { if !freeze.is_pending { - pr_warn!( - "BC_FREEZE_NOTIFICATION_DONE {:016x} not pending\n", + binder_debug!( + UserError, + "BC_FREEZE_NOTIFICATION_DONE {:016x} not pending", cookie.0 ); return Err(EINVAL); @@ -307,19 +315,31 @@ pub(crate) fn clear_freeze_notif(self: &Arc, reader: &mut UserSliceReader) let mut node_refs_guard = self.node_refs.lock(); let node_refs = &mut *node_refs_guard; let Some(info) = node_refs.by_handle.get_mut(&handle) else { - pr_warn!("BC_CLEAR_FREEZE_NOTIFICATION invalid ref {}\n", handle); + binder_debug!( + UserError, + "BC_CLEAR_FREEZE_NOTIFICATION invalid ref {handle}" + ); return Err(EINVAL); }; let Some(info_cookie) = info.freeze() else { - pr_warn!("BC_CLEAR_FREEZE_NOTIFICATION freeze notification not active\n"); + binder_debug!( + UserError, + "BC_CLEAR_FREEZE_NOTIFICATION freeze notification not active" + ); return Err(EINVAL); }; if *info_cookie != cookie { - pr_warn!("BC_CLEAR_FREEZE_NOTIFICATION freeze notification cookie mismatch\n"); + binder_debug!( + UserError, + "BC_CLEAR_FREEZE_NOTIFICATION freeze notification cookie mismatch" + ); return Err(EINVAL); } let Some(listener) = node_refs.freeze_listeners.get_mut(&cookie) else { - pr_warn!("BC_CLEAR_FREEZE_NOTIFICATION invalid cookie {}\n", handle); + binder_debug!( + UserError, + "BC_CLEAR_FREEZE_NOTIFICATION invalid cookie {handle}" + ); return Err(EINVAL); }; listener.is_clearing = true; -- 2.55.0.229.g6434b31f56-goog