Page MenuHomeFreeBSD

syslogd: Fix handling of configuration errors
AcceptedPublic

Authored by markj on Sun, Feb 1, 3:10 PM.
Tags
None
Referenced Files
F143930034: D55033.diff
Mon, Feb 2, 3:38 AM
F143929882: D55033.id.diff
Mon, Feb 2, 3:34 AM
F143915569: D55033.id.diff
Sun, Feb 1, 10:35 PM
F143915459: D55033.diff
Sun, Feb 1, 10:32 PM

Details

Summary
  • If parse_selector() returns NULL, we should exit immediately.
  • Add newlines to a couple of debug messages. Otherwise they don't get printed if the process crashes before the stdio buffer is flushed.

Reported by: Doug Hardie <bc979@lafn.org>
Fixes: f4b4a10abb26 ("syslogd: Move selector parsing into its own function")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 70315
Build 67198: arc lint + arc unit

Event Timeline

markj requested review of this revision.Sun, Feb 1, 3:10 PM

Since our syslogd's default configuration started including additional configurations installed with non-base packages, it is no more acceptable for it to use err*() functions based on syntax errors in such configuration files. Instead, it should issue a warning, skip bad line and continue with execution. Please do not add new err*() to the syslogd but warn*() with graceful recovery.

Like eugen suggested, it might be better to skip the line and log a warning on syntax parse failure instead of terminating. It looks like this would require some more surgery to handle other parse errors though.

This otherwise looks good. Perhaps it might be better to ship this now to fix the bug. A separate feature request could be opened for better parser error handling.

This revision is now accepted and ready to land.Mon, Feb 2, 4:08 AM