On 2023-11-11 11:14, Bruno Haible wrote:
I was impressed by the fact that CHERI detected the multithread-safety
bug of gnulib's use of rand() in the test suite.
I was also impressed in 2017 when Intel MPX found some pointer bugs in
Emacs, and I added support to Emacs for gcc -fcheck-pointer-bounds,
which used Intel MPX.
I tried hard to add support with as few #ifdefs as possible, to avoid
cluttering the code. Instead, I created a relatively small include file
ptr-bounds.h that packaged things up into easy-to-use macros. This meant
most of the rest of the Emacs code didn't need to use #ifdefs.
This proved to be beneficial when Intel MPX died. Removing MPX support
from Emacs was relatively simple:
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=fe2649528b0b7637e6b6851c41e696a1016d8d53
It'd be helpful to do something similar with CHERI, as CHERI is still
somewhat experimental and mutating and the doc doesn't match the code,
and CHERI might not survive.