mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] -mm check_rlimit oops on p->signal
@ 2004-11-15 20:45 Hugh Dickins
  2004-11-15 23:43 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Hugh Dickins @ 2004-11-15 20:45 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

The p->signal check in account_system_time is insufficient.  If the
timer interrupt hits near the end of exit_notify, after EXIT_ZOMBIE has
been set, another cpu may release_task (NULLifying p->signal) in between
account_system_time's check and check_rlimit's dereference.  Nor should
account_it_prof risk send_sig.  But surely account_user_time is safe?

Signed-off-by: Hugh Dickins <hugh@veritas.com>

--- 2.6.10-rc1-mm5/kernel/sched.c	2004-11-11 12:40:12.000000000 +0000
+++ linux/kernel/sched.c	2004-11-14 20:41:26.851384984 +0000
@@ -2333,8 +2333,7 @@ void account_user_time(struct task_struc
 	p->utime = cputime_add(p->utime, cputime);
 
 	/* Check for signals (SIGVTALRM, SIGPROF, SIGXCPU & SIGKILL). */
-	if (likely(p->signal))
-		check_rlimit(p, cputime);
+	check_rlimit(p, cputime);
 	account_it_virt(p, cputime);
 	account_it_prof(p, cputime);
 
@@ -2362,9 +2361,10 @@ void account_system_time(struct task_str
 	p->stime = cputime_add(p->stime, cputime);
 
 	/* Check for signals (SIGPROF, SIGXCPU & SIGKILL). */
-	if (likely(p->signal))
+	if (likely(p->signal && p->exit_state < EXIT_ZOMBIE)) {
 		check_rlimit(p, cputime);
-	account_it_prof(p, cputime);
+		account_it_prof(p, cputime);
+	}
 
 	/* Add system time to cpustat. */
 	tmp = cputime_to_cputime64(cputime);


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-11-16  0:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-15 20:45 [PATCH] -mm check_rlimit oops on p->signal Hugh Dickins
2004-11-15 23:43 ` Andrew Morton
2004-11-16  0:07   ` Hugh Dickins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®