Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F145426599
D4973.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D4973.id.diff
View Options
Index: usr.sbin/syslogd/syslogd.8
===================================================================
--- usr.sbin/syslogd/syslogd.8
+++ usr.sbin/syslogd/syslogd.8
@@ -28,7 +28,7 @@
.\" @(#)syslogd.8 8.1 (Berkeley) 6/6/93
.\" $FreeBSD$
.\"
-.Dd June 16, 2015
+.Dd January 22, 2016
.Dt SYSLOGD 8
.Os
.Sh NAME
@@ -36,7 +36,7 @@
.Nd log systems messages
.Sh SYNOPSIS
.Nm
-.Op Fl 468ACcdFkNnosTuv
+.Op Fl 468ACcdFkNnoOsTuv
.Op Fl a Ar allowed_peer
.Op Fl b Ar bind_address
.Op Fl f Ar config_file
@@ -254,6 +254,10 @@
.Xr getbootfile 3 .
Without this, the kernel message prefix is always
.Dq Li kernel: .
+.It Fl O
+Disable the protection of
+.Nm
+from being killed if the system exhausts available memory and swap.
.It Fl p
Specify the pathname of an alternate log socket to be used instead;
the default is
@@ -353,6 +357,9 @@
option is specified);
therefore, they must be created manually before running
.Nm .
+Also by default
+.Nm
+is protected against OOM.
.Pp
The date and time are taken from the received message.
If the format of the timestamp field is incorrect,
Index: usr.sbin/syslogd/syslogd.c
===================================================================
--- usr.sbin/syslogd/syslogd.c
+++ usr.sbin/syslogd/syslogd.c
@@ -89,6 +89,7 @@
#include <sys/resource.h>
#include <sys/syslimits.h>
#include <sys/types.h>
+#include <sys/procctl.h>
#include <netinet/in.h>
#include <netdb.h>
@@ -290,6 +291,7 @@
static int MarkInterval = 20 * 60; /* interval between marks in seconds */
static int MarkSeq; /* mark sequence number */
static int NoBind; /* don't bind() as suggested by RFC 3164 */
+static int ProtectMode = 1;/* true by default to protect from OOM killer */
static int SecureMode; /* when true, receive only unix domain socks */
#ifdef INET6
static int family = PF_UNSPEC; /* protocol family (IPv4, IPv6 or both) */
@@ -384,7 +386,7 @@
STAILQ_INIT(&hqueue);
- while ((ch = getopt(argc, argv, "468Aa:b:cCdf:Fkl:m:nNop:P:sS:Tuv"))
+ while ((ch = getopt(argc, argv, "468Aa:b:cCdf:Fkl:m:nNoOp:P:sS:Tuv"))
!= -1)
switch (ch) {
case '4':
@@ -481,6 +483,13 @@
case 'o':
use_bootfile = 1;
break;
+ case 'O':
+ /*
+ * Protect itself from being killed
+ * when swap space is exhausted.
+ */
+ ProtectMode--;
+ break;
case 'p': /* path */
if (strlen(optarg) >= sizeof(sunx.sun_path))
errx(1, "%s path too long, exiting", optarg);
@@ -630,6 +639,11 @@
/* tuck my process id away */
pidfile_write(pfh);
+ if (ProtectMode) {
+ int p_flags = PPROT_SET;
+ procctl(P_PID, getpid(), PROC_SPROTECT, &p_flags);
+ }
+
dprintf("off & running....\n");
init(0);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Feb 20, 5:24 PM (16 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28902133
Default Alt Text
D4973.id.diff (2 KB)
Attached To
Mode
D4973: syslogd(8) add a protection against OOM killer.
Attached
Detach File
Event Timeline
Log In to Comment