Re: valgrind vs. sanitizers

2025-01-21 Thread Lasse Collin
On 2025-01-18 Paul Eggert wrote: > On 2025-01-18 11:45, Lasse Collin wrote: > > On 2025-01-18 Paul Eggert wrote: > >> Does the unaligned read trick work even with CheriBSD's memory-safe > >> model? That is an edge case that might need an ifdef or something. > >> > > > > I'm not familiar with C

Re: valgrind vs. sanitizers

2025-01-18 Thread Paul Eggert
On 2025-01-18 11:45, Lasse Collin wrote: On 2025-01-18 Paul Eggert wrote: Does the unaligned read trick work even with CheriBSD's memory-safe model? That is an edge case that might need an ifdef or something. I'm not familiar with CheriBSD but the trick never crosses a cache line boundary (or

Re: valgrind vs. sanitizers

2025-01-18 Thread Lasse Collin
On 2025-01-18 Paul Eggert wrote: > Does the unaligned read trick work even with CheriBSD's memory-safe > model? That is an edge case that might need an ifdef or something. I'm not familiar with CheriBSD but the trick never crosses a cache line boundary (or page boundary). So the memory-safe model

Re: valgrind vs. sanitizers

2025-01-18 Thread Lasse Collin
On 2025-01-18 Bruno Haible wrote: > Valgrind was a tool without replacement, for many years, when > sanitizers did not exist. Nowadays, however, I generally prefer > testing with sanitizers than with valgrind because there are some > bugs that ASAN finds and valgrind doesn't [1]. For example, when

Re: valgrind vs. sanitizers

2025-01-18 Thread Bruno Haible via Gnulib discussion list
Paul Eggert wrote: > Does the unaligned read trick work even with CheriBSD's memory-safe > model? That is an edge case that might need an ifdef or something. Good question... > The aligned read trick reminds me a bit of the "adding 0 to a null > pointer gives you a null pointer" trick. That als

Re: valgrind vs. sanitizers

2025-01-18 Thread Paul Eggert
On 2025-01-18 07:48, Bruno Haible via Gnulib discussion list wrote: Regarding your trick to do an aligned read on (addr & -alignment) instead of an unaligned read on (addr): I find it good that ASAN catches this, because this trick amounts to exploiting a coincidental property of current hardware

Re: valgrind vs. sanitizers

2025-01-18 Thread Bruno Haible via Gnulib discussion list
Lasse Collin wrote: > About sanitizers: They can be annoying with SIMD code. If a function is > passed an unaligned buffer, it would be fine to round the address down > to an aligned value, do an aligned read, and ignore the out-of-bounds > bytes. One can do it in assembly because sanitizers don't