From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f73.google.com (mail-ej1-f73.google.com [209.85.218.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 5408638946F for ; Thu, 29 Jan 2026 10:35:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769682955; cv=none; b=kSB/7z6eKZNxcZhSgbEFz+2okRyFf096cfnG4Eysk1EZ+u6sqZItVBMkevhRHCk0CSj/DXHH9Vif12y2iuqiNIJAjDvPbwBN1fw/BmuyxVX0oP19y4cNbzzWPD0oi4s/886CPHGOQaaNPqh7fx67lVxIVp2S0R+QcwGXj2an0c4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769682955; c=relaxed/simple; bh=88rgdZSyKAnfp7yiLyRlY9WcBAjwzMxKJ2py/cspLr0=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=ZTMoAMQu/jhWwlR8YcZ1vPhGc2V13s0TETFHG8CE2YIbZcNXPdcomLry5VLKvmVPZF2fiA7xuQ0XIPZdAF9X5x69EmMN3GU0yoywKXR7M3LlQzGe1ws89Im0U7rCug4PrJ5he2qSvX217kxh5al/PBVeg1mZxGBsMNFyjoM9ocs= 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=vXkua6u5; arc=none smtp.client-ip=209.85.218.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="vXkua6u5" Received: by mail-ej1-f73.google.com with SMTP id a640c23a62f3a-b8839f45c3aso107117166b.1 for ; Thu, 29 Jan 2026 02:35:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1769682953; x=1770287753; 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=VMFX5uZYfGZZ6qnEeaBHfR2E/C6s4tynd/ZlTIWJ++o=; b=vXkua6u576fjxY7wqIrLsSC67PWf0OMedpz7BJ9l00wSL8TiiGMrGB57UFlGoJrD0d MCIEaVneIXfC0m5805YDkgiJjl5mNaivNdaPxxo6gWxVzymS6ZLctv2fuDzj2/oEr2sR nrW7g9gIXLhpfdRCpaVR5BD4Yu1kjCYQN0giN05Km9CKoPXnXKJOHPtYUqOfPVpWu8Hc YU0nKPRyQjbuyGvU2Y6z25Czg3hkbFuW1ATBt5MJPy36YCADh6RkksQTGgkh1Hb7ZWJ4 olFEHmIl3o/Fyomj2ZDESjGVj9I3uf0/Db6LudEzdj41WJAD35dx3XRD1SU2858czRnp jDwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769682953; x=1770287753; 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=VMFX5uZYfGZZ6qnEeaBHfR2E/C6s4tynd/ZlTIWJ++o=; b=NLISW028lpmeExYXLGGOajpn+MnVDr0P5nKr0yhQezx9+xnAk1J2F5H4eYtaiP5B6S CfuX+dyi4YotBsJvgorjifF+Yztdo/F7VcODO9h11G4omWVLkfyPlSx5K7DynRD9R2Gn 8MWGtwtYvDJ546HPlO49JIA3uYlYz8pp9wpmZGmjYaLgSWrD65ekNsRpcYpsqL/EkMVd eqkp14+s0LGcC8ApRGnd2dF6gP44gisS8rfhl325otW7tS0b3ZgpW7+p3psnqUAJm0mA 4Q7PSOr4Dqn1gqJH1Laxj2nGw6eyHYSFhMhMR4n+BtJJKsP6//lQtuM1dLteIJJ5JPQe IF2Q== X-Forwarded-Encrypted: i=1; AJvYcCVuhZvL+g39hqC05YiS+i8Kz0SfSB//de/3aQBvla4j5H6/qtVUWEPrGJxG3Aud8kVj/lnQ3cdf4ZfCTEo=@vger.kernel.org X-Gm-Message-State: AOJu0Ywhspweuo5s3rWOEznsdAetaA6HL3m31cxk7EF4WTTJQ56SH3Vl V4OeneEMDm18l61lRJJRwCy8Gt0huobWmNqDIg74CgBOYoL1fDNxbwnIxm3sHgvnPjzBeXtw2jX VNnTspL1kxJyDKVJg8g== X-Received: from ejcxk12.prod.google.com ([2002:a17:907:d80c:b0:b8d:e244:8f2a]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a17:907:720f:b0:b88:317a:3f40 with SMTP id a640c23a62f3a-b8dab33ae13mr542441666b.38.1769682952487; Thu, 29 Jan 2026 02:35:52 -0800 (PST) Date: Thu, 29 Jan 2026 10:35:51 +0000 In-Reply-To: <20260129084119.32994-4-jongan.kim@lge.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260129084119.32994-1-jongan.kim@lge.com> <20260129084119.32994-4-jongan.kim@lge.com> Message-ID: Subject: Re: [PATCH v2 3/3] rust_binder: handle PID namespace conversion for freeze operation From: Alice Ryhl To: jongan.kim@lge.com Cc: arve@android.com, brauner@kernel.org, cmllamas@google.com, gregkh@linuxfoundation.org, tkjos@android.com, ojeda@kernel.org, boqun.feng@gmail.com, gary@garyguo.net, bjorn3_gh@protonmail.com, lossin@kernel.org, a.hindborg@kernel.org, tmgross@umich.edu, dakr@kernel.org, yury.norov@gmail.com, vitaly.wool@konsulko.se, tamird@gmail.com, viresh.kumar@linaro.org, daniel.almeida@collabora.com, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, heesu0025.kim@lge.com, ht.hong@lge.com, jungsu.hwang@lge.com, kernel-team@android.com, sanghun.lee@lge.com, seulgi.lee@lge.com, sunghoon.kim@lge.com Content-Type: text/plain; charset="utf-8" On Thu, Jan 29, 2026 at 05:41:19PM +0900, jongan.kim@lge.com wrote: > From: HeeSu Kim > > Port PID namespace conversion logic from C binder to the Rust > implementation. > > Without namespace conversion, freeze operations from non-init namespaces > can match wrong processes due to PID collision. This adds proper > conversion to ensure freeze operations target the correct process. > > Signed-off-by: HeeSu Kim Overall looks good, thanks! > +/// Convert a PID from the current namespace to the global (init) namespace. > +fn convert_to_init_ns_tgid(pid: u32) -> Result { Let's use the typedef task::Pid (of bindings::pid_t) here, so you can avoid the `init_ns_pid as _` cast below. > + let current = kernel::current!(); > + let init_ns = init_pid_ns(); > + > + if current.active_pid_ns().map(|ns| ns.as_ptr()) == Some(init_ns.as_ptr()) { I'd like to avoid comparing raw pointers for this. Perhaps we should just provide an implementation of `==` for PidNamespace that compares the address? Alice