Make sigchain actually own the signal chain.

sigchain exists to make sure that art's signal handler is at the front,
but it currently does this by putting the fault manager in the actual
signal handler slot and having that handler call into sigchain when it
doesn't want to handle a signal. sigchain also has a "special signal
handler" (used for native bridge) that runs before user handlers, but
after ART's.

Move maintenance of the signal chain into sigchain itself, and use the
same mechanism to handle the ART handler and the native bridge handler.

Also, clean up some bugs:
  - InvokeUserSignalHandler was using the wrapper sigprocmask instead
    of the actual one.
  - Use SIG_SETMASK instead of SIG_BLOCK between calling handlers, in
    case one of the handlers changes the signal mask.
  - Correctly handle sigaction without SA_SIGINFO.

Bug: http://b/36205469
Bug: http://b/36262089
Test: NPE with dalvikvm with/without TEST_NESTED_SIGNAL defined (arm/aarch64)
Change-Id: I416b13de800d3e23424cf20688ccfd7e4e48a111
11 files changed