From owner-freebsd-bugs Tue Sep 17 9:20: 5 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 897DA37B401 for ; Tue, 17 Sep 2002 09:20:02 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id E162E43E6E for ; Tue, 17 Sep 2002 09:20:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g8HGK1JU003563 for ; Tue, 17 Sep 2002 09:20:01 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id g8HGK1iA003562; Tue, 17 Sep 2002 09:20:01 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B9C9937B404 for ; Tue, 17 Sep 2002 09:13:38 -0700 (PDT) Received: from habitat.procplace.com (habitat.procplace.com [65.208.17.199]) by mx1.FreeBSD.org (Postfix) with SMTP id 3ABF843E42 for ; Tue, 17 Sep 2002 09:13:38 -0700 (PDT) (envelope-from karl@habitat.procplace.com) Received: (qmail 20869 invoked by uid 1000); 17 Sep 2002 16:13:34 -0000 Message-Id: <20020917161334.20862.qmail@habitat.procplace.com> Date: 17 Sep 2002 16:13:34 -0000 From: Karl Lehenbauer Reply-To: Karl Lehenbauer To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: kern/42875: gettimeofday super rarely returns an impossible tv_usec value Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 42875 >Category: kern >Synopsis: gettimeofday super rarely returns an impossible tv_usec value >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Sep 17 09:20:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Karl Lehenbauer >Release: FreeBSD 4.6-STABLE i386 >Organization: Procplace.com, Inc. >Environment: System: FreeBSD habitat.procplace.com 4.6-STABLE FreeBSD 4.6-STABLE #3: Mon Aug 5 22:36:39 CDT 2002 dbaker@habitat.procplace.com:/usr/local/dbakerspawn/builds/obj/RELENG_4/usr/local/dbakerspawn/RELENG/4/src/sys/2UIAHPROCPLACE i386 >Description: Maybe one in thirty million times, gettimeofday will return an invalid tv_usec value (microseconds). It should ALWAYS be between 0 and 999999, but it is occasionally a very large negative number. >How-To-Repeat: Compile this program and let it run for a super long time. Preferably use a machine that is actually doing stuff. /* detect freebsd gettimeofday bug */ #include #include #include check() { struct timeval tv; if (gettimeofday(&tv, NULL) == -1) { perror("gettimeofday"); return; } if (tv.tv_usec < 0 || tv.tv_usec >= 1000000) { printf("cazart! gettimeofday returned impossible tv_usec value of %d\n", tv.tv_usec); } } main() { int i; for (i = 0; i < 1000000; i++) { int j; for (j = 0; i < 100; j++) { check(); } usleep((i % 8) + 1); } } >Fix: Locate and repair bug in kernel that allows invalid tv_usec calls to be returned. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message