[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#511771: openssh-server: turn off SSHD_OOM_ADJUST for vserver/openvz

Package: openssh-server
Version: 1:5.1p1-4
Severity: wishlist
Tags: patch

See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=487325
(I guess the resolution of that bug report was for sshd to
treat empty $SSHD_OOM_ADJUST the same as unset

This patch to /etc/init.d/ssh turns off SSHD_OOM_ADJUST if
attempting to write to oom_adj would just create useless log

I got the detection method from
but there might be something better.  (I don't know why the
openvz guest kernel doesn't just make oom_adj 0444 instead
of 0644.)

diff --git a/init.d/ssh b/init.d/ssh
index a1cc677..6fa37ad 100755
--- a/init.d/ssh
+++ b/init.d/ssh
@@ -21,6 +21,12 @@ if test -f /etc/default/ssh; then
     . /etc/default/ssh
+# are we in virtual environment that doesn't support modifying
+# /proc/self/oom_adj?
+if grep -q "envID:.*[1-9]" /proc/self/status; then
 . /lib/lsb/init-functions
 if [ -n "$2" ]; then

Reply to: