]> git.eshelyaron.com Git - emacs.git/commit
Make unaligned loads work with sanitization.
authorVibhav Pant <vibhavp@gmail.com>
Wed, 7 Dec 2022 15:26:17 +0000 (20:56 +0530)
committerVibhav Pant <vibhavp@gmail.com>
Wed, 7 Dec 2022 15:26:17 +0000 (20:56 +0530)
commit7f8aa9db63de147f4196525de99007e1e5c64dfe
tree36cb222d1869bfe5d0e3b9f2360b3b4a5fe7637f
parentaa9ca2c1493f1cd9d50698747fd054b1be53dc95
Make unaligned loads work with sanitization.

Address sanitizer may miss memory bugs that happen during unaligned
loads. To prevent that, compilers may provide additional functions to
perform unaligned loads/stores, which allow sanitizer instrumentation
to check these accesses too. If the necessary header is available, and
AddressSanitizer is enabled, use them.

* configure.ac: Add check for <sanitizer/common_interface_defs.h>.
* src/lisp.h (UNALIGNED_LOAD_SIZE) [ADDRESS_SANITIZER]: New macro. If
the common sanitizer interface is available and address sanitization
is enabled, define it to __sanitizer_unaligned_load(64|32), depending
on the word size of the architecture.
* src/fns.c [HAVE_FAST_UNALIGNED_ACCESS] (Fstring_lessp): Use
'UNALIGNED_LOAD_SIZE' to perform unaligned loads from the two strings.
configure.ac
src/fns.c
src/lisp.h