From: Christian Brauner <brauner@kernel.org>
To: Jacob Lalonde <jalalonde@meta.com>, Josef Bacik <josef@toxicpanda.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>, Jan Kara <jack@suse.cz>,
Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@kernel.org>,
Lorenzo Stoakes <ljs@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
Omar Sandoval <osandov@osandov.com>,
Jacob Lalonde <jalalonde@fb.com>, Shuah Khan <shuah@kernel.org>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
"Christian Brauner (Amutable)" <brauner@kernel.org>
Subject: [PATCH 04/11] coredump: move the negotiated mask into struct coredump_params
Date: Tue, 11 Aug 2026 17:27:25 +0200 [thread overview]
Message-ID: <20260811-work-coredump-sparse-v1-4-cd3e8b1e356d@kernel.org> (raw)
In-Reply-To: <20260811-work-coredump-sparse-v1-0-cd3e8b1e356d@kernel.org>
The coredump server negotiates a set of COREDUMP_* options with the
kernel. The core dump path cannot see them though.
Move the mask into struct coredump_params so the negotiated options are
available to the core dump path.
No functional change.
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
---
fs/coredump.c | 15 +++++++--------
include/linux/coredump.h | 2 ++
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/fs/coredump.c b/fs/coredump.c
index 235b54484107..e5463e3b3f4b 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -100,7 +100,6 @@ struct core_name {
unsigned int core_pipe_limit;
bool core_dumped;
enum coredump_type_t core_type;
- u64 mask;
};
static int expand_corename(struct core_name *cn, int size)
@@ -245,9 +244,9 @@ static bool coredump_parse(struct core_name *cn, struct coredump_params *cprm,
int pid_in_pattern = 0;
int err = 0;
- cn->mask = COREDUMP_KERNEL;
+ cprm->mask = COREDUMP_KERNEL;
if (core_pipe_limit)
- cn->mask |= COREDUMP_WAIT;
+ cprm->mask |= COREDUMP_WAIT;
cn->used = 0;
cn->corename = NULL;
cn->core_pipe_limit = 0;
@@ -853,7 +852,7 @@ static bool coredump_sock_request(struct core_name *cn, struct coredump_params *
return false;
}
- cn->mask = ack.mask;
+ cprm->mask = ack.mask;
return coredump_sock_mark(cprm->file, COREDUMP_MARK_REQACK);
}
@@ -1122,7 +1121,7 @@ static void do_coredump(struct core_name *cn, struct coredump_params *cprm,
}
/* Don't even generate the coredump. */
- if (cn->mask & COREDUMP_REJECT)
+ if (cprm->mask & COREDUMP_REJECT)
return;
/* get us an unshared descriptor table; almost always a no-op */
@@ -1130,13 +1129,13 @@ static void do_coredump(struct core_name *cn, struct coredump_params *cprm,
if (unshare_files())
return;
- if ((cn->mask & COREDUMP_KERNEL) && !coredump_write(cn, cprm, binfmt))
+ if ((cprm->mask & COREDUMP_KERNEL) && !coredump_write(cn, cprm, binfmt))
return;
coredump_sock_shutdown(cprm->file);
/* Let the parent know that a coredump was generated. */
- if (cn->mask & COREDUMP_USERSPACE)
+ if (cprm->mask & COREDUMP_USERSPACE)
cn->core_dumped = true;
/*
@@ -1144,7 +1143,7 @@ static void do_coredump(struct core_name *cn, struct coredump_params *cprm,
* or usermodehelper to finish before exiting so it can e.g.,
* inspect /proc/<pid>.
*/
- if (cn->mask & COREDUMP_WAIT) {
+ if (cprm->mask & COREDUMP_WAIT) {
switch (cn->core_type) {
case COREDUMP_PIPE:
wait_for_dump_helpers(cprm->file);
diff --git a/include/linux/coredump.h b/include/linux/coredump.h
index 7b38ee2e7913..dc7a05b1bb0a 100644
--- a/include/linux/coredump.h
+++ b/include/linux/coredump.h
@@ -26,6 +26,8 @@ struct coredump_params {
/* Snapshot of dumpable at dump start. */
enum task_dumpable dumpable;
int cpu;
+ /* COREDUMP_* options negotiated with the coredump server. */
+ u64 mask;
loff_t written;
loff_t pos;
loff_t to_skip;
--
2.53.0
next prev parent reply other threads:[~2026-08-11 15:27 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 15:27 [PATCH 00/11] coredump: allow to create sparse coredumps on the coredump socket Christian Brauner
2026-08-11 15:27 ` [PATCH 01/11] selftests/coredump: discard the right amount after the coredump request Christian Brauner
2026-08-11 15:27 ` [PATCH 02/11] selftests/coredump: collapse the expected request check into the helper Christian Brauner
2026-08-11 15:27 ` [PATCH 03/11] coredump: pin the protocol struct sizes Christian Brauner
2026-08-11 15:27 ` Christian Brauner [this message]
2026-08-11 15:27 ` [PATCH 05/11] coredump: deduplicate the to_skip flush Christian Brauner
2026-08-11 15:27 ` [PATCH 06/11] coredump: add COREDUMP_HEADER to the coredump socket protocol Christian Brauner
2026-08-11 15:27 ` [PATCH 07/11] coredump: add COREDUMP_SPARSE " Christian Brauner
2026-08-11 15:27 ` [PATCH 08/11] tools: sync coredump.h header Christian Brauner
2026-08-11 15:27 ` [PATCH 09/11] coredump: frame the coredump when COREDUMP_HEADER is negotiated Christian Brauner
2026-08-11 15:27 ` [PATCH 10/11] coredump: describe the holes when COREDUMP_SPARSE " Christian Brauner
2026-08-11 15:27 ` [PATCH 11/11] selftests/coredump: test COREDUMP_HEADER and COREDUMP_SPARSE Christian Brauner
2026-08-11 19:07 ` [PATCH 00/11] coredump: allow to create sparse coredumps on the coredump socket Jann Horn
2026-08-11 19:39 ` Jann Horn
2026-08-11 20:55 ` Christian Brauner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260811-work-coredump-sparse-v1-4-cd3e8b1e356d@kernel.org \
--to=brauner@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=jack@suse.cz \
--cc=jalalonde@fb.com \
--cc=jalalonde@meta.com \
--cc=josef@toxicpanda.com \
--cc=liam@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=osandov@osandov.com \
--cc=rppt@kernel.org \
--cc=shuah@kernel.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox