[DynInst_API:] [dyninst/dyninst] 801110: proccontrol: fix double-increment while erasing a ...


Date: Wed, 30 Nov 2016 14:54:41 -0800
From: Josh Stone <cuviper@xxxxxxxxx>
Subject: [DynInst_API:] [dyninst/dyninst] 801110: proccontrol: fix double-increment while erasing a ...
  Branch: refs/heads/master
  Home:   https://github.com/dyninst/dyninst
  Commit: 80111056ea99daeac08bb211caa74734cd6394ac
      https://github.com/dyninst/dyninst/commit/80111056ea99daeac08bb211caa74734cd6394ac
  Author: Josh Stone <jistone@xxxxxxxxxx>
  Date:   2016-11-18 (Fri, 18 Nov 2016)

  Changed paths:
    M proccontrol/src/process.C

  Log Message:
  -----------
  proccontrol: fix double-increment while erasing a dead process

In the attach loop over waitfor_startup(), processes which fail are
erased from the set.  However, the iterator was getting incremented
again, which will skip the next process or even cause undefined behavior
if already at the end of the list.

With GCC 6.2.1, that UB manifested as an infinite loop on a self-
referential rbtree node.

The simple solution is to `continue` the loop after `erase(i++)`, as is
done in many other places with this same pattern.


  Commit: d7e310e4b1bdf7eee4dafab1553a89d6ea79717d
      https://github.com/dyninst/dyninst/commit/d7e310e4b1bdf7eee4dafab1553a89d6ea79717d
  Author: Josh Stone <jistone@xxxxxxxxxx>
  Date:   2016-11-21 (Mon, 21 Nov 2016)

  Changed paths:
    M proccontrol/src/process.C

  Log Message:
  -----------
  proccontrol: fix another process erasure during attach

If a process initially failed to attach threads, a `pthrd_printf` was
indicating that it would try again, but the process was getting erased
from the set while incorrectly causing the iterator to double-increment.

Now the messages about "will try again" and "now an error" are changed
to simply report an immediate error, and it continus the loop after
process erasure to avoid incrementing the iterator again.


  Commit: e12519599272cde9546bcd892477bc68a0edcad0
      https://github.com/dyninst/dyninst/commit/e12519599272cde9546bcd892477bc68a0edcad0
  Author: Josh Stone <cuviper@xxxxxxxxx>
  Date:   2016-11-30 (Wed, 30 Nov 2016)

  Changed paths:
    M proccontrol/src/process.C

  Log Message:
  -----------
  Merge pull request #261 from cuviper/procs-erase-inc

proccontrol: fix double-increment while erasing a dead process


Compare: https://github.com/dyninst/dyninst/compare/6ccfab4766a0...e12519599272
[← Prev in Thread] Current Thread [Next in Thread→]
  • [DynInst_API:] [dyninst/dyninst] 801110: proccontrol: fix double-increment while erasing a ..., Josh Stone <=