[Bug 1470] adjust Linux out-of-memory killer to stop sshd being killed

bugzilla-daemon at bugzilla.mindrot.org bugzilla-daemon at bugzilla.mindrot.org
Tue Dec 8 11:09:22 EST 2009


https://bugzilla.mindrot.org/show_bug.cgi?id=1470

Damien Miller <djm at mindrot.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #1742|                            |ok+
               Flag|                            |

--- Comment #9 from Damien Miller <djm at mindrot.org> 2009-12-08 11:09:20 EST ---
(From update of attachment 1742)
>Index: openbsd-compat/port-linux.c
>===================================================================
>RCS file: /var/cvs/openssh/openbsd-compat/port-linux.c,v
>retrieving revision 1.6
>diff -u -p -r1.6 port-linux.c
>--- openbsd-compat/port-linux.c	24 Oct 2009 04:04:13 -0000	1.6
>+++ openbsd-compat/port-linux.c	7 Dec 2009 06:06:11 -0000
>@@ -27,8 +27,15 @@
> #include <stdarg.h>
> #include <string.h>
> 
>-#ifdef WITH_SELINUX
>+#if defined(LINUX_OOM_ADJUST) || defined(WITH_SELINUX)
> #include "log.h"
>+#endif
>+
>+#ifdef LINUX_OOM_ADJUST
>+#include <stdio.h>
>+#endif
>+

I wouldn't bother slicing and dicing the header inclusion based on
preprocessor symbols. There is little cost to including them
unconditionally, or perhaps conditionally on the union of all supported
symbols for this file.

>+#ifdef LINUX_OOM_ADJUST
>+#define OOM_ADJ_PATH	"/proc/self/oom_adj"
>+#define OOM_ADJ_NOKILL	-17  /* magic value to disable OOM killer */

FYI, -17 is documented in Documentation/filesystems/proc.txt in the
Linux source. A stable URL for this is
http://lxr.linux.no/#linux+v2.6.32/Documentation/filesystems/proc.txt
if you want to include it.

-- 
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.


More information about the openssh-bugs mailing list