[incfs] libhardening: implementation of SIGBUS handling
This library adds a set of functions and low level macros
for IncFS error handling:
hardening::access() lets one to wrap memory-mapped file
reads into a handler that would turn your code's return
to an optional<>. In case of read error SIGBUS gets
converted to an empty optional<>. If the code doesn't
return anything access() returns a simple bool.
HANDLE_SIGBUS() is a low level macro that doesn't turn
the return value into an optional<>, and doesn't add a
lambda overhead, but, on the other hand, has a drawback:
one has to write their own error handling code, and that
code has to be signal-safe and not allocate any new resources
or access IncFS again - it isn't be protected anymore.
Bug: 160634944
Test: incfs tests and libhardening benchmarks
Change-Id: I72441234ffe0b836fbc722a43594fc8fe59b2414
8 files changed