[lkml]   [2017]   [Sep]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] tsacct: Fix a truncation bug in taskstats
The KB_MASK is used to hide the low bits which prevent an information
leak about keyboard timing etc. The problem is that it's a 32 bit mask
instead of 64 bits so it zeroes out the high 32 bits as well.

Fixes: 58c3c3aa01b4 ("Make taskstats round statistics down to nearest 1k bytes/events")
Signed-off-by: Dan Carpenter <>

diff --git a/kernel/tsacct.c b/kernel/tsacct.c
index 370724b45391..ea9375c94126 100644
--- a/kernel/tsacct.c
+++ b/kernel/tsacct.c
@@ -87,7 +87,7 @@ void bacct_add_tsk(struct user_namespace *user_ns,

#define KB 1024
#define MB (1024*KB)
-#define KB_MASK (~(KB-1))
+#define KB_MASK (~((u64)KB-1))
* fill in extended accounting fields
 \ /
  Last update: 2017-09-08 12:44    [W:0.028 / U:18.188 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site