summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/systemd/systemd/0025-journald-set-a-limit-on-the-number-of-fields-1k.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/systemd/systemd/0025-journald-set-a-limit-on-the-number-of-fields-1k.patch')
-rw-r--r--meta/recipes-core/systemd/systemd/0025-journald-set-a-limit-on-the-number-of-fields-1k.patch60
1 files changed, 60 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd/0025-journald-set-a-limit-on-the-number-of-fields-1k.patch b/meta/recipes-core/systemd/systemd/0025-journald-set-a-limit-on-the-number-of-fields-1k.patch
new file mode 100644
index 0000000000..e8a6f2b986
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0025-journald-set-a-limit-on-the-number-of-fields-1k.patch
@@ -0,0 +1,60 @@
1From 4566aaf97f5b4143b930d75628f3abc905249dcd Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
3Date: Wed, 5 Dec 2018 22:45:02 +0100
4Subject: [PATCH] journald: set a limit on the number of fields (1k)
5
6We allocate a iovec entry for each field, so with many short entries,
7our memory usage and processing time can be large, even with a relatively
8small message size. Let's refuse overly long entries.
9
10CVE-2018-16865
11https://bugzilla.redhat.com/show_bug.cgi?id=1653861
12
13What from I can see, the problem is not from an alloca, despite what the CVE
14description says, but from the attack multiplication that comes from creating
15many very small iovecs: (void* + size_t) for each three bytes of input message.
16
17Patch backported from systemd master at
18052c57f132f04a3cf4148f87561618da1a6908b4.
19
20CVE: CVE-2018-16865
21Upstream-Status: Backport
22
23---
24 src/basic/journal-importer.h | 3 +++
25 src/journal/journald-native.c | 5 +++++
26 2 files changed, 8 insertions(+)
27
28diff --git a/src/basic/journal-importer.h b/src/basic/journal-importer.h
29index f49ce734a1..c4ae45d32d 100644
30--- a/src/basic/journal-importer.h
31+++ b/src/basic/journal-importer.h
32@@ -16,6 +16,9 @@
33 #define DATA_SIZE_MAX (1024*1024*768u)
34 #define LINE_CHUNK 8*1024u
35
36+/* The maximum number of fields in an entry */
37+#define ENTRY_FIELD_COUNT_MAX 1024
38+
39 struct iovec_wrapper {
40 struct iovec *iovec;
41 size_t size_bytes;
42diff --git a/src/journal/journald-native.c b/src/journal/journald-native.c
43index 5ff22a10af..951d092053 100644
44--- a/src/journal/journald-native.c
45+++ b/src/journal/journald-native.c
46@@ -140,6 +140,11 @@ static int server_process_entry(
47 }
48
49 /* A property follows */
50+ if (n > ENTRY_FIELD_COUNT_MAX) {
51+ log_debug("Received an entry that has more than " STRINGIFY(ENTRY_FIELD_COUNT_MAX) " fields, ignoring entry.");
52+ r = 1;
53+ goto finish;
54+ }
55
56 /* n existing properties, 1 new, +1 for _TRANSPORT */
57 if (!GREEDY_REALLOC(iovec, m,
58--
592.11.0
60