Re: [PATCH] Fix fixpoint divide exception in acct_update_integrals

From: Andrew Morton
Date: Mon Mar 09 2009 - 18:03:31 EST


On Mon, 9 Mar 2009 13:31:59 +0100
Heiko Carstens <heiko.carstens@xxxxxxxxxx> wrote:

> ...
>
> --- linux-2.6.orig/kernel/tsacct.c
> +++ linux-2.6/kernel/tsacct.c
> @@ -122,8 +122,10 @@ void acct_update_integrals(struct task_s
> if (likely(tsk->mm)) {
> cputime_t time, dtime;
> struct timeval value;
> + unsigned long flags;
> u64 delta;
>
> + local_irq_save(flags);
> time = tsk->stime + tsk->utime;
> dtime = cputime_sub(time, tsk->acct_timexpd);
> jiffies_to_timeval(cputime_to_jiffies(dtime), &value);
> @@ -131,10 +133,12 @@ void acct_update_integrals(struct task_s
> delta = delta * USEC_PER_SEC + value.tv_usec;
>
> if (delta == 0)
> - return;
> + goto out;
> tsk->acct_timexpd = time;
> tsk->acct_rss_mem1 += delta * get_mm_rss(tsk->mm);
> tsk->acct_vm_mem1 += delta * tsk->mm->total_vm;
> + out:
> + local_irq_restore(flags);
> }
> }
>

hrm, so we use local-interrupt protection for <something>.

I wonder what we can do to reduce the probability of bugs of this
nature being introduced in the future?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/