From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (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 C2E821DE8BE for ; Mon, 27 Jul 2026 19:24:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785180292; cv=none; b=cL8abW7oO2XQa462kVr+j0+xEgBpBGhgDyoULXMBXPTUQSRgMbyl3SxEhUhBXMleLbenoz/YXQ2wF+GFdogpCsdFQ0Zk985l8kEGPv18MdwMxInHegayOL65ezJleXI35m8QXK+u/ZxW0/yar+KfAKJdQPfxfG9oCUg34O7mA0c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785180292; c=relaxed/simple; bh=J8xfgP9hEfTcL5HLwMcdAyzynD6LkxGko0WlTarX4/A=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jS4UvDAXTKj8l4ECEqATenqLGlUYD4Vj0DVOwjgGuwIfiqJK05yqFxbD373KCcGYjooHs9rkKhN5J54RG5C0zhuZewvgJC7ZiNIVJkhQAABD/C1kkRKDdcC+KCEQhqFD+/Y5wYT95LPHd6wXrG1Dh9f0oheBOoETL8imx9tUdbM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=KF4ZuNHN; arc=none smtp.client-ip=209.85.214.175 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=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="KF4ZuNHN" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-2cede6375caso29575ad.0 for ; Mon, 27 Jul 2026 12:24:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1785180290; x=1785785090; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=zJFdpBhBp0OM8gJ3Y2wEmdgykqIsz6w3M3NCrQc35F0=; b=KF4ZuNHNHtIIFYIPiHzGOUV7VMYLAYid97t1X3Od+wK2DGKeMjYVd1CHfTfLpswIbW Cq2w7nPjiLTroDDrPD6gs8JD/cehMImru5hViQWgRVaLsKr2H+SqwIIICBJH7CmM5mJB Ft8923cO2gfbwY3U0k9uNo6Qugw+CyeSTSPK3GPqdUI13AvxgOMFO9/7au/gjxAY9o4G 7k73cWiCU7DqWMN0Xo16z8x5S9nL3E7ar+zKoW8T0mOSumWyXXcIC5GZxWyBoE/HHztt QTQxxIGWknhTerD3ViUxXT/colXqQHmtoDkAs5SkHKLNoLUA2+nxJT6vBMl/YFJ1v3Oa ZfNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785180290; x=1785785090; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=zJFdpBhBp0OM8gJ3Y2wEmdgykqIsz6w3M3NCrQc35F0=; b=BBGbbfqrCvS5suTxUMPglUkFZVbkyw8Uh9uam0U5PanDSVLNfLAU4DxSbnij9m25a6 spc1tLNXJJgzJyfI8HoKRLid8UWrWGAPLE8wBt4BV0TY5q2+gLk5Mj1CO7ByOE5OfLiz Q3cIVwRTKlSVv+RQjRWZIIGw90czgwHo/nIa1lUhPwkeIgFjF751iD4ZMdMhHuA1P0UV fml95DId5kknOAfoxIY2EPmaWkv0Zu1u3ipH86mrlSDZhbYVRvwnoACO1tv7OzM3dLgm tyDxPJB5xoQXi7BXjMJxIN2di/VD/1SPSNtyxgyYkiRPXiTz3L5c4qo0xePC/ee4tQMu vrKw== X-Forwarded-Encrypted: i=1; AHgh+RrF+++KGxRQ1uMcijmYex0fr06NVETIk+UBJYwrWH1JlWjrL0rqzANEysaknRyyyRM7lCQElXNH8tZXCB8=@vger.kernel.org X-Gm-Message-State: AOJu0Yxq41YrLkZRrgkKRuWY2hwV9w+ijNzrn7JG3AvlkOimudRGSlrv sYasdZyhkbFvCuR8c8g8+CV9dqXVWSinWsRUeSP7eK+BrHTHBjRaQVt75RxO6wHk7A== X-Gm-Gg: AR+sD12GSxHBNHwbPNs2x+rnC3TOdhg0v1G4K1IzwhYRV3sftFfUmQdv/v6xtZVWx+D 1/pO7FRf8zLqCRlRW0nApLhdt8mj47b0RU3RMEafF9UMKKSlcce2Ov5EGrPf11dbtKbbOeT2soT 3at9KY0qdSr5gCCG6GvwqO/HJP7sBLQ/+kchOS1ivhAmXFHMnRJuGHx6mkc6STa/jrj7gquKDjb KxYU7M+PsRXiikGqK8fy9q92Lk6agwgGmSNE2MriXaP7pFGmPj0Uj6wV33jdwZDnmIVuWOnplL4 Hw9SoMwFUcRJdm1Glt6TIUshtRglIgJb4suV56LE2FwjGbDRDq+mBSCQn99Dgz2c2P8LccZMFW5 IHS0k3MWhX0m8xInLyqf85HFGBQIaVKhgI5ZrQzl8f7GIO3a1HlnTgnSbPCZ6VNB/ziWnGetv8N 8lqVFMhaljZ0Rkc6sNHjl7AbQerpzec1FXYcDDC8yjFhH3ubImCj5YKa0uZRjTL4/BdFGA6IxBB LEikNL3uzvgDhMoumquIggjxg== X-Received: by 2002:a17:903:1c1:b0:2cf:41ba:96b8 with SMTP id d9443c01a7336-2cfdb5cc713mr18629365ad.6.1785180289443; Mon, 27 Jul 2026 12:24:49 -0700 (PDT) Received: from google.com (193.67.125.34.bc.googleusercontent.com. [34.125.67.193]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84e533ce1f7sm3446224b3a.34.2026.07.27.12.24.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2026 12:24:48 -0700 (PDT) Date: Mon, 27 Jul 2026 19:24:43 +0000 From: Carlos Llamas To: Alice Ryhl Cc: Greg Kroah-Hartman , Miguel Ojeda , Boqun Feng , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Benno Lossin , Andreas Hindborg , Trevor Gross , Danilo Krummrich , Daniel Almeida , Tamir Duberstein , Alexandre Courbot , Onur =?iso-8859-1?Q?=D6zkan?= , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] rust_binder: do not query current thread for all ioctls Message-ID: References: <20260727-binder-cur-thread-v1-1-8edf2b64e235@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260727-binder-cur-thread-v1-1-8edf2b64e235@google.com> On Mon, Jul 27, 2026 at 12:28:59PM +0000, Alice Ryhl wrote: > The get_current_thread() method is currently called for every ioctl to > ensure that a Thread struct exists for the thread calling into the > driver. However, not all ioctls require a Thread object, so this means > we are unnecessarily creating these objects in cases where we don't need > to. If said thread does not invoke BINDER_THREAD_EXIT on exit, Binder's > Thread struct stays around until the fd is closed. For long-lived > processes the Thread object is effectively leaked. > > Furthermore, when the BINDER_GET_NODE_DEBUG_INFO ioctl is invoked by > libmemunreachable to ensure that objects reachable only through the > Binder driver are not considered leaked, this is done from a fork of the > process owning the fd, which means that it fails the group_leader check > inside get_current_thread(). This results in EINVAL errors for this > ioctl, causing libmemunreachable to report a false positive memory leak. > > Thus, do not invoke get_current_thread() for ioctls that do not require > it. > > Signed-off-by: Alice Ryhl > --- LGTM, Acked-by: Carlos Llamas