Subject: bug#40477: Segfault with grep-3.4 and pcre-8.44

From: Bruce Dubbs <[email-masked]>
Date: Mon, 6 Apr 2020 22:31:33 -0500

On 4/6/20 6:48 PM, Paul Eggert wrote:
> On 4/6/20 1:54 PM, Bruce Dubbs wrote:
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> 0x000000000041cc03 in __libc_start_main ()
>> (gdb) bt
>> #0  0x000000000041cc03 in __libc_start_main ()
>> #1  0x000000000040715a in _start () at ../sysdeps/x86_64/start.S:120
> 
> You'll have to debug this one, as grep's main function hasn't even 
> started yet so the failure cannot be due to anything in grep's source 
> code. Probably you linked it the wrong way somehow.

It's definitely a problem specific to my system.  I tried it on another 
very similar system with the same gcc, glibc, and build instructions and 
it worked perfectly.

Upon more investigation my problem may be to be due to libsigsegv-2.12. 
If I keep that from being linked into grep it is fine.

I'm passing on this as info.  I don't think it is a grep issue, but in 
case you run into it again I offer the following:

For grep-3.3 (working):
[ /build/grep33/grep-3.3 ]$ ldd src/grep
         linux-vdso.so.1 (0x00007ffc2858b000)
         libpcre.so.1 => /lib/libpcre.so.1 (0x00007fa569942000)
         libsigsegv.so.2 => /usr/lib/libsigsegv.so.2 (0x00007fa56993c000)
         libc.so.6 => /lib/libc.so.6 (0x00007fa569779000)
         /lib64/ld-linux-x86-64.so.2 (0x00007fa5699b8000)

For grep-3.4 (not working):

[ /build/grep/grep-3.4 ]$ ldd src/grep
         linux-vdso.so.1 (0x00007ffded180000)
         libpcre.so.1 => /lib/libpcre.so.1 (0x00007f38dd95e000)
         libsigsegv.so.2 => /usr/lib/libsigsegv.so.2 (0x00007f38dd958000)
         libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f38dd93e000)
         libc.so.6 => /lib/libc.so.6 (0x00007f38dd77b000)
         /lib64/ld-linux-x86-64.so.2 (0x00007f38dd9d4000)

I have no idea why my system is adding libgcc_s.so.1 into the build. I 
did note that the link line included /usr/lib/libc.a.  Removing that 
fixed my problem.

   -- Bruce