Project

General

Profile

Bug #294

Prelude-lml segfault with libtool 2.2.4 compliation.

Added by almost 16 years ago. Updated almost 15 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
Start date:
Due date:
% Done:

0%

Resolution:
fixed

Description

Hi, I've been suggested to forward this bug upstream ... It would really depend mostly when you are going to support libtool 2.2.4 but I have created a small patch and how to get it to work properly.

This is also related to prelude-manager as it suffers the same problem. Below is the backtrace related to prelude-manager as I failed to get one... :( sorry I know.

#0  0x00007f18e7a3e690 in strcmp () from /lib/libc.so.6
#1  0x00007f18e75af672 in lt_dlpreload_open () from /usr/lib/libltdl.so.7
#2  0x00007f18e8c90470 in prelude_plugin_load_from_dir (head=0x0,dirname=0x40fa60 "/usr/lib64/prelude-manager/reports", symbol=0x40fd3b "manager_plugin_init", ptr=0x6160e0 subscribe=0x40ab25 <subscribe>, unsubscribe=0x40aacf <unsubscribe>)
at prelude-plugin.c:525 #3  0x000000000040aa20 in report_plugins_init (dirname=0x40fa60 "/usr/lib64/prelude-manager/reports", data=0x6160e0)
at report-plugins.c:406 #4  0x00000000004086dd in main (argc=1, argv=0x7ffff1325478) at prelude-manager.c:165

The patch is fairly easy and specific, in the case of prelude-lml it's fairly easy.

diff --git a/src/prelude-lml.c b/src/prelude-lml.c
index 8880dc8..c98c313 100644
--- a/src/prelude-lml.c
+++ b/src/prelude-lml.c
@@ -37,6 +37,7 @@
 #include <sys/select.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
+#include "ltdl.h" 

 #if TIME_WITH_SYS_TIME
 # include <sys/time.h>

then you'll want to run libtoolize --force and aclocal and autoconf to regenerate configure.

Then you can ./configure and build properly.

I will attach the diff's for both prelude-lml and prelude-manager, if you'd like me to open 2 seperate bug reports I will.

prelude-lml-0.9.10.1.patch View - prelude-lml patch (291 Bytes) , 06/27/2008 01:40 AM

prelude-manager-0.9.9.1.patch View - prelude-manager.patch (319 Bytes) , 06/27/2008 01:41 AM

prelude-plugin-libtool2.patch View (479 Bytes) Yoann VANDOORSELAERE, 06/27/2008 05:27 PM

History

#1 Updated by Yoann VANDOORSELAERE almost 16 years ago

Thanks for reporting this issue! The fix introduce a direct dependency of Prelude-LML and Prelude-Manager to libltdl, although plugin support code is located in libprelude. Do you have an analysis of what is going wrong without the patch? Are you aware of any other possible fix?

#2 Updated by almost 16 years ago

Unfortunately I am not aware of any other fix, as it appears to be something changed in Libtool 2.2.4. It was a bit of an odd bug, and the backtrace I posted was with full debugging enabled on prelude. From personal experience it's not terribly surprising with libtool as much FUN as it is. If you can find any other way to patch it (other then downgrading libtool) I'm all ears.

#3 Updated by Yoann VANDOORSELAERE almost 16 years ago

I have tried reproducing this problem using libtool 2.2.4. I was able to reproduce the sigsegv under the specific condition that libprelude is compiled with libtool 2.2.4, but prelude-manager (which I used for testing), was not recompiled afterwise.

Another issue that arise, this time when recompiling prelude-manager (without your patch), is the following build error:

prelude-manager/src/prelude-manager.c:188: undefined reference to @lt_preloaded_symbols'

It look like this is due to an API change in libltdl: lt_preloaded_symbols seems to have been renamed to lt+PROGRAM+LTX_preloaded_symbols.

Could you confirm theses finding by trying to compile prelude-manager without your patch ?

#4 Updated by almost 16 years ago

It's more of a ABI than API change.
lt_preloaded_symbols is still defined in ltdl.h,
only its defined as lt+PROGRAM+LTX_preloaded_symbols.
If libtool gets updated, it resolved that correctly, without any need for changes,
unless of course, your trying to hide libltdl dependency, as you do, then it may break.
For reference, have a look at this bug:
http://bugs.gentoo.org/show_bug.cgi?id=212723

#5 Updated by Yoann VANDOORSELAERE almost 16 years ago

You are correct that the plugin system is in the libprelude core code: we do as much as possible to hide the details from the applications and try to avoid pulling duplicate libltdl dependencies everywhere.

I'm attaching a libprelude only fix for this problem, please let me know whether that fixes the issue for you.

#6 Updated by almost 16 years ago

Truthfully I only had to patch prelude-lml, and prelude-manager.

libprelude did not rot require any changes in order to work with libtool 2.2.4, as far as the undefined symbol I got that also, I then looked at the libtool documentation and it suggested to #include "ltdl.h" ... Which resolved the unresolved symbols and has been working fine here since. Although I just have been untar'ing the source, and running configure, I did not have to libtoolize --force etc...

#7 Updated by Yoann VANDOORSELAERE almost 16 years ago

Your change fixed the problem because ltdl.h include the following:

#define lt_preloaded_symbols lt+PROGRAM+LTX_preloaded_symbols 

However, we can't push theses patch upstream, since they would introduce an ltdl.h depencency that we try to avoid (and that would not necessarily be installed system wide on a given machine). If you get some time, please let me know whether prelude-plugin-libtool2.patch solve the problem for both [[PreludeLML]] and [[PreludeManager]] (remove your own patch first).

#8 Updated by almost 16 years ago

I tried using

{{
#define lt_preloaded_symbols lt+PROGRAM+LTX_preloaded_symbols
}}

patched libprelude and it built, works from everything I can see... restarted the patched prelude-manager no problem.

Tried straight patching that into prelude-manager and it ran into,

{{
ldl ../libmissing/.libs/libmissing.a
prelude-manager.o: In function @main':
prelude-manager.c:(.text+0x6a): undefined reference to @lt+PROGRAM+LTX_preloaded_symbols'
collect2: ld returned 1 exit status
}}

Which makes me still hate libtool.

libtoolize --force
autoreconf

It compiles and works.

I just added

{{
#define lt_preloaded_symbols lt+PROGRAM+LTX_preloaded_symbols
}}

to src/include/prelude-manager.h

So that fixes the problem as long as you do libtoolize --force and autoreconf. :)

#9 Updated by almost 16 years ago

That's cause you need an updated libtool to correctly expand that symbol,
otherwise it's not expanded and stays undefined.

#10 Updated by almost 16 years ago

Ah ok, well then it works for me :)

#define lt_preloaded_symbols lt+PROGRAM+LTX_preloaded_symbols 

In prelude-lml/prelude-manager and libprelude.

#11 Updated by Yoann VANDOORSELAERE almost 16 years ago

Doing it in libprelude should be sufficient, since Prelude-Manager & Prelude-LML both include prelude-plugin.h, where the definition is done. Can you confirm this, or is there a problem?

#12 Updated by almost 16 years ago

Actually you are correct, that is sufficient. I forgot to run libtoolize --force / autoreconf after reinstalling libprelude with that patch.

It does now build and work. Sorry was a bit scatter brains this morning :(

#13 Updated by Yoann VANDOORSELAERE almost 16 years ago

  • Status changed from New to Closed
  • Resolution set to fixed

(In r10626) Transparently handle libtool 2.2 ABI change. Fix #294.

#14 Updated by Yoann VANDOORSELAERE almost 16 years ago

Thanks for the feedbacks, the patch has been checked in r10626.

#15 Updated by Yoann VANDOORSELAERE almost 16 years ago

  • Status changed from Closed to Feedback
  • Resolution deleted (fixed)

Change reverted in r10657 since it breaks with libtool 1.5.x. Looking for a correct fixes.

#16 Updated by Yoann VANDOORSELAERE over 15 years ago

See http://thread.gmane.org/gmane.comp.gnu.libtool.bugs/6598 for a complete description of the problem. We are currently looking for a clean workaround to the API / ABI issues.

#17 Updated by Yoann VANDOORSELAERE over 15 years ago

  • Status changed from Feedback to Closed
  • Resolution set to fixed

(In r11086) Workaround libtool/libltdl 1.5 -> 2.x ABI compatibility issues. This
introduce two fixes:

- Fix a crash when an application use a different libtool version than the
libltdl version used to compile libprelude. In order to prevent this
problem, we automatically rewrite symbol table provided by libtool 1.5
application, and make it compatible with libltdl 2.2 (we will now ship
libtool/ltdl 2.2 as the default with libprelude).

- Automatic handling of symbol renaming between libtool 1.5 -> 2.x,
which solve application linking problem.

This fix #294.

#18 Updated by Yoann VANDOORSELAERE almost 15 years ago

  • Project changed from PRELUDE SIEM to Libprelude
  • Category deleted (1)
  • Target version deleted (92)

Also available in: Atom PDF