Re: valgrind issues on Fedora 28 - Mailing list pgsql-hackers

From Andres Freund
Subject Re: valgrind issues on Fedora 28
Date
Msg-id 20181106173500.ojw6btsxy3oj5jwz@alap3.anarazel.de
Whole thread Raw
In response to valgrind issues on Fedora 28  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
Responses Re: valgrind issues on Fedora 28
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: New Defects reported by Coverity Scan for PostgreSQL
Next
From: Alvaro Herrera
Date:
Subject: Re: valgrind issues on Fedora 28