journald: set a limit on the number of fields (1k)
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 5 Dec 2018 21:45:02 +0000 (22:45 +0100)
committerMichael Biebl <biebl@debian.org>
Sat, 12 Jan 2019 20:49:44 +0000 (20:49 +0000)
commit6bc05c7604733d6a5fda484eb3268a72755d9cdb
tree47b5a037369c31776e0f97e50f8a5ba9975ef50d
parent74ec8a0bd52a667b03ff392bf14e7ce758b05024
journald: set a limit on the number of fields (1k)

We allocate a iovec entry for each field, so with many short entries,
our memory usage and processing time can be large, even with a relatively
small message size. Let's refuse overly long entries.

CVE-2018-16865
https://bugzilla.redhat.com/show_bug.cgi?id=1653861

What from I can see, the problem is not from an alloca, despite what the CVE
description says, but from the attack multiplication that comes from creating
many very small iovecs: (void* + size_t) for each three bytes of input message.

(cherry picked from commit 052c57f132f04a3cf4148f87561618da1a6908b4)
(cherry picked from commit eaf1d6e1e6ec5023ffdc2801e2b671226e862774)

Gbp-Pq: Name journald-set-a-limit-on-the-number-of-fields-1k.patch
src/journal/journald-native.c
src/shared/journal-importer.h