]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
coredump: handle ENOBUFS and EMSGSIZE the same way
authorMichal Sekletar <msekleta@redhat.com>
Fri, 24 Oct 2025 10:55:20 +0000 (12:55 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 24 Oct 2025 14:23:09 +0000 (15:23 +0100)
Depending on the runtime configuration, e.g. sysctls
net.core.wmem_default= and net.core.rmem_default and on the actual
message size, sendmsg() can fail also with ENOBUFS. E.g. alloc_skb()
failure caused by net.core.[rw]mem_default=64MiB and huge fdinfo list
from process that has 90k opened FDs.

We should handle this case in the same way as EMSGSIZE and drop part of
the message.

src/coredump/coredump-send.c

index da571c5dfa8e196888fcd54e11071b690c2fce1f..ef2fc02ceb000f7ea4fd2960bfb607ad085a3926 100644 (file)
@@ -45,7 +45,7 @@ int coredump_send(const struct iovec_wrapper *iovw, int input_fd, PidRef *pidref
                         if (sendmsg(fd, &mh, MSG_NOSIGNAL) >= 0)
                                 break;
 
-                        if (errno == EMSGSIZE && mh.msg_iov[0].iov_len > 0) {
+                        if (IN_SET(errno, EMSGSIZE, ENOBUFS) && mh.msg_iov[0].iov_len > 0) {
                                 /* This field didn't fit? That's a pity. Given that this is
                                  * just metadata, let's truncate the field at half, and try
                                  * again. We append three dots, in order to show that this is