A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/Perl/perl5/issues/22487 below:

Segmentation fault in Perl_csighandler3 when used XS with threads. · Issue #22487 · Perl/perl5 · GitHub

Hello.

Description
I use perl with libcurl.
libcurl use thread for resolver.

When libcurl resolver thread got signal, Perl_csighandler3 crashed because Perl_csighandler3 cannot find perl.

Program terminated with signal SIGSEGV, Segmentation fault.
Address not mapped to object.
#0  0x00000008218c77f6 in Perl_csighandler3 (sig=1, sip=0x0, uap=0x0) at mg.c:1567
1567               (PL_signals & PERL_SIGNALS_UNSAFE_FLAG))
[Current thread is 1 (LWP 121702)]
(gdb) info threads
  Id   Target Id         Frame 
* 1    LWP 121702        0x00000008218c77f6 in Perl_csighandler3 (sig=1, sip=0x0, uap=0x0)
    at mg.c:1567
  2    LWP 100464        0x00000008238c6368 in _write () from /lib/libc.so.7
(gdb) bt
#0  0x00000008218c77f6 in Perl_csighandler3 (sig=1, sip=0x0, uap=0x0) at mg.c:1567
#1  0x00000008218c779a in Perl_csighandler3 (sig=1, sip=0x0, uap=0x8218c779a <Perl_csighandler3+122>)
    at mg.c:1530
#2  0x00000008243b2b60 in ?? () from /lib/libthr.so.3
#3  0x00000008243b211f in ?? () from /lib/libthr.so.3
#4  <signal handler called>
#5  0x00000008238c60ca in _poll () from /lib/libc.so.7
#6  0x000000082389ec98 in __res_nsend () from /lib/libc.so.7
#7  0x000000082386a532 in ?? () from /lib/libc.so.7
#8  0x000000082386a780 in ?? () from /lib/libc.so.7
#9  0x00000008238691b0 in ?? () from /lib/libc.so.7
#10 0x0000000823879acd in nsdispatch () from /lib/libc.so.7
#11 0x00000008238675fd in ?? () from /lib/libc.so.7
#12 0x000000082386719b in getaddrinfo () from /lib/libc.so.7
#13 0x0000000832d29752 in ?? () from /usr/local/lib/libcurl.so.4
#14 0x0000000832d185f6 in ?? () from /usr/local/lib/libcurl.so.4
#15 0x0000000832d2ce0d in ?? () from /usr/local/lib/libcurl.so.4
#16 0x00000008243a9a7a in ?? () from /lib/libthr.so.3
#17 0x0000000000000000 in ?? ()
Backtrace stopped: Cannot access memory at address 0x849053000
(gdb) info local
my_perl = 0x0

To make sure of this, I added the following to Perl_csighandler3 after dTHX:

if (!my_perl) {
  my_perl = PL_curinterp;
  PERL_SET_THX(my_perl);
}

And the error gone missing.

Perl configuration
Tested on linux and freebsd: 5.32 (linux), 5.34 (freebsd), 3.38 (freebsd)

Characteristics of this binary (from libperl): 
  Compile-time options:
    DEBUGGING
    HAS_TIMES
    MULTIPLICITY
    PERLIO_LAYERS
    PERL_COPY_ON_WRITE
    PERL_DONT_CREATE_GVSV
    PERL_MALLOC_WRAP
    PERL_OP_PARENT
    PERL_PRESERVE_IVUV
    PERL_TRACK_MEMPOOL
    USE_64_BIT_ALL
    USE_64_BIT_INT
    USE_ITHREADS
    USE_LARGE_FILES
    USE_LOCALE
    USE_LOCALE_COLLATE
    USE_LOCALE_CTYPE
    USE_LOCALE_NUMERIC
    USE_LOCALE_TIME
    USE_PERLIO
    USE_PERL_ATOF
    USE_REENTRANT_API
    USE_THREAD_SAFE_LOCALE

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4