[PATCH] tsacct: Fix a truncation bug in taskstats
From: Dan Carpenter
Date: Fri Sep 08 2017 - 06:44:14 EST
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 <dan.carpenter@xxxxxxxxxx>
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
*/