Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#11776 closed bug (fixed)

RTS segfaults when printing profiling information which refers to unloaded objects

Reported by: afarmer Owned by: afarmer
Priority: normal Milestone: 8.0.1
Component: Runtime System (Linker) Version: 7.10.3
Keywords: Cc: simonmar
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s): Phab:D2067 Phab:D2068 Phab:D2069 Phab:D2071
Wiki Page:

Description

Running a profiled binary which loads/unloads objects via the RTS's linker results in a CCS tree with pointers to the shared objects. These references are not checked by checkUnload before unloading the object. Then, when the profiling report is printed at the end of the program, a segfault occurs.

Plan:

  1. Add a test case for this.
  2. Modify checkUnload to prevent objects from being unloaded if the CCS tree points to them.
  3. Modify generateCCSReport to prune the CCS tree after a report is printed.
  4. Expose some way to generate a report on demand, so long-running programs don't keep every object loaded forever.

Change History (6)

comment:1 Changed 4 years ago by afarmer

Differential Rev(s): Phab:2067 Phab:2068 Phab:2069 Phab:2071
Status: newpatch

comment:2 Changed 4 years ago by afarmer

Differential Rev(s): Phab:2067 Phab:2068 Phab:2069 Phab:2071Phab:D2067 Phab:D2068 Phab:D2069 Phab:D2071

comment:3 Changed 4 years ago by bgamari

Milestone: 8.0.2

comment:4 Changed 4 years ago by Ben Gamari <ben@…>

In 36a0b6d/ghc:

Check CCS tree for pointers into shared object during checkUnload

Prevent shared objects from being unloaded if cost centre stacks point
at the object. This will prevent segfault in #11776, but also prevents
objects from ever being unloaded when profiling. Pruning CCS tree will
enable that in another diff.

Test Plan: make TEST=linker_profiled, examine linker_profiled.run.stderr

Reviewers: austin, simonmar, bgamari

Reviewed By: simonmar, bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2069

GHC Trac Issues: #11776

comment:5 Changed 4 years ago by bgamari

Resolution: fixed
Status: patchclosed

comment:6 Changed 4 years ago by bgamari

Milestone: 8.0.28.0.1
Note: See TracTickets for help on using tickets.