Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qIlgF-0001LX-Rq for pgsql-hackers@arkaria.postgresql.org; Mon, 10 Jul 2023 07:51:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qIlgE-00055r-HS for pgsql-hackers@arkaria.postgresql.org; Mon, 10 Jul 2023 07:51:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qIlgE-00055h-3Z for pgsql-hackers@lists.postgresql.org; Mon, 10 Jul 2023 07:51:34 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by magus.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qIlgA-003Ew8-SP for pgsql-hackers@postgresql.org; Mon, 10 Jul 2023 07:51:33 +0000 Received: from mail.postgrespro.ru (webmail.mstn.postgrespro.ru [192.168.2.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: o.tselebrovskiy@postgrespro.ru) by mail.postgrespro.ru (Postfix/587) with ESMTPSA id 12660E20442; Mon, 10 Jul 2023 10:51:30 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1688975490; bh=emRXe4p4N0L7QaUyPePaAw7F+ctrQ9lxR984IUw0gzY=; h=Date:From:To:Cc:Subject:User-Agent:Message-ID:From; b=NtdahCz7H7shV/hsnRZsw/+99XdpcPXQrMtMJFSZQ8FcfB3Uoy/ecPRuSmQawPzaF veu7TTI0hppT0IPxtIplG7YZOJjkK0oxcrGwRZT4za4QFAqgttUbHNnNvAGEHNl1Yd 4n+GbIop+ISuUbKlnEOxO/zcZoN65OKTLqDe+utLdh0BDUtA7lnap/vjKhirLcc84v HIV5dtMJ2bEbVXzK+8xMXdV0m0NGn0STg8ypR4yqX6Nxj2WdK67+GWfEhpqSGtA9Rl 270Eud0e8SfBb5mGXv0KOvlat5RfeoPl+DNVtEbXLUgPCsWm1xdXg6G6/a0X5DCW06 4q6drOuARyQcw== MIME-Version: 1.0 Date: Mon, 10 Jul 2023 14:51:29 +0700 From: o.tselebrovskiy@postgrespro.ru To: pgsql-hackers@postgresql.org Cc: Anton Voloshin Subject: Valgrind errors on 32-bit OS User-Agent: Roundcube Webmail/1.4.11 Message-ID: <2d05260849f96ddccf875493bca3f4f2@postgrespro.ru> X-Sender: o.tselebrovskiy@postgrespro.ru Content-Type: multipart/mixed; boundary="=_6a10525c051cddc4c123e7fd5e9d62ac" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --=_6a10525c051cddc4c123e7fd5e9d62ac Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Greetings, everyone! While working on an extension, I've found myself using valgrind on a 32-bit OS (Debian 11) and after executing any query (even 'select 1;') under valgrind I've been shown the same error everytime: ==00:00:00:18.109 2528== VALGRINDERROR-BEGIN ==00:00:00:18.109 2528== Use of uninitialised value of size 4 ==00:00:00:18.109 2528== at 0x645B52: pg_comp_crc32c_sb8 (pg_crc32c_sb8.c:79) ==00:00:00:18.109 2528== by 0x24295F: XLogRecordAssemble (xloginsert.c:780) ==00:00:00:18.109 2528== by 0x24295F: XLogInsert (xloginsert.c:459) ==00:00:00:18.109 2528== by 0x4B693B: LogCurrentRunningXacts (standby.c:1099) ==00:00:00:18.109 2528== by 0x4B693B: LogStandbySnapshot (standby.c:1055) ==00:00:00:18.109 2528== by 0x43BECF: BackgroundWriterMain (bgwriter.c:336) ==00:00:00:18.109 2528== by 0x249D8A: AuxiliaryProcessMain (bootstrap.c:446) ==00:00:00:18.109 2528== by 0x448B11: StartChildProcess (postmaster.c:5445) ==00:00:00:18.109 2528== by 0x449F57: reaper (postmaster.c:2907) ==00:00:00:18.109 2528== by 0x486D587: ??? (in /usr/lib/i386-linux-gnu/libpthread-2.31.so) ==00:00:00:18.109 2528== Uninitialised value was created by a stack allocation ==00:00:00:18.109 2528== at 0x4B682F: LogStandbySnapshot (standby.c:1018) I've been able to reproduce this on branches from REL_11_STABLE up to current master. Valgrind version is 3.21.0. I was wondering, why does this error occur only on 32-bit OS and not 64-bit? I found three threads: About issues with valgrind and padding - https://www.postgresql.org/message-id/flat/1082573393.7010.27.camel%40tokyo About sanitizers (and valgrind) in general - https://www.postgresql.org/message-id/flat/20160321130850.6ed6f598%40fujitsu About valgrind suppressions - https://www.postgresql.org/message-id/flat/4dfabec2-a3ad-0546-2d62-f816c97edd0c%402ndQuadrant.com and after reading those decided to look for existing valgrind suppressions. And I've found just what I was looking for: { padding_XLogRecData_CRC Memcheck:Value8 fun:pg_comp_crc32c* fun:XLogRecordAssemble } Supression for this (group of) function(s), but for 8-byte chunks of memory. So the suggestion is to add a suppression for 4-byte values in this function. The patch is attached. Oleg Tselebrovskiy, Postgres Pro --=_6a10525c051cddc4c123e7fd5e9d62ac Content-Transfer-Encoding: base64 Content-Type: text/x-diff; name=32-bit-supression.patch Content-Disposition: attachment; filename=32-bit-supression.patch; size=370 ZGlmZiAtLWdpdCBhL3NyYy90b29scy92YWxncmluZC5zdXBwIGIvc3JjL3Rvb2xzL3ZhbGdyaW5k LnN1cHAKaW5kZXggN2VhNDY0YzgwOTQuLjAwNTVjZjE0NjI1IDEwMDY0NAotLS0gYS9zcmMvdG9v bHMvdmFsZ3JpbmQuc3VwcAorKysgYi9zcmMvdG9vbHMvdmFsZ3JpbmQuc3VwcApAQCAtMjMsNiAr MjMsMTQgQEAKIAlmdW46cGdzdGF0X3dyaXRlX3N0YXRzZmlsZXMKIH0KIAoreworCXBhZGRpbmdf WExvZ1JlY0RhdGFfQ1JDXzMyX2JpdAorCU1lbWNoZWNrOlZhbHVlNAorCisJZnVuOnBnX2NvbXBf Y3JjMzJjKgorCWZ1bjpYTG9nUmVjb3JkQXNzZW1ibGUKK30KKwogewogCXBhZGRpbmdfWExvZ1Jl Y0RhdGFfQ1JDCiAJTWVtY2hlY2s6VmFsdWU4Cg== --=_6a10525c051cddc4c123e7fd5e9d62ac--