Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

pidfs: prepare to drop exit_info pointer

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.

Link: https://patch.msgid.link/20251028-work-coredump-signal-v1-6-ca449b7b7aa0@kernel.org
Reviewed-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>

+9 -3
+9 -3
fs/pidfs.c
··· 49 49 __u32 coredump_mask; 50 50 }; 51 51 52 + enum pidfs_attr_mask_bits { 53 + PIDFS_ATTR_BIT_EXIT = 0, 54 + }; 55 + 52 56 struct pidfs_attr { 57 + unsigned long attr_mask; 53 58 struct simple_xattrs *xattrs; 54 59 struct pidfs_exit_info __pei; 55 60 struct pidfs_exit_info *exit_info; ··· 338 333 339 334 attr = READ_ONCE(pid->attr); 340 335 if (mask & PIDFD_INFO_EXIT) { 341 - exit_info = READ_ONCE(attr->exit_info); 342 - if (exit_info) { 336 + if (test_bit(PIDFS_ATTR_BIT_EXIT, &attr->attr_mask)) { 337 + smp_rmb(); 343 338 kinfo.mask |= PIDFD_INFO_EXIT; 344 339 #ifdef CONFIG_CGROUPS 345 340 kinfo.cgroupid = exit_info->cgroupid; ··· 668 663 exit_info->exit_code = tsk->exit_code; 669 664 670 665 /* Ensure that PIDFD_GET_INFO sees either all or nothing. */ 671 - smp_store_release(&attr->exit_info, &attr->__pei); 666 + smp_wmb(); 667 + set_bit(PIDFS_ATTR_BIT_EXIT, &attr->attr_mask); 672 668 } 673 669 674 670 #ifdef CONFIG_COREDUMP