Go to file
Christian Brauner ac19091288 coredump: hand a pidfd to the usermode coredump helper
commit b5325b2a27 upstream.

Give userspace a way to instruct the kernel to install a pidfd into the
usermode helper process. This makes coredump handling a lot more
reliable for userspace. In parallel with this commit we already have
systemd adding support for this in [1].

We create a pidfs file for the coredumping process when we process the
corename pattern. When the usermode helper process is forked we then
install the pidfs file as file descriptor three into the usermode
helpers file descriptor table so it's available to the exec'd program.

Since usermode helpers are either children of the system_unbound_wq
workqueue or kthreadd we know that the file descriptor table is empty
and can thus always use three as the file descriptor number.

Note, that we'll install a pidfd for the thread-group leader even if a
subthread is calling do_coredump(). We know that task linkage hasn't
been removed due to delay_group_leader() and even if this @current isn't
the actual thread-group leader we know that the thread-group leader
cannot be reaped until @current has exited.

[brauner: This is a backport for the v6.1 series. Upstream has
significantly changed and backporting all that infra is a non-starter.
So simply backport the pidfd_prepare() helper and waste the file
descriptor we allocated. Then we minimally massage the umh coredump
setup code.]

Link: https://github.com/systemd/systemd/pull/37125 [1]
Link: https://lore.kernel.org/20250414-work-coredump-v2-3-685bf231f828@kernel.org
Tested-by: Luca Boccassi <luca.boccassi@gmail.com>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-06-04 14:40:25 +02:00
arch arm64: dts: qcom: sm8350: Fix typo in pil_camera_mem node 2025-06-04 14:40:25 +02:00
block
certs
crypto crypto: algif_hash - fix double free in hash_accept 2025-06-04 14:40:20 +02:00
Documentation
drivers perf/arm-cmn: Initialise cmn->cpu earlier 2025-06-04 14:40:25 +02:00
fs coredump: hand a pidfd to the usermode coredump helper 2025-06-04 14:40:25 +02:00
include coredump: hand a pidfd to the usermode coredump helper 2025-06-04 14:40:25 +02:00
init
io_uring io_uring: fix overflow resched cqe reordering 2025-06-04 14:40:20 +02:00
ipc
kernel fork: use pidfd_prepare() 2025-06-04 14:40:25 +02:00
lib
LICENSES
mm mm/page_alloc.c: avoid infinite retries caused by cpuset race 2025-06-04 14:40:21 +02:00
net net_sched: hfsc: Address reentrant enqueue adding class to eltree twice 2025-06-04 14:40:25 +02:00
rust
samples
scripts
security
sound ALSA: hda/realtek: Add quirk for Lenovo Yoga Pro 7 14ASP10 2025-06-04 14:40:21 +02:00
tools
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
.rustfmt.toml
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile kbuild: Disable -Wdefault-const-init-unsafe 2025-06-04 14:40:22 +02:00
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.