[JAUNTY] SRU: UBUNTU: posix timers: fix RLIMIT_CPU && fork()

Manoj Iyer manoj.iyer at canonical.com
Sat Apr 25 02:16:11 UTC 2009


IMPACT: ulimit -t doesn't work in Ubuntu 09.04
FIX: This is a workaround patch for 2.6.28.
TEST: Originator of the bug tested the kernel in 
http://people.ubuntu.com/~manjo/lp361508-jaunty/ and reported to work.

The following changes since commit 
   Tyler Hicks (1):
         UBUNTU: SAUCE: (drop after 2.6.28) [PATCH] eCryptfs: Larger buffer 
for encrypted symlink targets

are available in the git repository at:

   git://kernel.ubuntu.com/manjo/ubuntu-jaunty.git lp361508

Oleg Nesterov (1):
       UBUNTU: posix timers: fix RLIMIT_CPU && fork()

  kernel/posix-cpu-timers.c |    3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)

>From bb56a0cce2d85ada3a2075fb245c2657cc9711de Mon Sep 17 00:00:00 2001
From: Oleg Nesterov <oleg at redhat.com>
Date: Mon, 23 Mar 2009 20:34:11 +0100
Subject: [PATCH] UBUNTU: posix timers: fix RLIMIT_CPU && fork()

BUG: #361508
BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/361508

See http://bugzilla.kernel.org/show_bug.cgi?id=12911

copy_signal() copies signal->rlim, but RLIMIT_CPU is "lost". Because
posix_cpu_timers_init_group() sets cputime_expires.prof_exp = 0 and thus
fastpath_timer_check() returns false unless we have other cpu timers.

This is the minimal fix for 2.6.29 (tested) and 2.6.28. The patch is not
optimal, we need further cleanups here. With this patch update_rlimit_cpu()
is not really needed, but I don't think it should be removed.

The proper fix (I think) is:

 	- set_process_cpu_timer() should just start the cputimer->running
 	  logic (it does), no need to change cputime_expires.xxx_exp

 	- posix_cpu_timers_init_group() should set ->running when needed

 	- fastpath_timer_check() can check ->running instead of

Reported-by: Peter Lojkin <ia6432 at inbox.ru>
Signed-off-by: Oleg Nesterov <oleg at redhat.com>
Cc: Peter Zijlstra <peterz at infradead.org>
Cc: Roland McGrath <roland at redhat.com>
Cc: <stable at kernel.org> [for 2.6.29.x]
LKML-Reference: <20090323193411.GA17514 at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
Signed-off-by: Manoj Iyer <manoj.iyer at canonical.com>

Author:    Oleg Nesterov <oleg at redhat.com>
  kernel/posix-cpu-timers.c |    3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
index 4e5288a..c165985 100644
--- a/kernel/posix-cpu-timers.c
+++ b/kernel/posix-cpu-timers.c
@@ -1333,7 +1333,8 @@ static inline int fastpath_timer_check(struct task_struct *tsk)
  		if (task_cputime_expired(&group_sample, &sig->cputime_expires))
  			return 1;
-	return 0;
+	return sig->rlim[RLIMIT_CPU].rlim_cur != RLIM_INFINITY;


--- manjo

More information about the kernel-team mailing list