forked from openbsd/ports
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Early daemons like dhcpleased(8), slaacd(8), unwind(8), resolvd(8)
are started before syslogd(8). This resulted in ugly sendsyslog(2) dropped logs and the real message was lost. Create a temporary stash for log messages within the kernel. It has a limited size of 100 messages, and each message is truncated to 8192 bytes. When the stash is exhausted, the well-known dropped message is generated with a counter. After syslogd(8) has setup everything, it sends a debug line through libc to flush the kernel stash. Then syslogd receives all messages from the kernel before the usual logs. OK deraadt@ visa@
- Loading branch information
Showing
4 changed files
with
168 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
.\" $OpenBSD: sendsyslog.2,v 1.12 2020/11/05 16:04:39 jmc Exp $ | ||
.\" $OpenBSD: sendsyslog.2,v 1.13 2021/03/09 15:08:23 bluhm Exp $ | ||
.\" | ||
.\" Copyright (c) 2017 Alexander Bluhm <[email protected]> | ||
.\" Copyright (c) 2014 Theo de Raadt | ||
|
@@ -15,7 +15,7 @@ | |
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
.\" | ||
.Dd $Mdocdate: November 5 2020 $ | ||
.Dd $Mdocdate: March 9 2021 $ | ||
.Dt SENDSYSLOG 2 | ||
.Os | ||
.Sh NAME | ||
|
@@ -51,10 +51,12 @@ This is used internally by | |
so that messages can be sent during difficult situations. | ||
If sending to | ||
.Xr syslogd 8 | ||
fails, dropped messages are counted. | ||
fails, up to 100 messages are stashed in the kernel. | ||
After that, dropped messages are counted. | ||
When | ||
.Xr syslogd 8 | ||
works again, a warning with the counter and error number is logged. | ||
works again, before the next message, stashed messages and possibly | ||
a warning with the drop counter, error number, and pid is logged. | ||
.Pp | ||
To receive messages from the kernel, | ||
.Xr syslogd 8 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/* $OpenBSD: syslogd.c,v 1.264 2020/09/14 20:36:01 bluhm Exp $ */ | ||
/* $OpenBSD: syslogd.c,v 1.265 2021/03/09 15:08:23 bluhm Exp $ */ | ||
|
||
/* | ||
* Copyright (c) 2014-2017 Alexander Bluhm <[email protected]> | ||
|
@@ -891,6 +891,10 @@ main(int argc, char *argv[]) | |
if (sigprocmask(SIG_SETMASK, &sigmask, NULL) == -1) | ||
err(1, "sigprocmask unblock"); | ||
|
||
/* Send message via libc, flushes log stash in kernel. */ | ||
openlog("syslogd", LOG_PID, LOG_SYSLOG); | ||
syslog(LOG_DEBUG, "running"); | ||
|
||
event_dispatch(); | ||
/* NOTREACHED */ | ||
return (0); | ||
|