NetBSD Problem Report #58784
From www@netbsd.org Tue Oct 29 00:26:55 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits)
client-signature RSA-PSS (2048 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id C55381A9238
for <gnats-bugs@gnats.NetBSD.org>; Tue, 29 Oct 2024 00:26:55 +0000 (UTC)
Message-Id: <20241029002654.774B11A923B@mollari.NetBSD.org>
Date: Tue, 29 Oct 2024 00:26:54 +0000 (UTC)
From: furkanonder@protonmail.com
Reply-To: furkanonder@protonmail.com
To: gnats-bugs@NetBSD.org
Subject: gcc -pg with pthread causes segmentation fault
X-Send-Pr-Version: www-1.0
>Number: 58784
>Category: port-amd64
>Synopsis: gcc -pg with pthread causes segmentation fault
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: port-amd64-maintainer
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Oct 29 00:30:00 +0000 2024
>Last-Modified: Tue Oct 29 00:35:00 +0000 2024
>Originator: Furkan Onder
>Release: NetBSD 10.0
>Organization:
>Environment:
NetBSD home.localhost 10.0 NetBSD 10.0 (GENERIC) #0: Thu Mar 28 08:33:33 UTC 2024 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
I am experiencing segmentation faults on NetBSD when using the -pg flag with GCC in conjunction with pthreads, specifically when configuring CPython with --enable-profiling.
You can find the related issue for CPython here(https://github.com/python/cpython/issues/126099)
>How-To-Repeat:
Small Example to Reproduce:
➜ ~ cat test.c
#include <pthread.h>
#include <stdio.h>
void* run(void* arg) {
printf("Thread %ld is running.\n", (long)arg);
return NULL;
}
int main(void) {
for (long i = 0; i < 8; i++) {
pthread_t tid;
pthread_create(&tid, NULL, run, (void*)i);
pthread_detach(tid);
}
pthread_exit(NULL);
}
➜ ~ gcc -pg test.c -o test -lpthread
➜ ~ ./test
[1] 13114 segmentation fault (core dumped) ./test
To Reproduce in CPython:
➜ ~ ./configure --with-pydebug --enable-profiling --disable-ipv6 && make
➜ ~ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/lto-wrapper
Target: x86_64--netbsd
Configured with: /usr/src/tools/gcc/../../external/gpl3/gcc/dist/configure --target=x86_64--netbsd --enable-long-long --enable-threads --with-bugurl=http://www.NetBSD.org/support/send-pr.html --with-pkgversion='NetBSD nb2 20230710' --with-system-zlib --without-isl --enable-__cxa_atexit --enable-libstdcxx-time=rt --enable-libstdcxx-threads --with-diagnostics-color=auto-if-env --with-tune=nocona --with-default-libstdcxx-abi=new --with-mpc-lib=/var/obj/mknative/amd64-x86_64/usr/src/external/lgpl3/mpc/lib/libmpc --with-mpfr-lib=/var/obj/mknative/amd64-x86_64/usr/src/external/lgpl3/mpfr/lib/libmpfr --with-gmp-lib=/var/obj/mknative/amd64-x86_64/usr/src/external/lgpl3/gmp/lib/libgmp --with-mpc-include=/usr/src/external/lgpl3/mpc/dist/src --with-mpfr-include=/usr/src/external/lgpl3/mpfr/dist/src --with-gmp-include=/usr/src/external/lgpl3/gmp/lib/libgmp/arch/x86_64 --enable-tls --disable-multilib --disable-libstdcxx-pch --build=x86_64--netbsd --host=x86_64--netbsd --with-sysroot=/var/obj/mkna
tive/amd64-x86_64/usr/src/destdir.amd64
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.5.0 (nb3 20231008)
>Fix:
-
>Audit-Trail:
From: Christos Zoulas <christos@zoulas.com>
To: gnats-bugs@netbsd.org
Cc: port-amd64-maintainer@netbsd.org,
gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org
Subject: Re: port-amd64/58784: gcc -pg with pthread causes segmentation fault
Date: Mon, 28 Oct 2024 20:32:30 -0400
--Apple-Mail=_2803E1BA-E793-474E-8420-5F5BDCE68F18
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=us-ascii
Use -static
christos
--Apple-Mail=_2803E1BA-E793-474E-8420-5F5BDCE68F18
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=signature.asc
Content-Type: application/pgp-signature;
name=signature.asc
Content-Description: Message signed with OpenPGP
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
iF0EARECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCZyAtHgAKCRBxESqxbLM7
OqzwAKCmVfRLXaRzzaOIAtmfTf6PRYF42gCgx40m2AXIVxHP+AhU4cUahhVYvZA=
=ai3/
-----END PGP SIGNATURE-----
--Apple-Mail=_2803E1BA-E793-474E-8420-5F5BDCE68F18--
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.