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: <CAJqdLrpxaQ4RTJXZ2Wd9f4ry7ZJv9FayQkL6zzpRnDYUgN8WEA@mail.gmail.com>
Date: Mon, 3 Nov 2025 16:47:25 +0100
From: Alexander Mikhalitsyn <alexander@...alicyn.com>
To: Christian Brauner <brauner@...nel.org>
Cc: linux-fsdevel@...r.kernel.org, Oleg Nesterov <oleg@...hat.com>, 
	Amir Goldstein <amir73il@...il.com>, Aleksa Sarai <cyphar@...har.com>, 
	Yu Watanabe <watanabe.yu+github@...il.com>, Josef Bacik <josef@...icpanda.com>, 
	Jeff Layton <jlayton@...nel.org>, Jann Horn <jannh@...gle.com>, 
	Luca Boccassi <luca.boccassi@...il.com>, linux-kernel@...r.kernel.org, 
	Alexander Viro <viro@...iv.linux.org.uk>, Jan Kara <jack@...e.cz>, 
	Lennart Poettering <lennart@...ttering.net>, Mike Yuan <me@...dnzj.com>, 
	Zbigniew Jędrzejewski-Szmek <zbyszek@...waw.pl>
Subject: Re: [PATCH 06/22] pidfs: prepare to drop exit_info pointer

Am Di., 28. Okt. 2025 um 09:46 Uhr schrieb Christian Brauner
<brauner@...nel.org>:
>
> There will likely be more info that we need to store in struct
> pidfs_attr. We need to make sure that some of the information such as
> exit info or coredump info that consists of multiple bits is either
> available completely or not at all, but never partially. Currently we
> use a pointer that we assign to. That doesn't scale. We can't waste a
> pointer for each mulit-part information struct we want to expose. Use a
> bitmask instead.
>
> Signed-off-by: Christian Brauner <brauner@...nel.org>

Reviewed-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@...onical.com>

> ---
>  fs/pidfs.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/fs/pidfs.c b/fs/pidfs.c
> index 204ebd32791a..0fad0c969b7a 100644
> --- a/fs/pidfs.c
> +++ b/fs/pidfs.c
> @@ -49,7 +49,12 @@ struct pidfs_exit_info {
>         __u32 coredump_mask;
>  };
>
> +enum pidfs_attr_mask_bits {
> +       PIDFS_ATTR_BIT_EXIT     = 0,
> +};
> +
>  struct pidfs_attr {
> +       unsigned long attr_mask;
>         struct simple_xattrs *xattrs;
>         struct pidfs_exit_info __pei;
>         struct pidfs_exit_info *exit_info;
> @@ -333,8 +338,8 @@ static long pidfd_info(struct file *file, unsigned int cmd, unsigned long arg)
>
>         attr = READ_ONCE(pid->attr);
>         if (mask & PIDFD_INFO_EXIT) {
> -               exit_info = READ_ONCE(attr->exit_info);
> -               if (exit_info) {
> +               if (test_bit(PIDFS_ATTR_BIT_EXIT, &attr->attr_mask)) {
> +                       smp_rmb();
>                         kinfo.mask |= PIDFD_INFO_EXIT;
>  #ifdef CONFIG_CGROUPS
>                         kinfo.cgroupid = exit_info->cgroupid;
> @@ -663,7 +668,8 @@ void pidfs_exit(struct task_struct *tsk)
>         exit_info->exit_code = tsk->exit_code;
>
>         /* Ensure that PIDFD_GET_INFO sees either all or nothing. */
> -       smp_store_release(&attr->exit_info, &attr->__pei);
> +       smp_wmb();
> +       set_bit(PIDFS_ATTR_BIT_EXIT, &attr->attr_mask);
>  }
>
>  #ifdef CONFIG_COREDUMP
>
> --
> 2.47.3
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ