Commit aa550c0d authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] fix HZ leaking to userspace in BSD accounting

From: Tim Schmielau <tim@physik3.uni-rostock.de>

BSD accounting was missed in the conversion from HZ to USER_HZ.  I thought
nobody cared, but apparently there are still users to it.
parent 65a0fc80
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include <linux/security.h> #include <linux/security.h>
#include <linux/vfs.h> #include <linux/vfs.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/times.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/div64.h> #include <asm/div64.h>
#include <linux/blkdev.h> /* sector_div */ #include <linux/blkdev.h> /* sector_div */
...@@ -336,13 +337,13 @@ static void do_acct_process(long exitcode, struct file *file) ...@@ -336,13 +337,13 @@ static void do_acct_process(long exitcode, struct file *file)
strlcpy(ac.ac_comm, current->comm, sizeof(ac.ac_comm)); 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 ? ac.ac_etime = encode_comp_t(elapsed < (unsigned long) -1l ?
(unsigned long) 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_btime = xtime.tv_sec - elapsed;
ac.ac_utime = encode_comp_t(current->utime); ac.ac_utime = encode_comp_t(jiffies_to_clock_t(current->utime));
ac.ac_stime = encode_comp_t(current->stime); ac.ac_stime = encode_comp_t(jiffies_to_clock_t(current->stime));
/* we really need to bite the bullet and change layout */ /* we really need to bite the bullet and change layout */
ac.ac_uid = current->uid; ac.ac_uid = current->uid;
ac.ac_gid = current->gid; ac.ac_gid = current->gid;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment