posix-timers: fix RLIMIT_CPU && fork()
authorOleg Nesterov <oleg@redhat.com>
Fri, 27 Mar 2009 00:06:07 +0000 (01:06 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 8 Apr 2009 15:51:38 +0000 (17:51 +0200)
commit6279a751fe096a21dc7704e918d570d3ff06e769
tree2b24e0ecf004802a890f77195489f8aa76fa745d
parent633fe795b80693a8198e7d82f66538a72d2bbba2
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@inbox.ru>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Peter Lojkin <ia6432@inbox.ru>
Cc: Roland McGrath <roland@redhat.com>
Cc: stable@kernel.org
LKML-Reference: <20090327000607.GA10104@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/fork.c