linux: Correct handling of load bias

The load bias is documented to be the difference between
the preferred and actual load address for a module, but
is declared as an unsigned number, and math using it relies
on it being a pointer-precisioned two's complement number
that might cause over- or under-flow.

ElfImageReader and DebugRendezvous both provide ways to get
the load bias for a module and are corroborated in tests.
However, the load bias computed by DebugRendezvous does
not have access to the preferred address, so there is not
enough information to determine the signedness to use with
a VMOffset.

This patch compares the load biases modulo the numeric range
for a pointer to ignore the signedness of the value.

Also update the test module to trigger a negative load bias.

Bug: chromium:1147922
Change-Id: Ic8123ad3a223166411adff4049db5ffc5118453c
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2569886
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
GitOrigin-RevId: 00491d58ee2957845431ef70c88349d19fbb3f17
3 files changed
tree: b26c4e078b62aac3bed28b5579bc74a4815ad7b0
  1. build/
  2. client/
  3. compat/
  4. doc/
  5. handler/
  6. infra/
  7. minidump/
  8. snapshot/
  9. test/
  10. third_party/
  11. tools/
  12. util/
  13. .clang-format
  14. .gitattributes
  15. .gitignore
  16. .gn
  17. .style.yapf
  18. .vpython
  19. AUTHORS
  20. BUILD.gn
  21. codereview.settings
  22. CONTRIBUTORS
  23. crashpad.gyp
  24. DEPS
  25. LICENSE
  26. navbar.md
  27. package.h
  28. README.md
README.md

Crashpad

Crashpad is a crash-reporting system.

Documentation

Source Code

Crashpad’s source code is hosted in a Git repository at https://chromium.googlesource.com/crashpad/crashpad.

Other Links