[PATCH] fix oom_kill_task

From: Colin Leroy
Date: Fri Sep 09 2005 - 10:36:20 EST


Hi,

oom_kill_task's comment states that we should be careful about not sending
SIGKILL to processes with SYS_CAP_RAWIO, then the code happily sends it
anyway.

Here's a patch that fixes that.

Signed-Off-By: Colin Leroy <colin@xxxxxxxxxx>
--- a/mm/oom_kill.c 2005-09-09 17:29:08.000000000 +0200
+++ b/mm/oom_kill.c 2005-09-09 17:29:10.000000000 +0200
@@ -199,7 +199,12 @@ static void __oom_kill_task(task_t *p)
p->time_slice = HZ;
set_tsk_thread_flag(p, TIF_MEMDIE);

- force_sig(SIGKILL, p);
+ /* This process has hardware access, be more careful. */
+ if (cap_t(p->cap_effective) & CAP_TO_MASK(CAP_SYS_RAWIO)) {
+ force_sig(SIGTERM, p);
+ } else {
+ force_sig(SIGKILL, p);
+ }
}

static struct mm_struct *oom_kill_task(task_t *p)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/