lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1317624200-9762-1-git-send-email-djkurtz@chromium.org>
Date:	Mon,  3 Oct 2011 14:43:20 +0800
From:	Daniel Kurtz <djkurtz@...omium.org>
To:	dmitry.torokhov@...il.com
Cc:	linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
	Daniel Kurtz <djkurtz@...omium.org>
Subject: [PATCH] Input: evdev - use monotonic clock for event timestamps

Using wallclock time for event timestamps subjects inter-event timing to
ntp and other clock adjustments.  This complicates userspace drivers
that use these timestamps to calculate velocities, or while processing
state transitions.

Instead, use the kernel monotonic clock for event timestamps, which is
at least guaranteed never to go backwards.

Signed-off-by: Daniel Kurtz <djkurtz@...omium.org>
---
 drivers/input/evdev.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index 4cf2534..118f936 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -94,8 +94,11 @@ static void evdev_event(struct input_handle *handle,
 	struct evdev *evdev = handle->private;
 	struct evdev_client *client;
 	struct input_event event;
+	struct timespec now;
 
-	do_gettimeofday(&event.time);
+	getrawmonotonic(&now);
+	event.time.tv_sec = now.tv_sec;
+	event.time.tv_usec = now.tv_nsec/1000;
 	event.type = type;
 	event.code = code;
 	event.value = value;
-- 
1.7.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ