From nobody Fri Apr 3 11:13:51 2026 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.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 52A9329CE1 for ; Thu, 19 Feb 2026 13:52:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771509161; cv=none; b=EddlpoAmnADLWrD645EWtW0YQEqLfImBK03tQ7F7ZfQ65CAnOEcrVSupgMXOvq2NcBQD875Ah0LD3w5fmWie77nwbl3/+2JpI26whpgFQXRYhSB+giKVnocCTbcvvy0pvl6jydSobdUaVc2lSSaLY0ayHBSyf/TxhhrhOUexVAY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771509161; c=relaxed/simple; bh=4JkND1FpXVW3ETByYdyu09j/paImfIwZMIzFFcN6Nck=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=T0dFXC8k3RaURFpdp+zWFaHl8PuY+qGX/DWEjEFGtcNY+znVCaFJ5C6a8Lihlkslsto16bJ9XKCQsnrwcm+dIMBssvMACSDwFQjs7d3fZnAqLGJrY236cWtV00kvJRjlqB0q5KBQoBf3g3/Rf5Tx50jrLKPGH4VuetvE7N6ztWE= 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=1yaEIrFT; arc=none smtp.client-ip=209.85.128.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="1yaEIrFT" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-4836b7fbf4fso9292015e9.2 for ; Thu, 19 Feb 2026 05:52:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1771509158; x=1772113958; 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=/dntFHcpqkB/5crSkMLy+P+Y3QedvoFL3zjHA9Suyc8=; b=1yaEIrFTQuBUe8cegb6Y3DyMWE6utU9brB7Yr1DOBXLhKd2LWDIHB02+doJwOaYDst dHFeVgIdeh9WVZHpueRtiW1r7RSTAgIXXSUjLqIo7qHdWRZ7qxjQ2O0zETNmBH6KhGXy 5urB2R8QGThccw3LvQgqlLFEu1O45JQ3XECp2QzC5uEmsurv43srwXdsSiTMD3WfuEt0 wEOevOokISbhCe6X/D9c+mG9N0YRiHUWayJIff6joBaCNPGsozCAD3DCNquE9Lcsoj/2 XmIGivmP7rQXfAF2SxMHe78x8eAcgwNl8XxLohPAoG6isX3iRwKRo2awGd+NhiXIAM49 y49Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771509158; x=1772113958; 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=/dntFHcpqkB/5crSkMLy+P+Y3QedvoFL3zjHA9Suyc8=; b=GIPFLuepjR9Govs4BnJZ06S/xkOBBbzuLvY3cf1AcQ9ejJO3A7kRaMsu5mHBD+ZcFb jBngHr2LUAaOIaLLt7zMiWAhmcQ+feLyEPAnYrv45cI2J201DG6NELLeehCSkBrPlXmw AwJdAysLR0/+5wRrQmmprNav6tBIfzGlqg8CusBuQdPMkbToIyzuk3K3/0vPtSNELWZB rnCiwf9oqyILTVH0YjzsVujCWYWtu1X8JTU+tqL7VigSjYcV12fTQ7NsGY+E0/Orc2Zy mAxyo64hk1iNejK2bDjnCKSXc0gzpOLAMJVGirLjUGBCGSgKxnRtUiQpblzIcxKAX6OC Irjw== X-Forwarded-Encrypted: i=1; AJvYcCVgEj78e7rfB0Vj6cl3VXlrE4fI046sDmj+4zlQix7QagtDU1tbgKoI11wKFGVWkCrs86dxG8jSqC6Sy4g=@vger.kernel.org X-Gm-Message-State: AOJu0Yw48UfVxZlRJgg0mVmQG7ZOfig3SqIw/FSOZPIpDDIwu1kl9Rga EZ0OB3rHZ5YF2BZ1nPwoF3Boi2rjsIulRdsUuu2yjTYG+g2VcM8DQtwTBpRizX4Hll6MFbS34nD 5+jn2DrSGxo3X0A5NYw== X-Received: from wmpe37.prod.google.com ([2002:a05:600c:4ba5:b0:481:a662:2ac8]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:46c7:b0:483:7ce6:1efb with SMTP id 5b1f17b1804b1-4839e6614c4mr42385265e9.17.1771509158453; Thu, 19 Feb 2026 05:52:38 -0800 (PST) Date: Thu, 19 Feb 2026 13:52:34 +0000 In-Reply-To: <20260219-close-fd-check-current-v1-0-fcab8d8469f5@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260219-close-fd-check-current-v1-0-fcab8d8469f5@google.com> X-Developer-Key: i=aliceryhl@google.com; a=openpgp; fpr=49F6C1FAA74960F43A5B86A1EE7A392FDE96209F X-Developer-Signature: v=1; a=openpgp-sha256; l=1257; i=aliceryhl@google.com; h=from:subject:message-id; bh=4JkND1FpXVW3ETByYdyu09j/paImfIwZMIzFFcN6Nck=; b=owEBbQKS/ZANAwAKAQRYvu5YxjlGAcsmYgBplxWjlOM9j0uWGwX82m/HbXnv/pEb/CH+LuE9E rKdZKHWSwOJAjMEAAEKAB0WIQSDkqKUTWQHCvFIvbIEWL7uWMY5RgUCaZcVowAKCRAEWL7uWMY5 RsvWEACiLxND1kBa33oliayMGh7/gaVhLf2eXfsxrk/fXfCbOFxQoixBvJjoXct3FgiiL66TIrz cDv/YQRQMWT7Bw5djCbS8ORtHrZIuFd2hMo4fOy8V9wKni+gNWY5SilWBdnY50+qAX7rHfCXzz7 qXNEOGfcOj0HE0c0H2zDuLGv7pwpW9qCJujLrFcdHsc6yN9OERwc8vwe5seUJLpWC24BjAdLu4C R6FtieVtADBxCtdWl3Z12wzhjzNP7srYPyQ2efSGEOrIuUE0XrCVB7KAJ1hnLSgXMRdhuTXcTAC xW2m1Z8aAYD+aRpTQlfuyIiJp5L/OG22C69QRMBizjIgAalcILpsnTksyY2/MOEx7pQUb6avJ7J PX1vgqaqpmp1upQCci7ErWLQ4sJ5bvIlkx80+wwH31F/q1ty9rCD10dgXmVYjk8oywU38p936gX H+56dt3np7YCc+8nfkAvfa6EXvQwL+dJ/HYdSrmU1yCQxKKk+ANfa0BC5o5iVW0VhdGSXMi7NlN X6mKQ1Q8bfjCtkCdhlQiydPm8ViJsrns7VnvrEe6qLqQVnFQ0OC7Z0PfG5TbEe8ciYxc7uG69hv wgCUFeH+LYle4hcL0ezSntqy5HYKPIzSMPZuPIHM3LDM7GeQMnhBibbiyR5a+X9rTk5ftM04uxi jGRZAIWSudX5BOA== X-Mailer: b4 0.14.2 Message-ID: <20260219-close-fd-check-current-v1-1-fcab8d8469f5@google.com> Subject: [PATCH 1/3] rust: sync: implement == operator for ARef From: Alice Ryhl To: Greg Kroah-Hartman , Carlos Llamas , Miguel Ojeda , Boqun Feng , Gary Guo , "=?utf-8?q?Bj=C3=B6rn_Roy_Baron?=" , Benno Lossin , Andreas Hindborg , Trevor Gross , Danilo Krummrich Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Alice Ryhl Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Rust Binder wants to perform a comparison between ARef and &Task, so define the =3D=3D operator for ARef<_> when compared with another ARef<_> or just a reference. The operator is implemented in terms of the same operator applied to the inner type. Signed-off-by: Alice Ryhl Reviewed-by: Gary Guo --- rust/kernel/sync/aref.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/rust/kernel/sync/aref.rs b/rust/kernel/sync/aref.rs index 0616c0353c2b3b4d8b3be6c4b8156995a2f1d504..f56598a847e949b497f4cf2a05a= 7298a58a0ccef 100644 --- a/rust/kernel/sync/aref.rs +++ b/rust/kernel/sync/aref.rs @@ -170,3 +170,26 @@ fn drop(&mut self) { unsafe { T::dec_ref(self.ptr) }; } } + +impl PartialEq> for ARef +where + T: AlwaysRefCounted + PartialEq, + U: AlwaysRefCounted, +{ + #[inline] + fn eq(&self, other: &ARef) -> bool { + T::eq(&**self, &**other) + } +} + +impl PartialEq<&'_ U> for ARef +where + T: AlwaysRefCounted + PartialEq, +{ + #[inline] + fn eq(&self, other: &&U) -> bool { + T::eq(&**self, other) + } +} + +impl Eq for ARef {} --=20 2.53.0.335.g19a08e0c02-goog From nobody Fri Apr 3 11:13:51 2026 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) (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 9D7F633ADAA for ; Thu, 19 Feb 2026 13:52:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771509162; cv=none; b=pgx6ciW5iumOqrzfZH3fB6FxLol9oqyFUtdbQHWzib+hK6TAllwY8rQDS63myHSd5oVAcI1cSGv0PeOPVAQoPtxgQSH+G8N3jOm4sKtACKlsWRbUJXJRiOT4BWlpe0IYh05/5pydb0N5AYiAsQqnrY5AyNXtIw/LQrAetyIHVr4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771509162; c=relaxed/simple; bh=mWee6xZrNfTmTG2KRqcPJ0MteR3hR2HE+2W5ZnHhDC8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=O+QuKeQtiD0qHSZDyaTBWgGrmh60NZkOOluo1hMpFggQGYSNfR13V0QLsFAFOIyb2c9mg4+Wbb28MIrxtGl/BUTLTeRDgFO9uoknrmmwKX3dmIGrSYMr+ONBCQWNu/nCjQ3qG0kHXbLYiBwQiQo8BrzgvNQ75nkQUypg+3DjZaM= 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=4iS6DbEy; arc=none smtp.client-ip=209.85.128.73 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="4iS6DbEy" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-48069a43217so8885105e9.1 for ; Thu, 19 Feb 2026 05:52:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1771509160; x=1772113960; 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=9/dw7/PhVES54kaBIEy1CnzvyX9MJDcWWxJs4k9jghM=; b=4iS6DbEyRXTYi5lfzyRRXGf2kPfzEihmNXDXkZQG5hOcCD+L3SI/VMLADqWAulQglw rDvRZZGiQidPqF3Ig9Kbso+NO4h7E3QS2D/02J+yTLokRBsEtNKYqUCBrUpgK2/ujBX4 TKi0nO1UYp+hCC6Fv+bpMeIhTxqjzMvU1xedSbPtwfDGCY4nUM//lenQvBT2bNxMJlTg 2IJ8ScvUEceQoIjd1P4RIUmMps0yg3EBsJjCvbkgd7GFyHq3iiW7tg7zg2nJKcjBQJy+ qH3ec/WTZgrclLLn4mcCJdHdfGN5J0PdCl88uKmx/d5ZRIX2NqHL1Chd0BuxhbKOs6Vx uCFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771509160; x=1772113960; 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=9/dw7/PhVES54kaBIEy1CnzvyX9MJDcWWxJs4k9jghM=; b=qUq2yeCgHd3sFprvPf2GQdlhqtg3OS2vOkqgo9LERueBGYFB5YuroUmMYUA2VQqHO6 4CHn8avUN0kwYYSKbNLZHkCmMKrzIE59K/XkrjOUTZCLV2npMsRkp3NZzmaoVZ8AogTe LDQYnOLE4oPeHaEycMUm2I/wIgnPq5W1uksgfaDRGesoU5eGtI4nIu7TDuPhqqx8D97u /zMR06dhFGQIXEc01pSG860VqZQo3VPnI/rhtGuoPOXo2HlmQs1cHxUHqo4Nqc9YIfxu ht1mZWwzIPO2BBSb/na4pcgLuAFeAiBhVgfvrpMrhHh6eH9ZAznU1r/KMBBGx5p+mf3E y/vA== X-Forwarded-Encrypted: i=1; AJvYcCWp7uZj4gn/zOcXqb9khhPCQP6X/BHrUKHa2N3Vkqxn9AuBxJFzJN61cqp4Y08LFlAJZq+a0W1hMcjqV0E=@vger.kernel.org X-Gm-Message-State: AOJu0Yy8NLEoZgyqDEMnzy4L8QsDY0W/iLL7fFOTEiegZ6aPKfgYd8AM iodziWWaa1PhfOCR40svd3ZZQahw4zUUUN0twok1Z5kfjRINwrDAYe4O/gnO3aFkRvyETl4lAtd K1Bkz6oD/74Ajscte2A== X-Received: from wmdp17.prod.google.com ([2002:a05:600c:5d1:b0:483:291c:7f23]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:548e:b0:480:6dff:e786 with SMTP id 5b1f17b1804b1-48379bff816mr295884705e9.37.1771509159855; Thu, 19 Feb 2026 05:52:39 -0800 (PST) Date: Thu, 19 Feb 2026 13:52:35 +0000 In-Reply-To: <20260219-close-fd-check-current-v1-0-fcab8d8469f5@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260219-close-fd-check-current-v1-0-fcab8d8469f5@google.com> X-Developer-Key: i=aliceryhl@google.com; a=openpgp; fpr=49F6C1FAA74960F43A5B86A1EE7A392FDE96209F X-Developer-Signature: v=1; a=openpgp-sha256; l=831; i=aliceryhl@google.com; h=from:subject:message-id; bh=mWee6xZrNfTmTG2KRqcPJ0MteR3hR2HE+2W5ZnHhDC8=; b=owEBbQKS/ZANAwAKAQRYvu5YxjlGAcsmYgBplxWjLZnhuH1LUcU6+gseK6xv/kT5aqHcma7R8 J5Kyudt5K2JAjMEAAEKAB0WIQSDkqKUTWQHCvFIvbIEWL7uWMY5RgUCaZcVowAKCRAEWL7uWMY5 RiVSD/sHrBtkt90WXfWzafS0bwjeOdEY8LOF29cEgZ2p/2F+Vmg54NPY1UW5p68t8vSU7Geh/V7 wbPEgObFCQndSeqOKValgBrWP1bwLDlGi2TK6aVC2uYpLmW500iSs++AshkllV2BWMdL7/oc2Hx ldhLl7LHZaqcOpimJv5pO53y9STMfQg2Jc5Gjd79CrMq+CTY2XJKeVG6pYFkv9gbEysDbYfHKcJ GrEQOnQFoqsHbrndDpGS5Qhpnx81zgL5cAetm43m+DRRfi8FP909j1/viwrBO08kbYDgxQ314H9 QYMFakXCTmDcb9X2XFwMoWMaLjbePb3Vhc17SUR+juCG8gmTCxaA1b+lqze8hthN4lnL1tF6oLg ovF50wJse03fssYePt0vP9Jtvq58sHRVb6aySocZRtRA+eBiSKMZXsignZ0Ba8u9HMDwwhfszA/ DKYe1uypskkohonxHeFBhPAoDCCCj9qJmeKx1+ZdoxK7gQGJX5mA2SuPKstNJuJA56i5Zfcgxwk cZuOdlcgW7C1Ee79xJoWpX2Ar9o3+tUE1tKzprwM+qnfXqD0dJW2LTFWqwQLL3bR84v0vO6EIms 7EICXVHzUw1rjVnpUAoe6jqRmqvITyEZvBrN4gP7ELKy7ZUA2cGsi9oTYJ6ciosLXzu5sG01NDX cz4DNsmgtbhX1/g== X-Mailer: b4 0.14.2 Message-ID: <20260219-close-fd-check-current-v1-2-fcab8d8469f5@google.com> Subject: [PATCH 2/3] rust: task: implement == operator for Task From: Alice Ryhl To: Greg Kroah-Hartman , Carlos Llamas , Miguel Ojeda , Boqun Feng , Gary Guo , "=?utf-8?q?Bj=C3=B6rn_Roy_Baron?=" , Benno Lossin , Andreas Hindborg , Trevor Gross , Danilo Krummrich Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Alice Ryhl Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable It's useful to compare if two tasks are the same task or not. Rust Binder wants this to check if a certain task is equal to the group leader of current. Signed-off-by: Alice Ryhl Reviewed-by: Gary Guo --- rust/kernel/task.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rust/kernel/task.rs b/rust/kernel/task.rs index cc907fb531bceea6e8dc1175d9350bd24780a3d5..8834bf25cce5e7b7f48cd649c97= 7eb92fbfb61e9 100644 --- a/rust/kernel/task.rs +++ b/rust/kernel/task.rs @@ -362,6 +362,14 @@ unsafe fn dec_ref(obj: ptr::NonNull) { } } =20 +impl PartialEq for Task { + fn eq(&self, other: &Self) -> bool { + ptr::eq(self.as_ptr(), other.as_ptr()) + } +} + +impl Eq for Task {} + impl Kuid { /// Get the current euid. #[inline] --=20 2.53.0.335.g19a08e0c02-goog From nobody Fri Apr 3 11:13:51 2026 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) (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 AD38B33E377 for ; Thu, 19 Feb 2026 13:52:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771509164; cv=none; b=BssX05s449mecMGUrgfdt+OA4JGDo11SJ5E/KYvLeYEyv7k5DLuVopiLPEs7ns6eW9slyPIAoAN9sMIJfU5DTGCUdxwBn9Q6jdfxDKyNpfzIgdiUSzQst2fBe9FOg5CpxGEDZibfPblSzSgoGRtW/R88NGjcw9PG/VRK4DRCfec= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771509164; c=relaxed/simple; bh=SFMND3DEeve6tpPjD7rNtzhxS/T9UUw/nJs8W9yZZls=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=QmckeC/VrcUHnbut2zoXOurVHDy+siKq6k8vs9d6BmVjKzat/rBdrLLSR87WBKPHBanRG4GB+WS1HmUPxhbs1vty1J1MSmynvqqap0w313hKdOA9jf5dDGzuV6EjS68p+/3IAn+7PsHlKwkNg3qOH6rehrVT9iXF9vthB5HATDw= 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=Msc0Oc6n; arc=none smtp.client-ip=209.85.128.73 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="Msc0Oc6n" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-4837b9913c9so8258365e9.0 for ; Thu, 19 Feb 2026 05:52:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1771509161; x=1772113961; 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=+RWjqSlp/CcvrD7GGLBgDCctAadn05McnuJql7rDrfs=; b=Msc0Oc6nILfLUiY5zFTD6iEkiHeLXqFmGntK5FKbh9q4j5xrchjNS/Ljt8kCc7AqK8 jWtIJCIUOFoIoU4PvmIIPxDk3Y4cbj02Apr8JWdQ9l7wynzee4sxSJ0SCKxPJnX3KjiG 3SYo1wWt34qlKotd39nUQrDrQ9GCaadrj7Jy93cxBrtEtY3TOgpqMaMc0FYepR31QM2Q Y8a3BmDBL+ReO0NNXToI8gtQ/ZHeveqriHEkk6BwQ6znG3dX/PTYzvuODpiFyX5rx7hC mahVhcaSAoqctXN5azy4AUXYJrPcp2sSmTLlYm8ID8UGVZ3ptQlyl766FbzX0nZMQj5g xuGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771509161; x=1772113961; 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=+RWjqSlp/CcvrD7GGLBgDCctAadn05McnuJql7rDrfs=; b=w5bybcILStR7qdtq2hUMgJ6AkojHHEtb3Lqg6Q63QFA9KL1Z9+rTGI76OEn5RH6KTf QFFvoxYBo2Vm3Ntza7H+HLy/ewjDKenLZlCDgCLwHrigLfx3Zr/pw8i4Nhp3DUAdON99 SPtXffA+2Afv23RPW7FqzoXvpfOnQw+ou0gD4TOctWGZgDll2hxSOEcfsTiUl8snrK51 XNUcCpt3ljb6afJLwdsyhQa5zJfBQb9CID4851BS7pifZFHplFEwMnLqVVIsYQhwpX59 4/gDzQNEFzeE4yrUn9QkR1jQAorLCQipX4n7+Hh2bHiJW20PvdMixZom/dfkQ80vSqek Auiw== X-Forwarded-Encrypted: i=1; AJvYcCXh/p9OCL1YAR50PJYkjwPur8G8XGmEoP0QmsoJ0/g3YuUe/v6PV50hvrk6m/iqWoN5H2iYoIHbqD6G95A=@vger.kernel.org X-Gm-Message-State: AOJu0YzjMglwmDnJPSRN57YS9ZE00uZMZZ+vOb2XDjXv+am5X3TrqnnN sNdvVva/mRc7ZYgVXUhpNvA4VkA0RWPrPfhYVFR2Vq0Jv0YeEzPO8OsI+VjOmSYb3fF5g0XkbeZ +0bMWeIjgKYIVML6LwA== X-Received: from wmot5.prod.google.com ([2002:a05:600c:4505:b0:479:2d82:5535]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:6091:b0:477:df7:b020 with SMTP id 5b1f17b1804b1-4839e661d1bmr49574975e9.18.1771509161001; Thu, 19 Feb 2026 05:52:41 -0800 (PST) Date: Thu, 19 Feb 2026 13:52:36 +0000 In-Reply-To: <20260219-close-fd-check-current-v1-0-fcab8d8469f5@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260219-close-fd-check-current-v1-0-fcab8d8469f5@google.com> X-Developer-Key: i=aliceryhl@google.com; a=openpgp; fpr=49F6C1FAA74960F43A5B86A1EE7A392FDE96209F X-Developer-Signature: v=1; a=openpgp-sha256; l=1598; i=aliceryhl@google.com; h=from:subject:message-id; bh=SFMND3DEeve6tpPjD7rNtzhxS/T9UUw/nJs8W9yZZls=; b=owEBbQKS/ZANAwAKAQRYvu5YxjlGAcsmYgBplxWkA+Ihi+Yc9Z3Fxz9v5/2YwOZ5viDpD9505 zYQX1qhT/WJAjMEAAEKAB0WIQSDkqKUTWQHCvFIvbIEWL7uWMY5RgUCaZcVpAAKCRAEWL7uWMY5 RhkFEACmpbY8rMAYA/fYuRbPx9LtxpK1m31BC8sOD28hpemY7FWllIIT5iZ/KKyy/9hxzXk+ouW iEDilT0cCZF2+qBueQp1DFggHu3P/zdNM0uhn/Pug+mvU+xFOWCT1sNMiOmRCQa0DU650IroPxb JqLN3uhK0VzoNy3XUgjlFu8YbQx01vOkY2CmZ+pHPc+2C4hORack6zyhDmcPYnooI+F4uZXPASW RVHiS9erppItcbIbY4xjUUOEdRxUrugDwgdI7E7tqPtnQ6zazWHLMGAeRJiCsszDhL9tigrgMLu Brho5rG/hBVSAwvYNfl2FQxLxPYKrt3hD5QCfbne2I5j9vJtH9kBKcPwS/FIgM1T8WxT71ztpG8 3dBPOJjvXcRhtMETEQV9in3oq5vEoLJ2wEec+iRLHlKqP3rL/quT6FeB3x5twQkWBOjtDFEJTnI qoGsiq1pknaC3slqA1/4ll/n6iO05e8t13v1Sckj0TiUboTqCmGyFeJvaHTr/zCzb7lSNRG60i/ lUczaUlwN5euGi2+Suoj7fTdgf/yP+TFiRdTJE8A1Kn0Rl7ldQxsr5KCPSuHScLNBuqskkJ+HEi kzQhENxyQlQNWkdYZezyxKWRjBOSysvROsikEVVo7SgmQsuSE/y0rMJRBV0Hmicbn5GoLh32xCz zWrBfjWe3B0R4Kw== X-Mailer: b4 0.14.2 Message-ID: <20260219-close-fd-check-current-v1-3-fcab8d8469f5@google.com> Subject: [PATCH 3/3] rust_binder: check current before closing fds From: Alice Ryhl To: Greg Kroah-Hartman , Carlos Llamas , Miguel Ojeda , Boqun Feng , Gary Guo , "=?utf-8?q?Bj=C3=B6rn_Roy_Baron?=" , Benno Lossin , Andreas Hindborg , Trevor Gross , Danilo Krummrich Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Alice Ryhl , Jann Horn Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable This list gets populated once the transaction is delivered to the target process, at which point it's not touched again except in BC_FREE_BUFFER and process exit, so if the list has been populated then this code should not run in the context of the wrong userspace process. However, why tempt fate? The function itself can run in the context of both the sender and receiver, and if someone can engineer a scenario where it runs in the sender and this list is non-empty (or future Rust Binder changes make such a scenario possible), then that'd be a problem because we'd be closing random unrelated fds in the wrong process. Suggested-by: Jann Horn Signed-off-by: Alice Ryhl --- drivers/android/binder/allocation.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/android/binder/allocation.rs b/drivers/android/binder/= allocation.rs index 7f65a9c3a0e58e07a7e6d4e7d7b185f73fb1aab8..31a42738a99dd8118c21bb15635= f54ddd748787e 100644 --- a/drivers/android/binder/allocation.rs +++ b/drivers/android/binder/allocation.rs @@ -260,6 +260,10 @@ fn drop(&mut self) { } } =20 + if self.process.task !=3D kernel::current!().group_leader() { + // Called from wrong task, so do not free fds. + info.file_list.close_on_free.clear(); + } for &fd in &info.file_list.close_on_free { let closer =3D match DeferredFdCloser::new(GFP_KERNEL) { Ok(closer) =3D> closer, --=20 2.53.0.335.g19a08e0c02-goog