From patchwork Wed Nov 13 19:03:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 291016 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "maxx.shmoo.com", Issuer "CA Cert Signing Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 99CEA2C00A3 for ; Thu, 14 Nov 2013 06:04:12 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 503DC9C141; Wed, 13 Nov 2013 14:04:09 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 54K9r+e3orLx; Wed, 13 Nov 2013 14:04:09 -0500 (EST) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id C8BEF9C151; Wed, 13 Nov 2013 14:04:04 -0500 (EST) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 792DA9C151 for ; Wed, 13 Nov 2013 14:04:03 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8x03M2reJ4SP for ; Wed, 13 Nov 2013 14:03:58 -0500 (EST) Received: from sipsolutions.net (s3.sipsolutions.net [144.76.43.152]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id C50019C141 for ; Wed, 13 Nov 2013 14:03:58 -0500 (EST) Received: by sipsolutions.net with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1VgfjI-0000ev-QO; Wed, 13 Nov 2013 20:03:57 +0100 Message-ID: <1384369434.14578.29.camel@jlt4.sipsolutions.net> Subject: Re: [RFC/RFT] use monotonic clock for relative time where available From: Johannes Berg To: Holger Schurig Date: Wed, 13 Nov 2013 20:03:54 +0100 In-Reply-To: <1384361409.14578.12.camel@jlt4.sipsolutions.net> References: <1384361409.14578.12.camel@jlt4.sipsolutions.net> X-Mailer: Evolution 3.8.5-2 Mime-Version: 1.0 Cc: "hostap@lists.shmoo.com" X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com On Wed, 2013-11-13 at 17:50 +0100, Johannes Berg wrote: > From: Johannes Berg > > Relative time shouldn't be calculated based on gettimeofday > because that clock can jump (e.g. when the time is adjusted > by the system administrator.) > > On systems where that is available, use CLOCK_BOOTTIME (on > fairly recent Linux systems, this clock takes into account > the time spend suspended) or CLOCK_MONOTONIC (on Linux and > some POSIX systems, this clock is just freely running with > no adjustments.) > > Unfortunately this patch is invasive since a lot of places > need to be adjusted to use os_get_reltime() rather than > os_get_time() that is used now. However, not all instances > should use the other clock, e.g. absolute time needed in > any certificate checking and similar needs to be wall time. > > TODO: carefully check all replacements to see if any should > actually be using os_get_time() instead! FWIW, with this patch, tests are passing (still running) when I add this patch to my vm runner script: With this clock modification and an unmodified wpa_s, it totally fails. johannes --- a/tests/hwsim/vm/inside.sh +++ b/tests/hwsim/vm/inside.sh @@ -56,6 +56,13 @@ ip link set lo up mkdir /tmp/logs mount -t 9p -o trans=virtio,rw logshare /tmp/logs +( + while sleep 1 ; do + date --set "@$(($(date +%s) + 19))" + date >/dev/ttyS0 + done +) & + # check if we're rebooting due to a kernel panic ... if grep -q 'Kernel panic' /tmp/logs/console ; then echo "KERNEL CRASHED!" >/dev/ttyS0