From owner-freebsd-current@FreeBSD.ORG Tue Jan 13 22:25:02 2015 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A01B1C89 for ; Tue, 13 Jan 2015 22:25:02 +0000 (UTC) Received: from udns.ultimatedns.net (ultimatedns.net [209.180.214.225]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2FDE06BC for ; Tue, 13 Jan 2015 22:25:01 +0000 (UTC) Received: from ultimatedns.net (localhost [127.0.0.1]) by udns.ultimatedns.net (8.14.9/8.14.9) with ESMTP id t0DMNo9L076810 for ; Tue, 13 Jan 2015 14:23:50 -0800 (PST) (envelope-from bsd-lists@bsdforge.com) To: In-Reply-To: References: From: "Chris H" Subject: Re: Connected sanitizer libraries to the build (for x86) Date: Tue, 13 Jan 2015 14:23:50 -0800 Content-Type: text/plain; charset=UTF-8; format=fixed MIME-Version: 1.0 Message-id: <16cb4b4f0ffd697fa913197ba163727d@ultimatedns.net> Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 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: Tue, 13 Jan 2015 22:25:02 -0000 On Tue, 13 Jan 2015 21:28:08 +0100 Dimitry Andric wrote > Hi, > > In r277146, I have connected the sanitizer libraries from compiler-rt to > the build. Currently, this works for i386 and amd64, and contains > Address Sanitizer (ASan) and Undefined Behavior Sanitizer. > > AddressSanitizer is a fast memory error detector [1]. It consists of a > compiler instrumentation module and a run-time library. The tool can > detect the following types of bugs: > > * Out-of-bounds accesses to heap, stack and globals > * Use-after-free > * Use-after-return (to some extent) > * Double-free, invalid free > * Memory leaks (experimental) > > The typical slowdown introduced by AddressSanitizer is 2x. Enable it by > compiling and linking with clang, and using the -fsanitize=address flag. > > Undefined Behavior Sanitizer is a fast and compatible undefined behavior > checker, which enables a number of checks that have small runtime cost > and no impact on address space layout or ABI. Enable it by using the > -fsanitize=undefined flag. [2] > > Please note that the sanitizers still have some rough edges on FreeBSD, > particularly on i386. These will hopefully be smoothed out in the > coming time. Reports of problems (and fixes :) are very welcome, but > please log them in Bugzilla, so they can be tracked. These looks like welcomed addition(s). Thank you, Dimitry! --Chris > > -Dimitry > > [1] http://llvm.org/releases/3.5.0/tools/clang/docs/AddressSanitizer.html > [2] > http://llvm.org/releases/3.5.0/tools/clang/docs/UsersManual.html#opt-fsanitiz