From: Zbigniew Jędrzejewski-Szmek Date: Wed, 5 Dec 2018 21:52:53 +0000 (+0100) Subject: journald: lower the maximum entry size limit to ½ for non-sealed fds X-Git-Tag: archive/raspbian/240-5+rpi1^2~34 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=e71c99788de0978047e8dcad1e737d6515121d79;p=systemd.git journald: lower the maximum entry size limit to ½ for non-sealed fds We immediately read the whole contents into memory, making thigs much more expensive. Sealed fds should be used instead since they are more efficient on our side. (cherry picked from commit 6670c9de196c8e2d5e84a8890cbb68f70c4db6e3) (cherry picked from commit f0ad5fe17fc6cee1f04f8f93899538ea2e96256c) Gbp-Pq: Name journald-lower-the-maximum-entry-size-limit-to-for-non-se.patch --- diff --git a/src/journal/journald-native.c b/src/journal/journald-native.c index 50aad6d1..221188db 100644 --- a/src/journal/journald-native.c +++ b/src/journal/journald-native.c @@ -376,8 +376,10 @@ void server_process_native_file( if (st.st_size <= 0) return; - if (st.st_size > ENTRY_SIZE_MAX) { - log_error("File passed too large. Ignoring."); + /* When !sealed, set a lower memory limit. We have to read the file, + * effectively doubling memory use. */ + if (st.st_size > ENTRY_SIZE_MAX / (sealed ? 1 : 2)) { + log_error("File passed too large (%"PRIu64" bytes). Ignoring.", (uint64_t) st.st_size); return; }