[PATCH v2 03/22] coredump: set the minimum send buffer size
From: Christian Brauner
Date: Wed Aug 19 2026 - 19:11:59 EST
The send buffer of the coredump socket is subject to the limit in
net.core.wmem_default. af_unix uses sk_sndbuf / 2 - 64 bytes for a
single skb. That means a send buffer below that would split a page-sized
write into multiple skbs. Raise the send buffer to leave room for a
page-sized write plus the header. The default value is well above that.
So we really change it when it's below our minimum.
Signed-off-by: Christian Brauner (Amutable) <brauner@xxxxxxxxxx>
---
fs/coredump.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/fs/coredump.c b/fs/coredump.c
index ac4e922c9cb9..24a6405ea242 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -665,6 +665,9 @@ static int umh_coredump_setup(struct subprocess_info *info, struct cred *new)
}
#ifdef CONFIG_UNIX
+/* af_unix halves the send buffer to size a single skb. */
+#define COREDUMP_SOCK_SNDBUF_MIN (3 * PAGE_SIZE)
+
static bool coredump_sock_connect(struct core_name *cn, struct coredump_params *cprm)
{
struct file *file __free(fput) = NULL;
@@ -690,6 +693,10 @@ static bool coredump_sock_connect(struct core_name *cn, struct coredump_params *
if (retval < 0)
return false;
+ /* Don't let a page-sized write split into several skbs. */
+ socket->sk->sk_sndbuf = max_t(int, socket->sk->sk_sndbuf,
+ COREDUMP_SOCK_SNDBUF_MIN);
+
file = sock_alloc_file(socket, 0, NULL);
if (IS_ERR(file))
return false;
--
2.53.0