From owner-freebsd-bugs@freebsd.org Sun Oct 22 21:57:31 2017 Return-Path: Delivered-To: freebsd-bugs@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 6E999E37449 for ; Sun, 22 Oct 2017 21:57:31 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5485E765F3 for ; Sun, 22 Oct 2017 21:57:31 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id v9MLvUrh032125 for ; Sun, 22 Oct 2017 21:57:31 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 221337] -fsanitize=address (asan) fails on i386 Date: Sun, 22 Oct 2017 21:57:30 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: dim@FreeBSD.org X-Bugzilla-Status: In Progress X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: dim@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: assigned_to bug_status attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 21:57:31 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D221337 Dimitry Andric changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|freebsd-bugs@FreeBSD.org |dim@FreeBSD.org Status|Open |In Progress --- Comment #10 from Dimitry Andric --- Created attachment 187379 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D187379&action= =3Dedit Ensure alignment of jemalloc's TSD is 8 bytes on 32-bit platforms Here is a possible way of fixing this issue: it ensures that the big tsd_t struct in contrib/jemalloc/src/tsd.c is aligned to 8 bytes, on !LP64 platfo= rms (i.e. i386, but it could also apply to arm or mips, if AddressSanitizer ever gets to work there). Before r319971, on i386 the TLS items in libc.so.7 added up to 80 bytes of storage (a multiple of 8 bytes), assuming __je_tsd_initialized is aligned a= t 4 bytes: $ readelf -sW /usr/obj/head-r319970/usr/src/lib/libc/libc.so.7|grep -w TLS 1139: 00000058 4 TLS GLOBAL DEFAULT 17 _ThreadRuneLocale@@FBSD_= 1.3 547: 00000054 4 TLS LOCAL DEFAULT 17 __thread_locale 607: 00000000 64 TLS LOCAL DEFAULT 16 __je_tsd_tls 608: 0000004c 1 TLS LOCAL DEFAULT 17 __je_tsd_initialized 3088: 00000058 4 TLS GLOBAL DEFAULT 17 _ThreadRuneLocale With r319971, this increased quite a lot, to 2404 bytes (which is not a multiple of 8 bytes anymore, unfortunately): $ readelf -sW /usr/obj/head-r319971/usr/src/lib/libc/libc.so.7|grep -w TLS 1139: 0000096c 4 TLS GLOBAL DEFAULT 17 _ThreadRuneLocale@@FBSD_= 1.3 441: 00000968 4 TLS LOCAL DEFAULT 17 __thread_locale 500: 00000000 2388 TLS LOCAL DEFAULT 16 __je_tsd_tls 502: 00000960 1 TLS LOCAL DEFAULT 17 __je_tsd_initialized 2845: 0000096c 4 TLS GLOBAL DEFAULT 17 _ThreadRuneLocale All the growth is in the __je_tsd_tls struct, as you can see. If this stru= ct is forced to align to 8 bytes, the total amount of TLS data also becomes aligned to 8 bytes. An alternative would be to unconditionally align the struct at, say, 16 byt= es, and get rid of the #ifdef. Yet another alternative would be to place some bogus padding 4 byte entity somewhere else in libc.so to ensure the TLS data is a multiple of 8 bytes.= =20 Suggestions as to where are welcome. :) --=20 You are receiving this mail because: You are the assignee for the bug.=