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: <20251028-work-coredump-signal-v1-2-ca449b7b7aa0@kernel.org>
Date: Tue, 28 Oct 2025 09:45:47 +0100
From: Christian Brauner <brauner@...nel.org>
To: linux-fsdevel@...r.kernel.org
Cc: 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>, 
 Alexander Mikhalitsyn <alexander@...alicyn.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>, 
 Christian Brauner <brauner@...nel.org>
Subject: [PATCH 02/22] pidfs: fix PIDFD_INFO_COREDUMP handling

When PIDFD_INFO_COREDUMP is requested we raise it unconditionally in the
returned mask even if no coredump actually did take place. This was
done because we assumed that the later check whether ->coredump_mask as
non-zero detects that it is zero and then retrieves the dumpability
settings from the task's mm. This has issues though becuase there are
tasks that might not have any mm. Also it's just not very cleanly
implemented. Fix this.

Signed-off-by: Christian Brauner <brauner@...nel.org>
---
 fs/pidfs.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/pidfs.c b/fs/pidfs.c
index c2f0b7091cd7..c0f410903c3f 100644
--- a/fs/pidfs.c
+++ b/fs/pidfs.c
@@ -335,8 +335,9 @@ static long pidfd_info(struct file *file, unsigned int cmd, unsigned long arg)
 	}
 
 	if (mask & PIDFD_INFO_COREDUMP) {
-		kinfo.mask |= PIDFD_INFO_COREDUMP;
 		kinfo.coredump_mask = READ_ONCE(attr->__pei.coredump_mask);
+		if (kinfo.coredump_mask)
+			kinfo.mask |= PIDFD_INFO_COREDUMP;
 	}
 
 	task = get_pid_task(pid, PIDTYPE_PID);
@@ -355,12 +356,13 @@ static long pidfd_info(struct file *file, unsigned int cmd, unsigned long arg)
 	if (!c)
 		return -ESRCH;
 
-	if ((kinfo.mask & PIDFD_INFO_COREDUMP) && !(kinfo.coredump_mask)) {
+	if ((mask & PIDFD_INFO_COREDUMP) && !kinfo.coredump_mask) {
 		guard(task_lock)(task);
 		if (task->mm) {
 			unsigned long flags = __mm_flags_get_dumpable(task->mm);
 
 			kinfo.coredump_mask = pidfs_coredump_mask(flags);
+			kinfo.mask |= PIDFD_INFO_COREDUMP;
 		}
 	}
 

-- 
2.47.3


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ