Re: [PATCH] Silence Valgrind about SelectConfigFiles()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Aleksander Alekseev <aleksander(at)tigerdata(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Silence Valgrind about SelectConfigFiles()
Date: 2025-08-14 15:46:17
Message-ID: 188435.1755186377@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Aleksander Alekseev <aleksander(at)tigerdata(dot)com> writes:
> Makes sense. Here is the corrected patch v2.

LGTM, pushed.

>> Huh ... don't quite see where in that recipe we'd reach a
>> SelectConfigFiles error exit.

> How exactly we reach this code patch is a good question. I tried to
> understand the exact conditions by using my steps to reproduce and an
> ancient debugging technique with sleep(), elog() and `watch` - see
> trick.txt. Unfortunately I was not able to reproduce it again nor
> under Valgrind nor without it. I guess it means that either I did
> something differently before or the right conditions are met under
> rare circumstances.

I think you must have done something involving passing bad arguments
to the postmaster, and then forgotten that (not hard to do late at
night). I see from the code coverage report that none of the failure
exits from SelectConfigFiles are exercised in our normal regression
tests, so only something very odd could have resulted in getting here
without a manual error being involved. But I'm content to apply this
on the grounds that it's inconsistent to free the string in only one
of the error exit paths.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2025-08-14 15:49:06 Re: [PATCH] bms_prev_member() can read beyond the end of the array of allocated words
Previous Message Greg Burd 2025-08-14 15:43:28 Re: [PATCH] bms_prev_member() can read beyond the end of the array of allocated words