Re: strange valgrind reports about wrapper_handler on 64-bit arm - Mailing list pgsql-hackers

From Nathan Bossart
Subject Re: strange valgrind reports about wrapper_handler on 64-bit arm
Date
Msg-id Z8sbjPWbg3SvQXOL@nathan
Whole thread Raw
In response to strange valgrind reports about wrapper_handler on 64-bit arm  (Tomas Vondra <tomas@vondra.me>)
List pgsql-hackers
On Fri, Mar 07, 2025 at 12:03:47AM +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==
> {
>    <insert_a_suppression_name_here>
>    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.
> 
> 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?
> 
> The closest thing I found in archives is [1] from about a year ago, but
> we haven't found any clear explanation there either :-(

Hm.  The pointer to strcoll_l makes me wonder if there might be an issue in
one of the handler functions that wrapper_handler calls, and
wrapper_handler is getting the blame.  I don't see how pqsignal_handlers
could be uninitialized.  It's static, and we are careful to set it
appropriately before we call sigaction().

-- 
nathan



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: pg_atomic_compare_exchange_*() and memory barriers
Next
From: Robert Haas
Date:
Subject: Re: AIX support