netdev
[Top] [All Lists]

[PATCH 2.6 PKT_SCHED]: Fix overflow on 64bit in times reported to usersp

To: "David S. Miller" <davem@xxxxxxxxxxxxx>
Subject: [PATCH 2.6 PKT_SCHED]: Fix overflow on 64bit in times reported to userspace by tc actions
From: Patrick McHardy <kaber@xxxxxxxxx>
Date: Tue, 09 Nov 2004 10:25:49 +0100
Cc: jamal <hadi@xxxxxxxxxx>, netdev@xxxxxxxxxxx
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.3) Gecko/20041008 Debian/1.7.3-5
This patch fixes on overflow in tc actions times reported to
userspace on 64 bit architectures. struct tcf_t only contains
32-bit timestamps, but they are initialized to jiffies. When
jiffies is larger than 2^32-1 only the low 32 bit are saved,
and the diff between jiffies and the current timestamp becomes
very large. This happens immediately after boottime since jiffies
is initialized to 2^32-300. It was invisible until now because
only the lower 32bit were reported to userspace, but with the
USER_HZ conversion the reported times start somewhere around
4294967s.

This patch extends the timestamps to 64bit. It breaks userspace
compatibility for actions, but considering that most of this is
not even in iproute yet this should be acceptable.

Regards
Patrick

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/11/09 09:30:28+01:00 kaber@xxxxxxxxxxxx 
#   [PKT_SCHED]: Fix overflow on 64bit in times reported to userspace by tc 
actions
#   
#   Signed-off-by: Patrick McHardy <kaber@xxxxxxxxx>
# 
# include/linux/pkt_cls.h
#   2004/11/09 09:30:21+01:00 kaber@xxxxxxxxxxxx +3 -3
#   [PKT_SCHED]: Fix overflow on 64bit in times reported to userspace by tc 
actions
#   
#   Signed-off-by: Patrick McHardy <kaber@xxxxxxxxx>
# 
diff -Nru a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h
--- a/include/linux/pkt_cls.h   2004-11-09 09:31:44 +01:00
+++ b/include/linux/pkt_cls.h   2004-11-09 09:31:44 +01:00
@@ -138,9 +138,9 @@
 
 struct tcf_t
 {
-       __u32   install;
-       __u32   lastuse;
-       __u32   expires;
+       __u64   install;
+       __u64   lastuse;
+       __u64   expires;
 };
 
 struct tc_cnt
<Prev in Thread] Current Thread [Next in Thread>