rpms/kernel/F-10 linux-2.6-posix-timers-fix-rlimit_cpu-fork-2.patch, NONE, 1.1 kernel.spec, 1.1328, 1.1329

Chuck Ebbert cebbert at fedoraproject.org
Tue Apr 14 14:17:07 UTC 2009


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-10
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv7540

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-posix-timers-fix-rlimit_cpu-fork-2.patch 
Log Message:
Add missing patch for broken RLIMIT_CPU

linux-2.6-posix-timers-fix-rlimit_cpu-fork-2.patch:

--- NEW FILE linux-2.6-posix-timers-fix-rlimit_cpu-fork-2.patch ---
From: Oleg Nesterov <oleg at redhat.com>
Date: Fri, 27 Mar 2009 00:06:07 +0000 (+0100)
Subject: posix-timers: fix RLIMIT_CPU && fork()
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=6279a751fe096a21dc7704e918d570d3ff06e769

posix-timers: fix RLIMIT_CPU && fork()

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 expired cpu timers.

Change copy_signal() to set cputime_expires.prof_exp if we have RLIMIT_CPU.
Also, set cputimer.running = 1 in that case. This is not strictly necessary,
but imho makes sense.

Reported-by: Peter Lojkin <ia6432 at inbox.ru>
Signed-off-by: Oleg Nesterov <oleg at redhat.com>
Acked-by: Peter Zijlstra <peterz at infradead.org>
Cc: Peter Lojkin <ia6432 at inbox.ru>
Cc: Roland McGrath <roland at redhat.com>
Cc: stable at kernel.org
LKML-Reference: <20090327000607.GA10104 at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---

diff --git a/kernel/fork.c b/kernel/fork.c
index 4854c2c..9b51a1b 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -808,6 +808,12 @@ static void posix_cpu_timers_init_group(struct signal_struct *sig)
 	sig->cputime_expires.virt_exp = cputime_zero;
 	sig->cputime_expires.sched_exp = 0;
 
+	if (sig->rlim[RLIMIT_CPU].rlim_cur != RLIM_INFINITY) {
+		sig->cputime_expires.prof_exp =
+			secs_to_cputime(sig->rlim[RLIMIT_CPU].rlim_cur);
+		sig->cputimer.running = 1;
+	}
+
 	/* The timer lists. */
 	INIT_LIST_HEAD(&sig->cpu_timers[0]);
 	INIT_LIST_HEAD(&sig->cpu_timers[1]);
@@ -823,11 +829,8 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
 		atomic_inc(&current->signal->live);
 		return 0;
 	}
-	sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL);
-
-	if (sig)
-		posix_cpu_timers_init_group(sig);
 
+	sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL);
 	tsk->signal = sig;
 	if (!sig)
 		return -ENOMEM;
@@ -865,6 +868,8 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
 	memcpy(sig->rlim, current->signal->rlim, sizeof sig->rlim);
 	task_unlock(current->group_leader);
 
+	posix_cpu_timers_init_group(sig);
+
 	acct_init_pacct(&sig->pacct);
 
 	tty_audit_fork(sig);


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-10/kernel.spec,v
retrieving revision 1.1328
retrieving revision 1.1329
diff -u -r1.1328 -r1.1329
--- kernel.spec	14 Apr 2009 13:39:50 -0000	1.1328
+++ kernel.spec	14 Apr 2009 14:16:35 -0000	1.1329
@@ -703,7 +703,8 @@
 Patch7001: linux-2.6-posix-timers-fix-clock-monotonicity.patch
 # make RLIMIT_CPU work again
 Patch7002: linux-2.6-posix-timers-fix-rlimit_cpu-fork.patch
-Patch7003: linux-2.6-posix-timers-fix-rlimit_cpu-setitimer.patch
+Patch7003: linux-2.6-posix-timers-fix-rlimit_cpu-fork-2.patch
+Patch7004: linux-2.6-posix-timers-fix-rlimit_cpu-setitimer.patch
 
 Patch9000: squashfs3.patch
 Patch9001: squashfs-fixups.patch
@@ -1299,6 +1300,7 @@
 ApplyPatch linux-2.6-mm-define-unique-value-for-as_unevictable.patch
 ApplyPatch linux-2.6-posix-timers-fix-clock-monotonicity.patch
 ApplyPatch linux-2.6-posix-timers-fix-rlimit_cpu-fork.patch
+ApplyPatch linux-2.6-posix-timers-fix-rlimit_cpu-fork-2.patch
 ApplyPatch linux-2.6-posix-timers-fix-rlimit_cpu-setitimer.patch
 
 # we need squashfs3 for Fedora-10
@@ -1890,6 +1892,9 @@
 %kernel_variant_files -k vmlinux %{with_kdump} kdump
 
 %changelog
+* Tue Apr 14 2009 Chuck Ebbert <cebbert at redhat.com> 2.6.29.1-28
+- Add missing patch for broken RLIMIT_CPU
+
 * Tue Apr 14 2009 Chuck Ebbert <cebbert at redhat.com> 2.6.29.1-27
 - Fix warnings/errors in USB cdc-acm modem driver (F11#495446)
 




More information about the scm-commits mailing list