[haiku-bugs] Re: [Haiku] #12291: [Debugger] Exhibits inconsistent behavior & doesn't save a crash report

  • From: "anevilyak" <trac@xxxxxxxxxxxx>
  • Date: Sat, 08 Aug 2015 04:34:10 -0000

#12291: [Debugger] Exhibits inconsistent behavior & doesn't save a crash report
-------------------------------------+----------------------------
Reporter: waddlesplash | Owner: anevilyak
Type: bug | Status: closed
Priority: normal | Milestone: Unscheduled
Component: Applications/Debugger | Version: R1/Development
Resolution: fixed | Keywords:
Blocked By: | Blocking:
Has a Patch: 0 | Platform: All
-------------------------------------+----------------------------
Changes (by anevilyak):

* cc: korli, bonefish (added)


Comment:

After digging into this issue further, I've isolated what's going wrong,
but I'm uncertain as to the best course of action to resolve it.

What happens is:
- One of the flags that the current version of rm passes into coreutils is
FTS_CWDFD (0x200). When run directly, rm winds up calling the version of
fts_open() in coreutils lib/fts.c, which has been statically compiled into
the rm binary. This one's sanity check on the passed-in flags validates
against the mask FTS_OPTIONMASK, which in coreutils is defined as 0x1fff,
and has no problem passing through the aforementioned flag.
- When run through stdbuf though, execution winds up hitting fts_open in
libroot rather than the one in the rm binary. This latter one has nearly
identical code, except FTS_OPTIONMASK in libroot is 0xff, which the above
flag fails, tripping the assert.

The only discernable difference is that in the case of stdbuf,
libstdbuf.so gets preloaded, and then rm subsequently is invoked via
execvp(). Since the initial load of stdbuf winds loading libroot via
linkage, and neither stdbuf nor libstdbuf.so contain the aforementioned
symbol, presumably the one in libroot winds up ultimately getting mapped,
and thus once rm is exec'd, it winds up calling that one rather than the
one contained in its own image. By implication, should libroot's be marked
as a weak symbol perhaps? Or does this imply a runtime_loader problem?

--
Ticket URL: <https://dev.haiku-os.org/ticket/12291#comment:5>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: