]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit - kernel/time/posix-cpu-timers.c
posix timers: fix RLIMIT_CPU && fork()
authorOleg Nesterov <oleg@redhat.com>
Mon, 23 Mar 2009 19:34:11 +0000 (20:34 +0100)
committerIngo Molnar <mingo@elte.hu>
Mon, 23 Mar 2009 19:43:35 +0000 (20:43 +0100)
commit37bebc70d7ad4144c571d74500db3bb26ec0c0eb
tree856ed72491c8e650dd4ad8f56d57bda4881fa231
parentd56ffd38a93841a07c839a375049a56b51e9567c
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 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
  task_cputime_zero(signal->cputime_expires)

Reported-by: Peter Lojkin <ia6432@inbox.ru>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Roland McGrath <roland@redhat.com>
Cc: <stable@kernel.org> [for 2.6.29.x]
LKML-Reference: <20090323193411.GA17514@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/posix-cpu-timers.c