[PATCH] fix HZ leaking to userspace in BSD accounting

From: Tim Schmielau
Date: Tue Mar 16 2004 - 08:50:30 EST


BSD accounting was missed in the conversion from HZ to USER_HZ.
I thought nobody cared, but apparently there are still users to it.

A larger patch with binary compatible 32 uid/gid support etc. is currently
cooking, but we want to fix this as soon as possible, before distris
pick up 2.6.

Thanks,
Tim


--- linux-2.6.5-rc1/kernel/acct.c 2004-03-11 10:33:04.000000000 +0100
+++ linux-2.6.5-rc1-acct/kernel/acct.c 2004-03-16 13:48:13.000000000 +0100
@@ -52,6 +52,7 @@
#include <linux/security.h>
#include <linux/vfs.h>
#include <linux/jiffies.h>
+#include <linux/times.h>
#include <asm/uaccess.h>
#include <asm/div64.h>
#include <linux/blkdev.h> /* sector_div */
@@ -336,13 +337,13 @@ static void do_acct_process(long exitcod

strlcpy(ac.ac_comm, current->comm, sizeof(ac.ac_comm));

- elapsed = get_jiffies_64() - current->start_time;
+ elapsed = jiffies_64_to_clock_t(get_jiffies_64() - current->start_time);
ac.ac_etime = encode_comp_t(elapsed < (unsigned long) -1l ?
(unsigned long) elapsed : (unsigned long) -1l);
- do_div(elapsed, HZ);
+ do_div(elapsed, USER_HZ);
ac.ac_btime = xtime.tv_sec - elapsed;
- ac.ac_utime = encode_comp_t(current->utime);
- ac.ac_stime = encode_comp_t(current->stime);
+ ac.ac_utime = encode_comp_t(jiffies_to_clock_t(current->utime));
+ ac.ac_stime = encode_comp_t(jiffies_to_clock_t(current->stime));
/* we really need to bite the bullet and change layout */
ac.ac_uid = current->uid;
ac.ac_gid = current->gid;
-
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/