From owner-freebsd-current@freebsd.org Thu Jan 4 19:59:54 2018 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 E4A48EB262D for ; Thu, 4 Jan 2018 19:59:54 +0000 (UTC) (envelope-from k@7he.at) Received: from smtp-01.sil.at (smtp-01-5.sil.at [78.142.186.29]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A355B7CD75 for ; Thu, 4 Jan 2018 19:59:54 +0000 (UTC) (envelope-from k@7he.at) Received: from mx.7he.at ([86.59.13.138]) by smtp-01.sil.at with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1eXBg7-00079a-K8; Thu, 04 Jan 2018 20:59:51 +0100 Received: from [192.168.6.60] ([93.83.242.219]) by mx.7he.at (8.15.2/8.15.2) with ESMTPS id w04Jxn04044317 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 4 Jan 2018 20:59:50 +0100 (CET) (envelope-from k@7he.at) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.99.2 at mx.7he.at Subject: Re: Intel CPU design flaw - FreeBSD affected? // disabling LDTSC To: freebsd-current@freebsd.org, jan.kokemueller@gmail.com References: <9dda0496-be16-35c6-6c45-63d03b218ccb@protected-networks.net> <18376c97-3c0d-49c8-9483-96b95a84f3f1@7he.at> From: "Klaus P. Ohrhallinger" Message-ID: Date: Thu, 4 Jan 2018 20:59:56 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=1.5 required=5.0 tests=HELO_MISC_IP,RDNS_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mx.7he.at X-Scan-Signature: 2eb3c689388ef5a45072784d1e8a9ce2 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.25 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: Thu, 04 Jan 2018 19:59:55 -0000 On 04.01.2018 19:51, Jan Kokemüller wrote: > It is possible to emulate a high resolution counter with a thread that > continuously increments a variable [1]. This is the reason why browser > vendors are currently disabling the SharedArrayBuffer feature [2]. > > [1]: https://gist.github.com/ErikAugust/724d4a969fb2c6ae1bbd7b2a9e3d4bb6#gistcomment-2311156 > [2]: https://blog.mozilla.org/security/2018/01/03/mitigations-landing-new-class-timing-attack/ I tried the phtread example from [1] but even with some tweaking is does not work at all. This is a multiprocessor system, with moderate load. As far as I understand the matter, it can only work if both threads share the same cpu cache, otherwise the counter variable is either never up-to-date, or has to be fetched and stored from/to memory, which is way too slow for this purpose. Any suggestions ? --- CPU: Intel(R) Xeon(R) CPU E5420 @ 2.50GHz (2500.14-MHz K8-class CPU) FreeBSD/SMP: Multiprocessor System Detected: 8 CPUs FreeBSD/SMP: 2 package(s) x 4 core(s)