lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DG5CHD1A9UGQ.2V2A67G7Z6GF4@garyguo.net>
Date: Tue, 03 Feb 2026 13:01:38 +0000
From: "Gary Guo" <gary@...yguo.net>
To: <jongan.kim@....com>, <a.hindborg@...nel.org>, <aliceryhl@...gle.com>,
 <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>, <tamird@...il.com>, <tkjos@...roid.com>,
 <tmgross@...ch.edu>, <viresh.kumar@...aro.org>, <vitaly.wool@...sulko.se>,
 <yury.norov@...il.com>, <lossin@...nel.org>, <ojeda@...nel.org>
Cc: <heesu0025.kim@....com>, <ht.hong@....com>, <jungsu.hwang@....com>,
 <kernel-team@...roid.com>, <linux-kernel@...r.kernel.org>,
 <rust-for-linux@...r.kernel.org>, <sanghun.lee@....com>,
 <seulgi.lee@....com>, <sunghoon.kim@....com>
Subject: Re: [PATCH v3 2/3] rust: pid: add Pid abstraction and init_ns
 helper

On Tue Feb 3, 2026 at 6:59 AM GMT, jongan.kim wrote:
> From: HeeSu Kim <heesu0025.kim@....com>
>
> Add a new Pid abstraction in rust/kernel/pid.rs that wraps the
> kernel's struct pid and provides safe Rust interfaces for:
> - find_vpid: Find a pid by number under RCU protection
> - pid_task: Get the task associated with a pid under RCU protection
>
> Also add init_ns() associated function to PidNamespace to get
> a reference to the init PID namespace.
>
> These abstractions use lifetime-bounded references tied to RCU guards
> to ensure memory safety when accessing RCU-protected data structures.
>
> Signed-off-by: HeeSu Kim <heesu0025.kim@....com>
> ---
> v2 -> v3:
> - Add Send/Sync traits for Pid
> - Add AlwaysRefCounted for Pid with rust_helper_get_pid
> - Add from_raw() constructor to Pid and Task
> - Rename find_vpid_with_guard -> find_vpid
> - Rename pid_task_with_guard -> pid_task 
> - Convert init_pid_ns() to PidNamespace::init_ns()
> - Add PartialEq/Eq for PidNamespace (Alice)
> - Add rust/helpers/pid.c for get_pid() wrapper
>
>  rust/helpers/helpers.c       |   1 +
>  rust/helpers/pid.c           |   9 +++
>  rust/kernel/lib.rs           |   1 +
>  rust/kernel/pid.rs           | 138 +++++++++++++++++++++++++++++++++++
>  rust/kernel/pid_namespace.rs |  17 +++++
>  rust/kernel/task.rs          |  13 ++++
>  6 files changed, 179 insertions(+)
>  create mode 100644 rust/helpers/pid.c
>  create mode 100644 rust/kernel/pid.rs
>
> diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c
> index 79c72762ad9c..3138b88df24f 100644
> --- a/rust/helpers/helpers.c
> +++ b/rust/helpers/helpers.c
> @@ -38,6 +38,7 @@
>  #include "of.c"
>  #include "page.c"
>  #include "pci.c"
> +#include "pid.c"
>  #include "pid_namespace.c"
>  #include "platform.c"
>  #include "poll.c"
> diff --git a/rust/helpers/pid.c b/rust/helpers/pid.c
> new file mode 100644
> index 000000000000..1337ca63ab0f
> --- /dev/null
> +++ b/rust/helpers/pid.c
> @@ -0,0 +1,9 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +#include <linux/pid.h>
> +
> +/* Get a reference on a struct pid. */
> +struct pid *rust_helper_get_pid(struct pid *pid)

This needs a __rust_helper annotation.

The rest looks superb. With this fixed:

    Reviewed-by: Gary Guo <gary@...yguo.net>

Best,
Gary

> +{
> +	return get_pid(pid);
> +}
> diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs
> index f812cf120042..60a518d65d0e 100644
> --- a/rust/kernel/lib.rs
> +++ b/rust/kernel/lib.rs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ