Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tr0wq-00DWPE-3K for pgsql-hackers@arkaria.postgresql.org; Sat, 08 Mar 2025 20:39:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tr0wo-008TQc-Lu for pgsql-hackers@arkaria.postgresql.org; Sat, 08 Mar 2025 20:39:02 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tr0wo-008TQT-3U for pgsql-hackers@lists.postgresql.org; Sat, 08 Mar 2025 20:39:02 +0000 Received: from relay6-d.mail.gandi.net ([2001:4b98:dc4:8::226]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tr0wl-001jeQ-1P for pgsql-hackers@postgresql.org; Sat, 08 Mar 2025 20:39:00 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 32E03442D8; Sat, 8 Mar 2025 20:38:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vondra.me; s=gm1; t=1741466334; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EC33NZbfD6ETKUXfpZkVgoKbmdzBq6NSxZV/Ca/ulYM=; b=bQxyb+wyjRUj8sDtDTgmxEzdcn5+oDkdBu+VkfTVmQ2Be/A0LhiZXtb6nUobUkwENM+4HS brzyp/2IR3kYM8F7UDpJ3qUywi9eECuLc66zSSYR2nSHi9+IQXuvoaB2z82jl6JLC4hI/z vh0NlkYnPLuRxWevEO3MEzN/m6yOSDvOeS3ihRQv6UgpLBir9jO6hpRGG+bmTu31+UY+2B pbdvoCuyv353LataUyabCViN/S/NbjyinQ/wGpvxLyjTOlsrXDSz+rA64KtiYyDUh2D0Do hSBlMDkdblKOH723smG1sWgtmvlwhluB0NgqzS/jVWdkDmtDtfNyBop0Ek4efA== Message-ID: Date: Sat, 8 Mar 2025 21:38:52 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: strange valgrind reports about wrapper_handler on 64-bit arm To: Andres Freund Cc: PostgreSQL Hackers , Nathan Bossart References: Content-Language: en-US From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduudegheefucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttddvjeenucfhrhhomhepvfhomhgrshcugghonhgurhgruceothhomhgrshesvhhonhgurhgrrdhmvgeqnecuggftrfgrthhtvghrnhepledugeeikefglefhgfffuedvleetteevgefhvdeikeefudduuddvhfevudefhfevnecukfhppeekiedrgeelrddvfeeirdduleefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepkeeirdegledrvdefiedrudelfedphhgvlhhopegluddtrddufeejrddtrddvngdpmhgrihhlfhhrohhmpehtohhmrghssehvohhnughrrgdrmhgvpdhnsggprhgtphhtthhopeefpdhrtghpthhtoheprghnughrvghssegrnhgrrhgriigvlhdruggvpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrshesphhoshhtghhrvghsqhhlrdhorhhgpdhrtghpthhtohepnhgrthhhrghnuggsohhsshgrrhhtsehgmhgrihhlrdgtohhm X-GND-Sasl: tomas@vondra.me List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 3/7/25 17:32, Andres Freund wrote: > Hi, > > On 2025-03-07 00:03:47 +0100, Tomas Vondra wrote: >> while running check-world on 64-bit arm (rpi5 with Debian 12.9), I got a >> couple reports like this: >> >> ==64550== Use of uninitialised value of size 8 >> ==64550== at 0xA62FE0: wrapper_handler (pqsignal.c:107) >> ==64550== by 0x580BB9E7: ??? (in >> /usr/libexec/valgrind/memcheck-arm64-linux) >> ==64550== Uninitialised value was created by a stack allocation >> ==64550== at 0x4F94660: strcoll_l (strcoll_l.c:258) >> ==64550== >> { >> >> Memcheck:Value8 >> fun:wrapper_handler >> obj:/usr/libexec/valgrind/memcheck-arm64-linux >> } >> **64550** Valgrind detected 1 error(s) during execution of "ANALYZE >> mcv_lists;" > >> The exact command varies, I don't think it's necessarily about analyze >> or extended stats. > > Do you have a few other examples from where it was triggered? > > Is the source of the uninitialized value always strcoll_l? > I've seen a couple reports, but only a single one had info about source of the allocation (and that was strcoll). > Can you reliably reproduce it in certain scenarios or is it probabilistic in > some form? > I believe it's probabilistic, I certainly don't know how to trigger or reproduce it. > Do you know what signal was delivered (I think that could be detected using > valgrinds --vgdb)? > No idea. > >> The line the report refers to is this: >> >> (*pqsignal_handlers[postgres_signal_arg]) (postgres_signal_arg); >> >> so I guess it can't be about postgres_signal_arg (as that's an int). But >> that leaves just pqsignal_handlers, and why would that be uninitialized? > > Is it possible that the signal number we're getting called for is above > PG_NSIG? That'd explain why the source value is something fairly random? > No idea. > ISTM that we should add an Assert() to wrapper_handler() that ensures that the > signal arg is below PG_NSIG. > No idea. > > Might also be worth trying to run without valgrind but with address and > undefined behaviour sanitizers enabled. I don't currently have access to an > armv8 machine that's not busy doing other stuff... > I've restarted check-world with valgrind on my rpi5 machines, with current master. I can try running other stuff once that finishes in a couple hours. regards -- Tomas Vondra