Re: Linux 2.2.14pre7

Andrea Arcangeli (andrea@suse.de)
Sun, 21 Nov 1999 03:42:58 +0100 (CET)


On Thu, 18 Nov 1999, Alan Cox wrote:

>2.2.14pre6
[..]
>o Fix to oom changes in ptrace for kills (Dave Miller)

I disagree with this patch inserted in 2.2.13pre6:

diff -urN 2.2.14pre4/arch/alpha/kernel/ptrace.c 2.2.14pre7/arch/alpha/kernel/ptrace.c
--- 2.2.14pre4/arch/alpha/kernel/ptrace.c Fri Nov 5 18:48:54 1999
+++ 2.2.14pre7/arch/alpha/kernel/ptrace.c Sun Nov 21 03:31:29 1999
@@ -159,7 +159,7 @@
if (fault > 0)
goto repeat;
if (fault < 0)
- force_sig(SIGKILL, current);
+ force_sig(SIGKILL, tsk);
return 0;
}
if (pgd_bad(*pgdir)) {
@@ -173,7 +173,7 @@
if (fault > 0)
goto repeat;
if (fault < 0)
- force_sig(SIGKILL, current);
+ force_sig(SIGKILL, tsk);
return 0;
}
if (pmd_bad(*pgmiddle)) {
@@ -187,7 +187,7 @@
if (fault > 0)
goto repeat;
if (fault < 0)
- force_sig(SIGKILL, current);
+ force_sig(SIGKILL, tsk);
return 0;
}
page = pte_page(*pgtable);
@@ -224,7 +224,7 @@
if (fault > 0)
goto repeat;
if (fault < 0)
- force_sig(SIGKILL, current);
+ force_sig(SIGKILL, tsk);
return;
}
if (pgd_bad(*pgdir)) {
@@ -238,7 +238,7 @@
if (fault > 0)
goto repeat;
if (fault < 0)
- force_sig(SIGKILL, current);
+ force_sig(SIGKILL, tsk);
return;
}
if (pmd_bad(*pgmiddle)) {
@@ -252,7 +252,7 @@
if (fault > 0)
goto repeat;
if (fault < 0)
- force_sig(SIGKILL, current);
+ force_sig(SIGKILL, tsk);
return;
}
page = pte_page(*pgtable);
@@ -261,7 +261,7 @@
if (fault > 0)
goto repeat;
if (fault < 0)
- force_sig(SIGKILL, current);
+ force_sig(SIGKILL, tsk);
return;
}

diff -urN 2.2.14pre4/arch/i386/kernel/ptrace.c 2.2.14pre7/arch/i386/kernel/ptrace.c
--- 2.2.14pre4/arch/i386/kernel/ptrace.c Fri Nov 5 18:48:54 1999
+++ 2.2.14pre7/arch/i386/kernel/ptrace.c Sun Nov 21 03:31:29 1999
@@ -89,7 +89,7 @@
if (fault > 0)
goto repeat;
if (fault < 0)
- force_sig(SIGKILL, current);
+ force_sig(SIGKILL, tsk);
return 0;
}
if (pgd_bad(*pgdir)) {
@@ -103,7 +103,7 @@
if (fault > 0)
goto repeat;
if (fault < 0)
- force_sig(SIGKILL, current);
+ force_sig(SIGKILL, tsk);
return 0;
}
if (pmd_bad(*pgmiddle)) {
@@ -117,7 +117,7 @@
if (fault > 0)
goto repeat;
if (fault < 0)
- force_sig(SIGKILL, current);
+ force_sig(SIGKILL, tsk);
return 0;
}
page = pte_page(*pgtable);
@@ -153,7 +153,7 @@
if (fault > 0)
goto repeat;
if (fault < 0)
- force_sig(SIGKILL, current);
+ force_sig(SIGKILL, tsk);
return;
}
if (pgd_bad(*pgdir)) {
@@ -167,7 +167,7 @@
if (fault > 0)
goto repeat;
if (fault < 0)
- force_sig(SIGKILL, current);
+ force_sig(SIGKILL, tsk);
return;
}
if (pmd_bad(*pgmiddle)) {
@@ -181,7 +181,7 @@
if (fault > 0)
goto repeat;
if (fault < 0)
- force_sig(SIGKILL, current);
+ force_sig(SIGKILL, tsk);
return;
}
page = pte_page(*pgtable);
@@ -190,7 +190,7 @@
if (fault > 0)
goto repeat;
if (fault < 0)
- force_sig(SIGKILL, current);
+ force_sig(SIGKILL, tsk);
return;
}
/* this is a hack for non-kernel-mapped video buffers and similar */

The 2.2.14pre5 behaviour is _very_ intentional.

It's the ptrace task that cause the fault and if something goes OOM then
it's _gdb_ and _not_ the innocent ptraced task that must be killed.

The task to kill during OOM is _always_ the task that is trashing memory
and not the idle one.

Andrea

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/