public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Roland McGrath <roland@redhat.com>
Cc: linux-kernel@vger.kernel.org, jk@ozlabs.org, rusty@rustcorp.com.au
Subject: Re: [PATCH] Fix signal race during process exit
Date: Wed, 9 Jun 2004 19:20:00 -0700	[thread overview]
Message-ID: <20040609192000.78142ba3.akpm@osdl.org> (raw)
In-Reply-To: <200406100148.i5A1mwHl009763@magilla.sf.frob.com>

Roland McGrath <roland@redhat.com> wrote:
>
> Back to the local fix for the case we have hit, the signals produced by
>  update_process_times.  I think the patch below that went in has a bug.
>  Perhaps I've missed something.  It seems to me that clearing it_virt_incr
>  doesn't really cut it, since there will be one more hit before that value
>  is reloaded.  Shouldn't it clear it_virt_value, as it clears it_prof_value?
> 

yup.



As Roland McGrath <roland@redhat.com> points out, we need to zero
task->it_virt_value to prevent timer-based signal delivery, not
->it_virt_incr.

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/kernel/exit.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -puN kernel/exit.c~exit-timer-interrupt-race-fix-fix kernel/exit.c
--- 25/kernel/exit.c~exit-timer-interrupt-race-fix-fix	2004-06-09 19:17:21.138846896 -0700
+++ 25-akpm/kernel/exit.c	2004-06-09 19:17:35.523660072 -0700
@@ -740,7 +740,7 @@ static void exit_notify(struct task_stru
 	 * Clear these here so that update_process_times() won't try to deliver
 	 * itimer, profile or rlimit signals to this task while it is in late exit.
 	 */
-	tsk->it_virt_incr = 0;
+	tsk->it_virt_value = 0;
 	tsk->it_prof_value = 0;
 	tsk->rlim[RLIMIT_CPU].rlim_cur = RLIM_INFINITY;
 
_

>  And btw, as I think someone else mentioned, update_one_process really
>  should be made static so it can be inlined.  It has just the one caller,
>  update_process_times in the same file (kernel/timer.c).

yup.



Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/include/linux/sched.h |    2 --
 25-akpm/kernel/timer.c        |    2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

diff -puN include/linux/sched.h~staticalise-update_one_process include/linux/sched.h
--- 25/include/linux/sched.h~staticalise-update_one_process	2004-06-09 19:16:02.826752144 -0700
+++ 25-akpm/include/linux/sched.h	2004-06-09 19:16:23.919545552 -0700
@@ -176,8 +176,6 @@ long io_schedule_timeout(long timeout);
 extern void cpu_init (void);
 extern void trap_init(void);
 extern void update_process_times(int user);
-extern void update_one_process(struct task_struct *p, unsigned long user,
-			       unsigned long system, int cpu);
 extern void scheduler_tick(int user_tick, int system);
 extern unsigned long cache_decay_ticks;
 
diff -puN kernel/timer.c~staticalise-update_one_process kernel/timer.c
--- 25/kernel/timer.c~staticalise-update_one_process	2004-06-09 19:16:02.855747736 -0700
+++ 25-akpm/kernel/timer.c	2004-06-09 19:16:30.734509520 -0700
@@ -830,7 +830,7 @@ static inline void do_it_prof(struct tas
 	}
 }
 
-void update_one_process(struct task_struct *p, unsigned long user,
+static void update_one_process(struct task_struct *p, unsigned long user,
 			unsigned long system, int cpu)
 {
 	do_process_times(p, user, system);
_


  reply	other threads:[~2004-06-10  2:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-04  1:21 [PATCH] Fix signal race during process exit Roland McGrath
2004-06-04  1:30 ` Andrew Morton
2004-06-10  1:48   ` Roland McGrath
2004-06-10  2:20     ` Andrew Morton [this message]
2004-06-10  2:51     ` Rusty Russell
  -- strict thread matches above, loose matches on Subject: below --
2004-06-02  2:13 Jeremy Kerr
2004-06-02  5:57 ` Andrew Morton
2004-06-02  6:49   ` Rusty Russell
2004-06-02  7:08     ` Andrew Morton
2004-06-02  7:16       ` Andrew Morton
2004-06-02  8:13         ` Jeremy Kerr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040609192000.78142ba3.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=jk@ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roland@redhat.com \
    --cc=rusty@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox