Bug 219638
Summary: | segfault in sample application | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 4 | Reporter: | Brock Organ <borgan> | ||||||||
Component: | glibc | Assignee: | Jakub Jelinek <jakub> | ||||||||
Status: | CLOSED NOTABUG | QA Contact: | Brian Brock <bbrock> | ||||||||
Severity: | medium | Docs Contact: | |||||||||
Priority: | medium | ||||||||||
Version: | 4.3 | CC: | fweimer, jamisonm | ||||||||
Target Milestone: | --- | ||||||||||
Target Release: | --- | ||||||||||
Hardware: | s390x | ||||||||||
OS: | Linux | ||||||||||
Whiteboard: | |||||||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||||||
Doc Text: | Story Points: | --- | |||||||||
Clone Of: | Environment: | ||||||||||
Last Closed: | 2006-12-14 17:02:25 UTC | Type: | --- | ||||||||
Regression: | --- | Mount Type: | --- | ||||||||
Documentation: | --- | CRM: | |||||||||
Verified Versions: | Category: | --- | |||||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||||
Embargoed: | |||||||||||
Attachments: |
|
Description
Brock Organ
2006-12-14 16:06:42 UTC
Here is the customer's analysis of the problem:
> The problem occours when C++ iostreams are used in a shared object.
> The shared object is being loaded well above the first 4GB of the
> process's address space (around 0x0000020000010000) while the executable
> itself is being loaded in the first 4GB (around 0x0000000080000000).
> The global constructors in the shared library are trying to call a C++
> library support function that was linked into the main executable
> (_ZNSt8ios_base4InitC1Ev) using a "brasl" instruction which is resticted
> to a 32-bit offset. This causes the program to branch to unused memory
> (resulting in a SIGSEGV).
>
> Attached are two files to demonstrate the crash we are observing.
> To compile and run:
>
> g++ -shared -o libprobdemo.so probdemo-so.cc
> g++ -o probdemo probdemo-main.cc -lprobdemo -Wl,-rpath,. -L.
> ./probdemo
>
Created attachment 143649 [details]
main() for program
Created attachment 143650 [details]
script to try different options
Created attachment 143652 [details]
shared library code
User error. s390x doesn't support non-PIC shared libraries (similarly to most other architectures) and even where it is somehow supported it is highly desirable to avoid them. Just compile objects which should be linked into the shared library with -fpic or -fPIC. verified Jakub's suggestion works in this case in our internal environment:
> # g++ -fpic -shared -o libprobdemo.so probdemo-so.cc
> # g++ -o probdemo probdemo-main.cc -lprobdemo -Wl,-rpath,. -L.
> # ./probdemo
> main: about to call .so
> Hello from the .so
> main: back from .so
> #
customer is happy with this resolution/information ... many thanks, Jakub! :) |