[systemd-devel] [PATCH] RFC: stack_size_guess() and LINE_MAX limitation for MESSAGE

Lennart Poettering lennart at poettering.net
Wed Apr 17 10:48:17 PDT 2013


On Mon, 15.04.13 16:12, harald at redhat.com (harald at redhat.com) wrote:

> From: Harald Hoyer <harald at redhat.com>
> 
> Introduce stack_size_guess() and alloca_maybe_safe() and get rid of
> the LINE_MAX limitation for MESSAGE in sd_journal_printv*()

tbh I don't really see the benefit of this. This is about logging, you
really want to avoid too much magic in there with differing results
depending "how deep in you are". We should stay predictable here, and
that also means that we fail predictably and that we generate the very
same messages regardless in which context you call us...

I mean, the original comment in that source file suggested to do a VLA
loop there, but that'd only be an optimization, we'd still have to
enforce a fixed limit on the resulting string, to avoid DoS
attacks... Now, turning this into something entirely dynamic sounds
dangerous too me at little benefit...

Also, the those functions are slow enough, not sure how I feel about
adding yet another syscall into each invocation...

What's the precise issue you are trying to fix here? Are there reports
of the limit actually being a real-life issue?

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list