[PATCH] rawmemchr: speed up, particularly on CHERI

2023-11-12 Thread Paul Eggert
* lib/rawmemchr.c (rawmemchr) [__CHERI__]: Use memchr instead of one-byte reads. This sped up a simple benchmark (rawmemchr on 100,000 bytes) by 6x on a Research Morello SoC r0p0 on CheriBSD 14. [!__CHERI__]: Use sizeof, not alignof, as better alignment should help performance a bit on some

Re: *alloc: Take advantage of CHERI bounds-checking

2023-11-12 Thread Jessica Clarke
On 13 Nov 2023, at 03:10, Bruno Haible wrote: > > Jessica Clarke wrote: >> I can see in your patches that you're using __CHERI__ as your ABI >> detection macro. Unfortunately, this currently isn't quite right. >> ... >> we also have a hybrid ABI, which is >> binary-compatible with non-CHERI

Re: CHERI vs. address sanitizer

2023-11-12 Thread Bruno Haible
Jessica Clarke wrote: > > The answer is in [3], page 4, table III: CHERI does not detect > > use-after-free > > and stack-use-after-return bugs ("temporal memory safety"). > ... > clarifies how things were at the time of writing a bit: > > e) Double-free: This is an example of a temporal mem-

Re: *alloc: Take advantage of CHERI bounds-checking

2023-11-12 Thread Bruno Haible
Jessica Clarke wrote: > I can see in your patches that you're using __CHERI__ as your ABI > detection macro. Unfortunately, this currently isn't quite right. > ... > we also have a hybrid ABI, which is > binary-compatible with non-CHERI code, treating all pointers as > traditional integer

Re: CHERI vs. address sanitizer

2023-11-12 Thread Jessica Clarke
On Sun, Nov 12, 2023 at 10:57:33PM +0100, Bruno Haible wrote: > Two among the bugs uncovered by CHERI (the mcel bug [1] and the xgettext bug > [2]) could be found > - by CHERI, or > - by "gcc -fsanitize=address", or > - by "clang -fsanitize=address", > but not by valgrind. > > This raises

Re: *alloc: Take advantage of CHERI bounds-checking

2023-11-12 Thread Jessica Clarke
On Sat, Nov 11, 2023 at 08:14:46PM +0100, 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. > > Now I'd like to try CHERI on packages like gettext, and see whether > it finds bugs that neither valgrind

new module 'jit/cache'

2023-11-12 Thread Bruno Haible
Marc Nieper-Wißkirchen wrote: > I can provide such a thing easily. In fact, I have it already sitting > > around on my disk since 2021 :-) > > > > This is great! I'm adding the new module, below. > If we want to support a wider variety of systems, the code of Chez Scheme > may be helpful. The

Re: test environments

2023-11-12 Thread Bruno Haible
Marc Nieper-Wißkirchen wrote: > I only have access to x86_64 systems, for which `clear_cache ()' can be a > no-op. Emulators aren't of much help because they usually do not implement > the need for cache invalidation faithfully. We would need the help of > someone with, say, an Aarch64 system.

CHERI vs. address sanitizer

2023-11-12 Thread Bruno Haible
Two among the bugs uncovered by CHERI (the mcel bug [1] and the xgettext bug [2]) could be found - by CHERI, or - by "gcc -fsanitize=address", or - by "clang -fsanitize=address", but not by valgrind. This raises the question: Should we better use CHERI for general pre-release testing, or

Re: c32width gives incorrect return values in C locale

2023-11-12 Thread Gavin Smith
On Sat, Nov 11, 2023 at 11:54:52PM +0100, Bruno Haible wrote: > [CCing bug-libunistring] > Gavin Smith wrote: > > I did not understand why uc_width was said to be "locale dependent": > > > > "These functions are locale dependent." > > > > - from > >