From owner-freebsd-bugs@freebsd.org Thu Feb 14 22:17:37 2019 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4756314E3E03 for ; Thu, 14 Feb 2019 22:17:37 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id D1EE28E6E7 for ; Thu, 14 Feb 2019 22:17:36 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id 8B8DE14E3E02; Thu, 14 Feb 2019 22:17:36 +0000 (UTC) Delivered-To: bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68DA014E3E01 for ; Thu, 14 Feb 2019 22:17:36 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.ysv.freebsd.org (mxrelay.ysv.freebsd.org [IPv6:2001:1900:2254:206a::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.ysv.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0615C8E6E4 for ; Thu, 14 Feb 2019 22:17:36 +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 mxrelay.ysv.freebsd.org (Postfix) with ESMTPS id 3DCFA382E for ; Thu, 14 Feb 2019 22:17:35 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id x1EMHZmF043332 for ; Thu, 14 Feb 2019 22:17:35 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id x1EMHZ7R043331 for bugs@FreeBSD.org; Thu, 14 Feb 2019 22:17:35 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 235751] Failure to init TLS variables with func ptr inside shared lib Date: Thu, 14 Feb 2019 22:17:34 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 12.0-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: dclarke@blastwave.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: 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.29 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Feb 2019 22:17:37 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D235751 Bug ID: 235751 Summary: Failure to init TLS variables with func ptr inside shared lib Product: Base System Version: 12.0-RELEASE Hardware: powerpc OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: dclarke@blastwave.org This is the exact same problem as described in Bug 161344. Re-discovered this because libmpfr 4.0.2 fails most of its tests unless one disables thread local storage.=20 hydra$ uname -a=20 FreeBSD hydra 12.0-RELEASE FreeBSD 12.0-RELEASE r341666 GENERIC powerpc hydra$ echo $CC /usr/local/bin/gcc8 hydra$ echo $CFLAGS=20 -g -m64 -std=3Dc99 -fno-builtin -O0 -mcpu=3D970 -mcall-freebsd -mno-altivec -mno-float128 -mno-float128-hardware -mfull-toc -mregnames -fno-unsafe-math-optimizations hydra$ cat -n t1.c 1 2 int f(int x) { 3 return x; 4 } 5 struct s_t { 6 int (*func)(int); 7 }; 8 struct s_t __thread x =3D { f }; 9 10 hydra$=20 hydra$ cat -n t2.c 1 2 3 struct s_t { 4 int (*func)(int); 5 }; 6 extern struct s_t __thread x; 7 int main(int argc, const char *argv[]) { 8 return (*x.func)(argc); 9 } 10 hydra$=20 hydra$ $CC $CFLAGS -shared -o t1.so -fPIC t1.c hydra$ $CC $CFLAGS -o foo t2.c t1.so hydra$ LD_LIBRARY_PATH=3D. ./foo Segmentation fault (core dumped) hydra$ hydra$ gdb foo foo.core GNU gdb (GDB) 8.2.1 [GDB v8.2.1 for FreeBSD] Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "powerpc64-portbld-freebsd12.0". Type "show configuration" for configuration details. For bug reporting instructions, please see: . Find the GDB manual and other documentation resources online at: . For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from foo...done. [New LWP 100253] Core was generated by `./foo'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x0000000010000a1c in main (argc=3D1, argv=3D0x3fffffffffffd7f0) at t2.= c:8 8 return (*x.func)(argc); (gdb) where #0 0x0000000010000a1c in main (argc=3D1, argv=3D0x3fffffffffffd7f0) at t2.= c:8 (gdb) list 3 struct s_t { 4 int (*func)(int); 5 }; 6 extern struct s_t __thread x; 7 int main(int argc, const char *argv[]) { 8 return (*x.func)(argc); 9 } 10 (gdb) quit However the problem goes away entirely with r344130. Also tested the situation with mpfr 4.0.2 and TLS seems to work with r34413= 0. --=20 You are receiving this mail because: You are the assignee for the bug.=