mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: jongan.kim@lge.com
To: aliceryhl@google.com
Cc: a.hindborg@kernel.org, arve@android.com,
	bjorn3_gh@protonmail.com, boqun.feng@gmail.com,
	brauner@kernel.org, cmllamas@google.com, dakr@kernel.org,
	daniel.almeida@collabora.com, gary@garyguo.net,
	gregkh@linuxfoundation.org, heesu0025.kim@lge.com,
	ht.hong@lge.com, jongan.kim@lge.com, jungsu.hwang@lge.com,
	kernel-team@android.com, linux-kernel@vger.kernel.org,
	lossin@kernel.org, ojeda@kernel.org,
	rust-for-linux@vger.kernel.org, sanghun.lee@lge.com,
	seulgi.lee@lge.com, sunghoon.kim@lge.com, tamird@gmail.com,
	tkjos@android.com, tmgross@umich.edu, viresh.kumar@linaro.org,
	vitaly.wool@konsulko.se, yury.norov@gmail.com
Subject: Re: [PATCH v2 1/3] binder: handle PID namespace conversion for freeze operation
Date: Fri, 30 Jan 2026 10:54:27 +0900	[thread overview]
Message-ID: <20260130015427.83556-1-jongan.kim@lge.com> (raw)
In-Reply-To: <aXs5Y3xAFKyZr6nd@google.com>

Alice Ryhl @ 2026-01-29 10:41 UTC wrote:
> On Thu, Jan 29, 2026 at 05:41:17PM +0900, jongan.kim@lge.com wrote:
> > From: JongAn Kim <jongan.kim@lge.com>
> >
> > Currently, when a freeze is attempted from a non-init PID namespace,
> > there is a possibility that the wrong process in the init namespace
> > may be frozen due to PID collision across namespaces.
> >
> > For example, if a container with PID namespace has a process with
> > PID 100 (which maps to PID 5000 in init namespace), attempting to
> > freeze PID 100 from the container could incorrectly match a different
> > process with PID 100 in the init namespace.
> >
> > This patch fixes the issue by:
> > 1. Converting the caller's PID from their namespace to init namespace
> > 2. Matching against binder_proc->pid (which stores init namespace TGID)
> > 3. Returning -EINVAL for invalid PIDs and -ESRCH for not-found processes
> >
> > This change ensures correct PID handling when binder freeze occurs in
> > non-init PID namespace.
> >
> > Signed-off-by: JongAn Kim <jongan.kim@lge.com>
> 
> > +     rcu_read_lock();
> > +     task = pid_task(find_vpid(pid), PIDTYPE_PID);
> > +     init_ns_pid = task ? task_tgid_nr_ns(task, &init_pid_ns) : -ESRCH;
> 
> You know this is making me think ... here we are obtaining a pointer to
> the `struct task_struct`, then we convert it to a pid, and we compare
> with the pid of the binder_proc's task.
> 
> Why not just outright compare the `struct task_struct` pointers?

Thanks for review and feedback. I hadn't considered that.
I will update patch to compare by using `struct task_struct` pointers.

Thanks. // JongAn, Kim

  reply	other threads:[~2026-01-30  1:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-29  8:41 [PATCH v2 0/3] " jongan.kim
2026-01-29  8:41 ` [PATCH v2 1/3] " jongan.kim
2026-01-29 10:41   ` Alice Ryhl
2026-01-30  1:54     ` jongan.kim [this message]
2026-01-29  8:41 ` [PATCH v2 2/3] rust: pid: add Pid abstraction and init_pid_ns helper jongan.kim
2026-01-29 10:32   ` Alice Ryhl
2026-01-30 11:34     ` heesu0025.kim
2026-01-29 14:33   ` Gary Guo
2026-01-30  4:57     ` heesu0025.kim
2026-01-29  8:41 ` [PATCH v2 3/3] rust_binder: handle PID namespace conversion for freeze operation jongan.kim
2026-01-29 10:35   ` Alice Ryhl
2026-01-30  5:22     ` heesu0025.kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260130015427.83556-1-jongan.kim@lge.com \
    --to=jongan.kim@lge.com \
    --cc=a.hindborg@kernel.org \
    --cc=aliceryhl@google.com \
    --cc=arve@android.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=brauner@kernel.org \
    --cc=cmllamas@google.com \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=heesu0025.kim@lge.com \
    --cc=ht.hong@lge.com \
    --cc=jungsu.hwang@lge.com \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=sanghun.lee@lge.com \
    --cc=seulgi.lee@lge.com \
    --cc=sunghoon.kim@lge.com \
    --cc=tamird@gmail.com \
    --cc=tkjos@android.com \
    --cc=tmgross@umich.edu \
    --cc=viresh.kumar@linaro.org \
    --cc=vitaly.wool@konsulko.se \
    --cc=yury.norov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®