Accepting request 53215 from Base:System
Accepted submit request 53215 from user dirkmueller OBS-URL: https://build.opensuse.org/request/show/53215 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/openssh?expand=0&rev=56
This commit is contained in:
parent
565357ab42
commit
17c1bf6665
@ -1,17 +0,0 @@
|
||||
--- openbsd-compat/port-linux.c.orig
|
||||
+++ openbsd-compat/port-linux.c
|
||||
@@ -208,12 +208,12 @@ ssh_selinux_change_context(const char *n
|
||||
#endif /* WITH_SELINUX */
|
||||
|
||||
#ifdef LINUX_OOM_ADJUST
|
||||
-#define OOM_ADJ_PATH "/proc/self/oom_adj"
|
||||
+#define OOM_ADJ_PATH "/proc/self/oom_score_adj"
|
||||
/*
|
||||
* The magic "don't kill me", as documented in eg:
|
||||
* http://lxr.linux.no/#linux+v2.6.32/Documentation/filesystems/proc.txt
|
||||
*/
|
||||
-#define OOM_ADJ_NOKILL -17
|
||||
+#define OOM_ADJ_NOKILL -1000
|
||||
|
||||
static int oom_adj_save = INT_MIN;
|
||||
|
94
openssh-linux-new-oomkill.patch
Normal file
94
openssh-linux-new-oomkill.patch
Normal file
@ -0,0 +1,94 @@
|
||||
Index: openbsd-compat/port-linux.c
|
||||
===================================================================
|
||||
RCS file: /home/dtucker/openssh/cvs/openssh/openbsd-compat/port-linux.c,v
|
||||
retrieving revision 1.9
|
||||
diff -u -p -r1.9 port-linux.c
|
||||
--- openbsd-compat/port-linux.c 10 Sep 2010 00:30:25 -0000 1.9
|
||||
+++ openbsd-compat/port-linux.c 16 Nov 2010 05:10:13 -0000
|
||||
@@ -208,14 +208,21 @@ ssh_selinux_change_context(const char *n
|
||||
#endif /* WITH_SELINUX */
|
||||
|
||||
#ifdef LINUX_OOM_ADJUST
|
||||
-#define OOM_ADJ_PATH "/proc/self/oom_adj"
|
||||
/*
|
||||
- * The magic "don't kill me", as documented in eg:
|
||||
+ * The magic "don't kill me" values, old and new, as documented in eg:
|
||||
* http://lxr.linux.no/#linux+v2.6.32/Documentation/filesystems/proc.txt
|
||||
+ * http://lxr.linux.no/#linux+v2.6.36/Documentation/filesystems/proc.txt
|
||||
*/
|
||||
-#define OOM_ADJ_NOKILL -17
|
||||
|
||||
static int oom_adj_save = INT_MIN;
|
||||
+static char *oom_adj_path = NULL;
|
||||
+struct {
|
||||
+ char *path;
|
||||
+ int value;
|
||||
+} oom_adjust[] = {
|
||||
+ {"/proc/self/oom_score_adj", -1000}, /* new values, 2.6.36 and up */
|
||||
+ {"/proc/self/oom_adj", -17}, /* old values, 2.6.35 and down */
|
||||
+};
|
||||
|
||||
/*
|
||||
* Tell the kernel's out-of-memory killer to avoid sshd.
|
||||
@@ -224,23 +231,31 @@ static int oom_adj_save = INT_MIN;
|
||||
void
|
||||
oom_adjust_setup(void)
|
||||
{
|
||||
+ int i, value;
|
||||
FILE *fp;
|
||||
|
||||
debug3("%s", __func__);
|
||||
- if ((fp = fopen(OOM_ADJ_PATH, "r+")) != NULL) {
|
||||
- if (fscanf(fp, "%d", &oom_adj_save) != 1)
|
||||
- verbose("error reading %s: %s", OOM_ADJ_PATH, strerror(errno));
|
||||
- else {
|
||||
- rewind(fp);
|
||||
- if (fprintf(fp, "%d\n", OOM_ADJ_NOKILL) <= 0)
|
||||
- verbose("error writing %s: %s",
|
||||
- OOM_ADJ_PATH, strerror(errno));
|
||||
- else
|
||||
- verbose("Set %s from %d to %d",
|
||||
- OOM_ADJ_PATH, oom_adj_save, OOM_ADJ_NOKILL);
|
||||
+ for (i = 0; i < 2; i++) {
|
||||
+ oom_adj_path = oom_adjust[i].path;
|
||||
+ value = oom_adjust[i].value;
|
||||
+ if ((fp = fopen(oom_adj_path, "r+")) != NULL) {
|
||||
+ if (fscanf(fp, "%d", &oom_adj_save) != 1)
|
||||
+ verbose("error reading %s: %s", oom_adj_path,
|
||||
+ strerror(errno));
|
||||
+ else {
|
||||
+ rewind(fp);
|
||||
+ if (fprintf(fp, "%d\n", value) <= 0)
|
||||
+ verbose("error writing %s: %s",
|
||||
+ oom_adj_path, strerror(errno));
|
||||
+ else
|
||||
+ verbose("Set %s from %d to %d",
|
||||
+ oom_adj_path, oom_adj_save, value);
|
||||
+ }
|
||||
+ fclose(fp);
|
||||
+ return;
|
||||
}
|
||||
- fclose(fp);
|
||||
}
|
||||
+ oom_adj_path = NULL;
|
||||
}
|
||||
|
||||
/* Restore the saved OOM adjustment */
|
||||
@@ -250,13 +265,14 @@ oom_adjust_restore(void)
|
||||
FILE *fp;
|
||||
|
||||
debug3("%s", __func__);
|
||||
- if (oom_adj_save == INT_MIN || (fp = fopen(OOM_ADJ_PATH, "w")) == NULL)
|
||||
+ if (oom_adj_save == INT_MIN || oom_adj_save == NULL ||
|
||||
+ (fp = fopen(oom_adj_path, "w")) == NULL)
|
||||
return;
|
||||
|
||||
if (fprintf(fp, "%d\n", oom_adj_save) <= 0)
|
||||
- verbose("error writing %s: %s", OOM_ADJ_PATH, strerror(errno));
|
||||
+ verbose("error writing %s: %s", oom_adj_path, strerror(errno));
|
||||
else
|
||||
- verbose("Set %s to %d", OOM_ADJ_PATH, oom_adj_save);
|
||||
+ verbose("Set %s to %d", oom_adj_path, oom_adj_save);
|
||||
|
||||
fclose(fp);
|
||||
return;
|
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Nov 16 14:45:14 UTC 2010 - cristian.rodriguez@opensuse.org
|
||||
|
||||
- Use upstream oom_adj is deprecated patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Nov 2 13:25:19 UTC 2010 - coolo@novell.com
|
||||
|
||||
|
@ -63,7 +63,7 @@ Patch16: %{name}-%{version}-pts.diff
|
||||
Patch17: %{name}-%{version}-homechroot.patch
|
||||
Patch18: %{name}-%{version}-sshconfig-knownhostschanges.diff
|
||||
Patch19: %{name}-%{version}-host_ident.diff
|
||||
Patch20: openssh-deprecated-oom_adj.patch
|
||||
Patch20: openssh-linux-new-oomkill.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
|
||||
%package askpass
|
||||
|
Loading…
Reference in New Issue
Block a user