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