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

renameatu: Work around a GNU/Hurd bug.

2025-01-18 Thread Collin Funk
The renameatu and rename tests fail on GNU/Hurd since renameat2 on that platform does not properly handle trailing slashes. I've reported that bug with a test case [1]. Applied the attached patch which adds a configure check and documents the bug. [1] https://sourceware.org/bugzilla/show_bug.cgi?

[PATCH] alignasof: port to IBM XL C 16.1

2025-01-18 Thread Paul Eggert
* doc/gnulib.texi (alignof): Improve doc to match implementationa better. * m4/stdalign.m4 (alignas): Do not define to _Alignas if __xlC__ claims to conform to C11, because _Alignas fails with weird diagnostics "Unexpected text %1$s encountered." * tests/test-alignasof.c (TEST_ALIGNMENT, alignas):

Re: linkat tests: Avoid failure on GNU/Hurd.

2025-01-18 Thread Bruno Haible via Gnulib discussion list
Hi Collin, > The following check caused the linkat tests to fail on GNU/Hurd: > >ASSERT (linkat (dfd, BASE "link1", dfd, BASE "sub1/", 0) == -1); >ASSERT (errno == EEXIST || errno == ENOTDIR); Yes, I've seen that too. > Where "link1" was an existing directory and "sub1" was an existing

[PATCH] flexmember: port to IBM XL C 16.1

2025-01-18 Thread Paul Eggert
* lib/flexmember.h (FLEXALIGNOF): Use the conservative definition if _Alignof is a macro, to avoid a C99 conformance issue exposed by IBM XL C 16.1 which otherwise complains "An aggregate containing a flexible array member cannot be used as a member of a structure or as an array element." --- Chan

Re: linkat tests: Avoid failure on GNU/Hurd.

2025-01-18 Thread Collin Funk
Hi Bruno, Bruno Haible writes: > Err. I disagree with that. When we have a test failure, the first step is > to look at POSIX ([1] in this case). It says "These functions shall fail if: > ...[ENOTDIR]" which catches this case. So, it's a bug in Hurd. > > Then, there are three possibilities: > >

Re: linkat tests: Avoid failure on GNU/Hurd.

2025-01-18 Thread Bruno Haible via Gnulib discussion list
Collin Funk wrote: > I've filed the bug report in glibc under the Hurd component so hopefully > it will get fixed [1]. Thanks. That's how we make progress. Bruno

linkat tests: Avoid failure on GNU/Hurd.

2025-01-18 Thread Collin Funk
The following check caused the linkat tests to fail on GNU/Hurd: ASSERT (linkat (dfd, BASE "link1", dfd, BASE "sub1/", 0) == -1); ASSERT (errno == EEXIST || errno == ENOTDIR); Where "link1" was an existing directory and "sub1" was an existing symlink to a directory. Once we allow errno == E

Re: behavioral change in coreutils `pwd` handling '//' (double slash) caused by gnulib update

2025-01-18 Thread Bruno Haible via Gnulib discussion list
2024-12-31 I wrote: > I reproduce it only on Adelie Linux, not on Alpine Linux or Ubuntu, for > example, > because in config.h: > > * On Adelie Linux > /* #undef HAVE_MINIMALLY_WORKING_GETCWD */ > /* #undef HAVE_PARTLY_WORKING_GETCWD */ > > * On Ubuntu > #define HAVE_MINIMALLY_WO

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

Re: crc-x86_64: undefined behaviour

2025-01-18 Thread Simon Josefsson via Gnulib discussion list
Thanks for discussion, Lasse. I suppose the current situation is difficult to change due to mainly licensing... Lasse Collin writes: > I tested Gnulib's lib/crc-x86_64-pclmul.c (v1.0-1387-g5dd298feb0) a > bit. I changed the target attribute to plain "pclmul" to make it work > on a processor tha

Re: crc-x86_64: undefined behaviour

2025-01-18 Thread Sam Russell
IIRC we test values from 0-16 bytes in the unit test and the pclmul implementation doesn't get hit for smaller values? On Sat, Jan 18, 2025, 13:16 Simon Josefsson wrote: > Thanks for discussion, Lasse. I suppose the current situation is > difficult to change due to mainly licensing... > > Lasse

Re: crc-x86_64: undefined behaviour

2025-01-18 Thread Lasse Collin
On 2025-01-17 Simon Josefsson wrote: > Lasse Collin writes: > > > [1] > > https://github.com/tukaani-project/xz/blob/master/src/liblzma/check/crc_x86_clmul.h > > > > Oh. Do you see any chance to merge your code into gnulib? If there > is any feature in your implementation that we don't hav

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
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 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 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