[haiku-bugs] Re: [Haiku] #7892: [Pe] segfaults in extensions "{cut, copy} lines"

  • From: "zooey" <trac@xxxxxxxxxxxx>
  • Date: Mon, 01 Aug 2011 21:08:16 -0000

#7892: [Pe] segfaults in extensions "{cut, copy} lines"
----------------------------+-----------------------------------
   Reporter:  ttcoder       |      Owner:  zooey
       Type:  bug           |     Status:  in-progress
   Priority:  normal        |  Milestone:  R1
  Component:  Applications  |    Version:  R1/alpha3
 Resolution:                |   Keywords:  Pe extension segfault
 Blocked By:                |   Blocking:
Has a Patch:  0             |   Platform:  All
----------------------------+-----------------------------------

Comment (by zooey):

 I've traced the crash in 'Copy Lines Containing' to symbol preemption
 behaviour when loading the add-on: instead of the regcomp(), regexec() and
 regfree() symbols from libpcreposix.so (which the add-on links to), the
 identically named symbols from libroot are used. Since the data type
 regex_t doesn't match the expecations of the libroot implementation,
 though, those functions overwrite the stack, which in turn causes the
 crash.

 If Pe is explicitly linked against libpcreposix.so (which it doesn't use,
 it just uses libpcre.so), the problem can be circumvented, as then the
 add-on finds the "right" symbols. However, I wonder what the real solution
 would be? Do we have to mark the reg...() symbols in libroot as weak?

 I know scarcely anything about our implementation of symbol preemption,
 but is it possible that the order in which symbols needed by an add-on is
 such that the images already loaded with the hosting app are checked
 before libraries required by the add-on itself?

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/7892#comment:4>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: