From owner-freebsd-current@freebsd.org Wed Jul 8 10:36:16 2015 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2BCDC996A5B for ; Wed, 8 Jul 2015 10:36:16 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com [209.85.212.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BDF88123E for ; Wed, 8 Jul 2015 10:36:15 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by widjy10 with SMTP id jy10so213078446wid.1 for ; Wed, 08 Jul 2015 03:36:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=9Gn5Vcw35ROSNuf/h6D2lstj4lTMADfQwgl8W1QKpBw=; b=PeeEty2kBWtpJzG89ysoLulkJoOajjo0YNXFudfLR5+WVQ0NX8DahX9mbnYC7MTn0o 6LsVwGrCVIJlFgjh/q+IxxQkogHHSPrHl7h9I05A6pIWX9ot2bUJDgrwQevTUADpWXmY P08FkJ2fqqUvxsg1pWJC4F3vOCam6wgOLKHBh1wE1i8YIjyik7Df3+YL/h018yVZwvcj JSuZZx243Zjw1PvlvZgRAM+osEVEC7PPZHk5GDUb1ZhoDnsZvdrDQVIt/sxFEUmgnPRe Re9Tz86cFQX03sItMyMbpA3igTpVoCEObt2sevZssiBPAa0HsTqeQAInTzwC3PuxzzTa vDgA== X-Gm-Message-State: ALoCoQnU7qsdsgE1KAMpGBQOYPVHoAA6u38+tBXu1he4Hh/4nMVk8o1iIr88gpJSNODXx5eCLlwa MIME-Version: 1.0 X-Received: by 10.194.71.226 with SMTP id y2mr17910145wju.34.1436351768245; Wed, 08 Jul 2015 03:36:08 -0700 (PDT) Received: by 10.194.73.6 with HTTP; Wed, 8 Jul 2015 03:36:08 -0700 (PDT) In-Reply-To: <20150708102137.GZ2080@kib.kiev.ua> References: <201507072241.t67MfsX5085860@hergotha.csail.mit.edu> <94BCDA65-5B86-4329-A312-4CB16E847B69@dons.net.au> <20150708102137.GZ2080@kib.kiev.ua> Date: Wed, 8 Jul 2015 12:36:08 +0200 Message-ID: Subject: Re: gettimeofday((void *)-1, NULL) implicates core dump on recent FreeBSD 11-CURRENT From: Oliver Pinter To: Konstantin Belousov Cc: "O'Connor, Daniel" , Garrett Wollman , freebsd-current@freebsd.org, shawn.webb@hardenedbsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jul 2015 10:36:16 -0000 On 7/8/15, Konstantin Belousov wrote: > On Wed, Jul 08, 2015 at 11:53:39AM +0200, Oliver Pinter wrote: >> On 7/8/15, O'Connor, Daniel wrote: >> > >> >> On 8 Jul 2015, at 08:11, Garrett Wollman >> >> >> >> wrote: >> >> Perhaps the test was (erroneously) written to assume that >> >> gettimeofday() was a system call, and could therefore detect invalid >> >> pointers and return [EFAULT]. This has not been the case for some >> >> time. (In HEAD, not since r237434, which is three years ago.) >> > >> > In defence of the test, the man page says it can return EFAULT. >> >> That's fine, but why changed the behaviour since 2015. May 27.? I have >> an older FreeBSD/HardenedBSD install, where this test passing. See >> some previous email in this thread. > Current implemention detail is that gettimeofday(-1) causes SIGSEGV > if kern.timecounter.hardware=TSC-low and kern.timecounter.fast_gettime=1. > If you timecounter changed for whatever reason, the result of that > call would fluctuate between EFAULT and signal. Thanks Konstantin! Yes, the systems defaults to TSC-low. root@nyi-01 ~# sysctl kern.timecounter.hardware kern.timecounter.hardware: TSC-low root@nyi-01 ~# sysctl kern.timecounter.fast_gettime kern.timecounter.fast_gettime: 1 root@nyi-01 ~# sysctl kern.timecounter.choice kern.timecounter.choice: TSC-low(1000) ACPI-fast(900) HPET(950) i8254(0) dummy(-1000000) Changing to HPET solves the problem: root@nyi-01 ~# sysctl kern.timecounter.hardware=HPET kern.timecounter.hardware: TSC-low -> HPET root@nyi-01 ~# cd /usr/tests/lib/libc/sys root@nyi-01 sys# kyua test gettimeofday_test gettimeofday_test:gettimeofday_err -> passed [0.011s] gettimeofday_test:gettimeofday_mono -> passed [0.012s] Results file id is usr_tests_lib_libc_sys.20150708-103338-126124 Results saved to /root/.kyua/store/results.usr_tests_lib_libc_sys.20150708-103338-126124.db 2/2 passed (0 failed) > > This is not the only test in the test set which checks something that > cannot be reasonably explained. > >> >> > >> > (IMO the man page and test should change..) >> > >> > -- >> > Daniel O'Connor >> > "The nice thing about standards is that there >> > are so many of them to choose from." >> > -- Andrew Tanenbaum >> > GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C >> > >> > >> _______________________________________________ >> freebsd-current@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-current >> To unsubscribe, send any mail to >> "freebsd-current-unsubscribe@freebsd.org" >