[systemd-devel] [PATCH] coredump: vacuum - fix MaxUse and KeepFree default handling

Lennart Poettering lennart at poettering.net
Fri May 15 11:59:11 PDT 2015


On Wed, 29.04.15 14:31, Mike Winter (mike.winter at vecima.com) wrote:

> When max_use and keep_free are set to the defaults in coredump.conf for use
> in non-journal cores, systemd-coredump ignores the settings altogether and
> proceeds to fill up all available disk space with coredumps.
> 
> '-1 'is used internally inside of coredump.c and coredump-vacuum.c to denote
> default values, but coredump_vacuum() itself throws away all negative values
> as a bounds check, causing the error.

Indeed.

I have now applied a different patch the replaces the <= checks with
== checks. Only if both keep_free and max_use are equal to zero we can
skip the vacuuming, since only then vacuuming is completely turned
off.

Thanks for reporting!

Lennart

> 
> 
> ---
>  src/journal/coredump-vacuum.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/src/journal/coredump-vacuum.c b/src/journal/coredump-vacuum.c
> index 9b73795..74bfbbc 100644
> --- a/src/journal/coredump-vacuum.c
> +++ b/src/journal/coredump-vacuum.c
> @@ -135,8 +135,11 @@ int coredump_vacuum(int exclude_fd, off_t keep_free,
> off_t max_use) {
>          struct stat exclude_st;
>          int r;
> 
> -        if (keep_free <= 0 && max_use <= 0)
> -                return 0;
> +        /* Set nonsense values to the defaults. */
> +        if (keep_free <= 0)
> +                keep_free = -1;
> +        if (max_use <= 0)
> +                max_use = -1;
> 
>          if (exclude_fd >= 0) {
>                  if (fstat(exclude_fd, &exclude_st) < 0)
> -- 
> 1.9.1
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list