Bug 1731561

Summary: Inconsistency detected by ld.so: dl-lookup.c: 825: _dl_lookup_symbol_x: Assertion `version != NULL' failed!
Product: [Fedora] Fedora Reporter: bpholman5
Component: glibcAssignee: Carlos O'Donell <codonell>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 29CC: aoliva, arjun.is, codonell, dj, fweimer, law, mfabian, pfrankli, rth, sid
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-07-19 19:28:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description bpholman5 2019-07-19 19:09:37 UTC
Description of problem:

glibc assertion fails (I think it should segfault instead): 
Inconsistency detected by ld.so: dl-lookup.c: 825: _dl_lookup_symbol_x: Assertion `version != NULL' failed!

Short investigation appears to show assertion in source code here: 
https://github.com/bminor/glibc/blob/glibc-2.28/elf/dl-lookup.c


Version-Release number of selected component (if applicable):

[bholman@localhost set-c]$ cat /etc/os-release                                                                                                                                                                     
NAME=Fedora                                                                                                                                                                                                        
VERSION="29 (Workstation Edition)"
ID=fedora
VERSION_ID=29
VERSION_CODENAME=""
PLATFORM_ID="platform:f29"
PRETTY_NAME="Fedora 29 (Workstation Edition)"
ANSI_COLOR="0;34"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:29"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f29/system-administrators-guide/"
SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=29
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=29
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
VARIANT="Workstation Edition"
VARIANT_ID=workstation

[bholman@localhost set-c]$ uname -a
Linux localhost.localdomain 5.1.16-200.fc29.x86_64 #1 SMP Wed Jul 3 16:03:17 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

[bholman@localhost set-c]$ rpm -qa glibc
glibc-2.28-33.fc29.i686
glibc-2.28-33.fc29.x86_64

[bholman@localhost set-c]$ rpm -qa gcc
gcc-8.3.1-2.fc29.x86_64



How reproducible:


Steps to Reproduce:
1. on fedora 29, group install dev tools: 
 dnf groupinstall "Development Tools"

2. verify matching versions (glibc 2.28-33, gcc 8.3.1-2, kernel-5.1.16-200)

3. get copy of my code that fails:
 git clone https://github.com/holmanbph/set-c.git       # stored on git
 cd set-c
 git checkout d410a339fc25fa9192d211d4c032b7e3499b46c8  # this commit produces the error

4. compile code
 make

5. run binary 
 ./test

Actual results:
Running this code produces the glibc assertion error and exits.  This hinders debugging with gdb. 

[bholman@localhost set-c]$ ./test 
set_init() and set_free() passed
PASS - set_member() 
PASS - set_member() 
PASS - set_delete() and set_length() tests 
PASS - abstract data type support tests passed
PASS - union operation tests passed
PASS - intersection operation tests passed
PASS - symmetric difference operation tests passed
PASS - complement operation tests passed
PASS - subset operation tests passed
set length 0
set length 1
set length 2
set length 3
num_adt: 1
printing the set pointers
Inconsistency detected by ld.so: dl-lookup.c: 825: _dl_lookup_symbol_x: Assertion `version != NULL' failed!
[bholman@localhost set-c]$ echo $?
127

Expected results:
This should produce a segfault, which can be used for debugging with gcc.

[bholman@localhost set-c]$ ./test 
set_init() and set_free() passed
PASS - set_member() 
PASS - set_member() 
PASS - set_delete() and set_length() tests 
PASS - abstract data type support tests passed
PASS - union operation tests passed
PASS - intersection operation tests passed
PASS - symmetric difference operation tests passed
PASS - complement operation tests passed
PASS - subset operation tests passed
set length 0
set length 1
set length 2
set length 3
num_adt: 1
printing the set pointers
Segmentation fault (core dumped)
[bholman@localhost set-c]$ echo $?
139


Additional info:
this appears to correctly throw SEGFAULT on fedora 30 with glibc-2.29-15 / gcc-9.1.1-1 / kernel-5.1.12-300

Comment 1 Florian Weimer 2019-07-19 19:28:05 UTC
You are calling a function via function pointer that has an indeterminate value.  (The struct adt_funcs objects are not fully initialized.)  Anything can happen as a result.

Comment 2 bpholman5 2019-07-19 21:41:14 UTC
That's fair.  I expected a SIGSEG rather than a glibc assertion warning.  I suppose that it is an invalid assumption that a segfault will occur.  Thanks!