Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gK5U2-0005PP-19 for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Nov 2018 17:49:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gK5U0-0004qH-DJ for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Nov 2018 17:49:44 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gK5U0-0004qA-1H for pgsql-hackers@lists.postgresql.org; Tue, 06 Nov 2018 17:49:44 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gK5Ts-0004dy-TD for pgsql-hackers@lists.postgresql.org; Tue, 06 Nov 2018 17:49:43 +0000 Received: by mail-wm1-x341.google.com with SMTP id b203-v6so13067541wme.5 for ; Tue, 06 Nov 2018 09:49:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=LNWBwD4VJBaB1sPBaHXove3Btw9YULzfQbYMtp6hGes=; b=gxChrBa3HsfJjguCnflMYr6adDoPiO+5yZ+Hn6RqUel7eHT/yqZDHaW/Olqc3zjo6c xyq8admKSU+O9hWPzBw85OLQhAa3Y74BFf7HBPi3l65ArPPkwIZJNa7VFMCr2e20h6E8 qlRdI8V/pheP99HDj/oLC93h1QQH/svRslImUF3TvNvGPSdJHo6zAzhlPNNyhtfszb16 RFOVWCydpu9qhOBpYP9XYyo/Lj5zKgCBpC2UwswBHhNJGKkYPEbuWb4qJkXR8YNhEGWG nRG+wa1H5d1l9uLSRZ1Ydkja1ZJW2q3sCsVa2+nkDAY0q1JN+0jWs4h/jgo2iB1FcmjH 4N6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=LNWBwD4VJBaB1sPBaHXove3Btw9YULzfQbYMtp6hGes=; b=rJaweI6MS9KS+w0SoeK4cqi8070eLWXEH1qk7sXCdArRqSVWzXmqJNiWN0N7/QtBjZ sTmYX9euFCCPwr+xLCBMVbN9uRQHXRzWu9Xe1UMwAcIw4bQhGKdEEK54QEzUErhdDIUH 7845G0SLVeGNqPLPm7k5L4Dl9ArMfitFmBgfA2F35xQrUHue4qYvNdOKpt/2dRH9+fbf 6t90swro/zlDkf2hdElVPDhda8ly0yUJiQcUM7YUh0/i92tAHL8turCxpAtG+GfD6yj+ a10a4D0/3xcafDMr3pnKv/DSBJDS43FNIqm/RhCxgm6ZDzQzFk6bfGjFGFusxX9zpguf 8+lw== X-Gm-Message-State: AGRZ1gIEItAM1MAt6GizypPGMMEe0gaP4WIlh67jYpce5tVKzbxWEDer uvbEvDFxwjtgPG3FeGYtD3KJmqnT4iYVE5jQTK5kjkOqIXomzPQWTRj0R40ENoyPyQ67lZPOyJO Ve19HlZ3wcf5FGKojY2GPxVN7hufK0+LwbFLDyKleldMJu4t0tyOix3I2ufQmeFgdxgRZ7Yw6Cu vDDHRqge/+7sDmNmtDwss= X-Google-Smtp-Source: AJdET5dgQLzxv31o9bZ36pu3CI/bTh36Zy9+I+Mg+F0yKgmMY9Z2zjGSc66cWvWWfgNJc857dupcvw== X-Received: by 2002:a1c:2c87:: with SMTP id s129-v6mr2736231wms.127.1541526574806; Tue, 06 Nov 2018 09:49:34 -0800 (PST) Received: from [10.137.2.21] (static-84-42-175-93.net.upcbroadband.cz. [84.42.175.93]) by smtp.gmail.com with ESMTPSA id 125-v6sm2812312wmm.25.2018.11.06.09.49.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Nov 2018 09:49:34 -0800 (PST) Subject: Re: valgrind issues on Fedora 28 To: Andres Freund Cc: pgsql-hackers@lists.postgresql.org References: <90ac0452-e907-e7a4-b3c8-15bd33780e62@2ndquadrant.com> <20181106173500.ojw6btsxy3oj5jwz@alap3.anarazel.de> From: Tomas Vondra Message-ID: Date: Tue, 6 Nov 2018 18:49:30 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20181106173500.ojw6btsxy3oj5jwz@alap3.anarazel.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 11/6/18 6:35 PM, Andres Freund wrote: > 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. > OK, my thoughts exactly. >> 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. > Looking at gconv code at [1], it seems it's reading the data as int32 values and using shifts to extract individual bytes. I'm pretty sure this confuses valgrind so it thinks it's accessing all the bytes. [1] https://sourceware.org/git/?p=glibc.git;a=blob;f=iconv/gconv_simple.c;h=506c92caf228d61f92986c39a2ddf9c0a134b4c0;hb=HEAD > FWIW, I've supressed these on my valgrind animal a while ago. > OK, I propose to add these suppressions into the current list. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services