From owner-svn-src-head@FreeBSD.ORG Sun Mar 24 02:40:50 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5ED495D9; Sun, 24 Mar 2013 02:40:50 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) by mx1.freebsd.org (Postfix) with ESMTP id 26295783; Sun, 24 Mar 2013 02:40:50 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7::6d96:13f4:4bd2:7ac6] (unknown [IPv6:2001:7b8:3a7:0:6d96:13f4:4bd2:7ac6]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 74F075C5B; Sun, 24 Mar 2013 03:40:45 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) Subject: Re: svn commit: r248672 - head/lib/libc/stdtime From: Dimitry Andric In-Reply-To: <201303240135.r2O1Zb95065964@svn.freebsd.org> Date: Sun, 24 Mar 2013 03:40:33 +0100 Content-Transfer-Encoding: 7bit Message-Id: <40FB115A-AE6E-4BB4-AE47-50C1491F3CE2@FreeBSD.org> References: <201303240135.r2O1Zb95065964@svn.freebsd.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Mailer: Apple Mail (2.1503) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Mar 2013 02:40:50 -0000 On Mar 24, 2013, at 02:35, Dimitry Andric wrote: > Author: dim > Date: Sun Mar 24 01:35:37 2013 > New Revision: 248672 > URL: http://svnweb.freebsd.org/changeset/base/248672 > > Log: > Compile contrib/tzcode/stdtime/localtime.c with -fwrapv, since it relies > on signed integer overflow wrapping. Otherwise mktime(3) and timegm(3) > can hang, in case the timestamp passed in struct tm is not representable > in a time_t. Specifically, any timestamp after 2038-01-19 03:14:07, in > combination with a 32-bit time_t. I first noticed this when Squid on a i386 machine started to hang every now and then, and started consuming 100% CPU in such cases. After rebuilding Squid with debug info, I found it hung in timegm(3), because some web servers apparently like to pass Last-Modified dates of "Fri, 31 Dec 9999 23:59:59 GMT", most likely to prevent caching. Note this is not an issue on amd64, since time_t is 64-bit there, so even a struct tm with tm_year=INT_MAX would work with mktime(3) and timegm().