On 2018-11-06 18:24:55 +0100, Tomas Vondra wrote:
> I've recently updated to Fedora 28, and in that environment I get quite a
> few new valgrind issues (see the attached log).
>
> Essentially, all the reports start with either
>
> ==5971== Invalid read of size 32
> ==5971== at 0x5957EB1: __wcsnlen_avx2 (in /usr/lib64/libc-2.27.so)
> ==5971== by 0x589E871: wcsrtombs (in /usr/lib64/libc-2.27.so)
> ==5971== by 0x5834000: wcstombs (in /usr/lib64/libc-2.27.so)
> ==5971== by 0x97DD82: wchar2char (pg_locale.c:1641)
I think this isn't actually a bug, just a missing suppression. The avx2
code uses instructions to scan for 0 bytes in multiple bytes at the same
time. Therefore it can encounter a byte marked as undefined, even if it
never actually uses that value.
> or
>
> ==5971== Conditional jump or move depends on uninitialised value(s)
> ==5971== at 0x5822123: __gconv_transform_internal_utf8 (in
> /usr/lib64/libc-2.27.so)
> ==5971== by 0x589E8A4: wcsrtombs (in /usr/lib64/libc-2.27.so)
> ==5971== by 0x5834000: wcstombs (in /usr/lib64/libc-2.27.so)
> ==5971== by 0x97DD82: wchar2char (pg_locale.c:1641)
>
> or some other combination of that. In all cases the call stack is
>
> wchar2char > wcstombs > wcsrtombs > something
I think I came to the same conclusion here, but I'm not quite sure.
FWIW, I've supressed these on my valgrind animal a while ago.
Greetings,
Andres Freund