Skip to content

dladdr() implementation for AIX for master#5655

Closed
makr wants to merge 6 commits intoopenssl:masterfrom
makr:openssl#5485-master
Closed

dladdr() implementation for AIX for master#5655
makr wants to merge 6 commits intoopenssl:masterfrom
makr:openssl#5485-master

Conversation

@makr
Copy link

@makr makr commented Mar 17, 2018

AIX is missing a dladdr() implementation, while OpenSSL is relying on it to retrieve a reference to its own shared object. This pull request now provides such an implementation. OpenSSL will now longer
crash in exit() on AIX after a dlopen()/dlclose().
This is following PR #5626 as implementation for master.

Fixes #5485

Checklist
  • tests are added or updated

Matthias Kraft and others added 6 commits March 17, 2018 13:34
As AIX is missing a dladdr() implementation it is currently uncertain
our
exit()-handlers can still be called when the application exits. After
dlclose() the whole library might have been unloaded already.
The TODOs mark the place and the way for a stripped down
dladdr()-implementation using AIX' own loadquery()-function.

Signed-off-by: Matthias Kraft <[email protected]>
Implemented a stripped down (and so far untested)
dladdr()-implementation
using AIX' own loadquery()-function. Following the SGI example in the
same
code, the DL_info only has the dli_fname member. As the scope of
dlfcn_pathbyaddr() is the filename, this implementation does not
consider
archive members, which can be dlopen()ed in AIX. It is also leaking
memory
as it provides a copy of ldinfo_filename.

Signed-off-by: Matthias Kraft <[email protected]>
Fixed thinko in calculation of next ld_info entry. Changed to large
fixed
size ld_info buffer, as the ld_info entries are of dynamic size. The 80k
will still hold 32 entries in a worst case scenario.
The implementation can only lookup function symbols, no data symbols.
Added PIC-flag to aix*-cc build targets.
The marked printf's will be removed when the test case is implemented.

# Conflicts:
#	Configurations/10-main.conf
Added DATA segment checking to catch ptrgl virtual addresses. Avoid
memleaks with every AIX/dladdr() call. Removed debug-fprintf()s.
Added test case for DSO_dsobyaddr(), which will eventually call dladdr().
Removed unecessary AIX ifdefs again.

# Conflicts:
#	test/shlibloadtest.c
Fixed indentation, moved trailing operators to leading and removed
unecessary braces. Tried to sqeeze everything in 80 cpl.
Removed extra errno declaration. Changed a void* into char* for
portable pointer arithmetics.
Addressed a Travis issue complaining about another void*-cast.
Reconfigured the test code to be empty on Windows, as the implementation
there is completely different and would always produce an error. This is
addressing the Appveyor issue.

# Conflicts:
#	test/shlibloadtest.c
Although it deviates from the actual prototype of DSO_dsobyaddr(), this
is now ISO C compliant and gcc -Wpedantic accepts the code.

# Conflicts:
#	test/shlibloadtest.c
@openssl-machine openssl-machine added the hold: cla required The contributor needs to submit a license agreement label Mar 17, 2018
@makr
Copy link
Author

makr commented Mar 17, 2018

Quack ... I'll have to redo this using the company email.

@makr makr closed this Mar 19, 2018
@makr makr deleted the openssl#5485-master branch March 19, 2018 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hold: cla required The contributor needs to submit a license agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1.1.0g: test_shlibload fails on AIX

2 participants