Index: sshd.c =================================================================== --- sshd.c +++ sshd.c @@ -46,6 +46,7 @@ #include #include +#include #include #ifdef HAVE_SYS_STAT_H # include @@ -2026,6 +2027,10 @@ /* Reinitialize the log (because of the fork above). */ log_init(__progname, options.log_level, options.log_facility, log_stderr); + /* Avoid killing the process in high-pressure swapping environments. */ + if (!inetd_flag && madvise(NULL, 0, MADV_PROTECT) != 0) + debug("madvise(): %.200s", strerror(errno)); + /* * Chdir to the root directory so that the current disk can be * unmounted if desired.