[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20260130015427.83556-1-jongan.kim@lge.com>
Date: Fri, 30 Jan 2026 10:54:27 +0900
From: jongan.kim@....com
To: aliceryhl@...gle.com
Cc: a.hindborg@...nel.org,
arve@...roid.com,
bjorn3_gh@...tonmail.com,
boqun.feng@...il.com,
brauner@...nel.org,
cmllamas@...gle.com,
dakr@...nel.org,
daniel.almeida@...labora.com,
gary@...yguo.net,
gregkh@...uxfoundation.org,
heesu0025.kim@....com,
ht.hong@....com,
jongan.kim@....com,
jungsu.hwang@....com,
kernel-team@...roid.com,
linux-kernel@...r.kernel.org,
lossin@...nel.org,
ojeda@...nel.org,
rust-for-linux@...r.kernel.org,
sanghun.lee@....com,
seulgi.lee@....com,
sunghoon.kim@....com,
tamird@...il.com,
tkjos@...roid.com,
tmgross@...ch.edu,
viresh.kumar@...aro.org,
vitaly.wool@...sulko.se,
yury.norov@...il.com
Subject: Re: [PATCH v2 1/3] binder: handle PID namespace conversion for freeze operation
Alice Ryhl @ 2026-01-29 10:41 UTC wrote:
> On Thu, Jan 29, 2026 at 05:41:17PM +0900, jongan.kim@....com wrote:
> > From: JongAn Kim <jongan.kim@....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@....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
Powered by blists - more mailing lists