From ce66a2f2bbfe216207407f27552d6c3f8a6fe4bf Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 13 Dec 2024 19:05:41 +0100 Subject: [PATCH] sd-journal: drop memfd fallback --- src/libsystemd/sd-journal/journal-send.c | 33 ++++++------------------ 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c index 7d02b57d7b4..bbfe9cf0fad 100644 --- a/src/libsystemd/sd-journal/journal-send.c +++ b/src/libsystemd/sd-journal/journal-send.c @@ -233,7 +233,6 @@ _public_ int sd_journal_sendv(const struct iovec *iov, int n) { }; ssize_t k; bool have_syslog_identifier = false; - bool seal = true; assert_return(iov, -EINVAL); assert_return(n > 0, -EINVAL); @@ -312,35 +311,19 @@ _public_ int sd_journal_sendv(const struct iovec *iov, int n) { if (!IN_SET(errno, EMSGSIZE, ENOBUFS, EAGAIN)) return -errno; - /* Message doesn't fit... Let's dump the data in a memfd or - * temporary file and just pass a file descriptor of it to the - * other side. - * - * For the temporary files we use /dev/shm instead of /tmp - * here, since we want this to be a tmpfs, and one that is - * available from early boot on and where unprivileged users - * can create files. */ - buffer_fd = memfd_new(NULL); - if (buffer_fd < 0) { - if (buffer_fd == -ENOSYS) { - buffer_fd = open_tmpfile_unlinkable("/dev/shm", O_RDWR | O_CLOEXEC); - if (buffer_fd < 0) - return buffer_fd; - - seal = false; - } else - return buffer_fd; - } + /* Message doesn't fit... Let's dump the data in a memfd or temporary file and just pass a file + * descriptor of it to the other side. */ + buffer_fd = memfd_new("journal-data"); + if (buffer_fd < 0) + return buffer_fd; n = writev(buffer_fd, w, j); if (n < 0) return -errno; - if (seal) { - r = memfd_set_sealed(buffer_fd); - if (r < 0) - return r; - } + r = memfd_set_sealed(buffer_fd); + if (r < 0) + return r; r = send_one_fd_sa(fd, buffer_fd, mh.msg_name, mh.msg_namelen, 0); if (r == -ENOENT)