Re: Fix uninitialized variable access (src/backend/utils/mmgr/freepage.c)

2022-03-14 Thread Peter Geoghegan
On Mon, Mar 14, 2022 at 12:15 PM Robert Haas wrote: > If surgery does happen in the future, I would argue that this > change could easily *mask* bugs, because if somebody tries to apply > valgrind to this code the useless initializations will just cover up > what valgrind would otherwise detect as

Re: Fix uninitialized variable access (src/backend/utils/mmgr/freepage.c)

2022-03-14 Thread Robert Haas
On Thu, Jan 27, 2022 at 7:33 AM Greg Nancarrow wrote: > Why not, at least, just add "Assert(result.page != NULL);" after the > "Assert(!result.found);" in FreePageManagerPutInternal()? > The following code block in FreePageBtreeSearch() - which lacks those > initializations - should never be invok

Re: Fix uninitialized variable access (src/backend/utils/mmgr/freepage.c)

2022-01-27 Thread Greg Nancarrow
On Thu, Jan 27, 2022 at 6:32 PM Michael Paquier wrote: > > On Fri, Oct 01, 2021 at 05:03:04PM -0300, Ranier Vilela wrote: > > For me the assertion remains valid and usable. > > Well, I was looking at this thread again, and I still don't see what > we benefit from this change. One thing that could

Re: Fix uninitialized variable access (src/backend/utils/mmgr/freepage.c)

2022-01-26 Thread Michael Paquier
On Fri, Oct 01, 2021 at 05:03:04PM -0300, Ranier Vilela wrote: > For me the assertion remains valid and usable. Well, I was looking at this thread again, and I still don't see what we benefit from this change. One thing that could also be done is to initialize "result" at {0} at the top of FreePa

Re: Fix uninitialized variable access (src/backend/utils/mmgr/freepage.c)

2021-10-01 Thread Ranier Vilela
Em sex., 1 de out. de 2021 às 16:24, David Zhang escreveu: > On 2021-08-18 1:29 a.m., Kyotaro Horiguchi wrote: > > At Tue, 17 Aug 2021 17:04:44 +0900, Michael Paquier > wrote in > >> On Fri, Jul 02, 2021 at 06:22:56PM -0300, Ranier Vilela wrote: > >>> Em qui., 1 de jul. de 2021 às 17:20, Mahendr

Re: Fix uninitialized variable access (src/backend/utils/mmgr/freepage.c)

2021-10-01 Thread David Zhang
On 2021-08-18 1:29 a.m., Kyotaro Horiguchi wrote: At Tue, 17 Aug 2021 17:04:44 +0900, Michael Paquier wrote in On Fri, Jul 02, 2021 at 06:22:56PM -0300, Ranier Vilela wrote: Em qui., 1 de jul. de 2021 às 17:20, Mahendra Singh Thalor < mahi6...@gmail.com> escreveu: Please can we try to hit th

Re: Fix uninitialized variable access (src/backend/utils/mmgr/freepage.c)

2021-08-18 Thread Ranier Vilela
Em qua., 18 de ago. de 2021 às 05:30, Kyotaro Horiguchi < horikyota@gmail.com> escreveu: > At Tue, 17 Aug 2021 17:04:44 +0900, Michael Paquier > wrote in > > On Fri, Jul 02, 2021 at 06:22:56PM -0300, Ranier Vilela wrote: > > > Em qui., 1 de jul. de 2021 às 17:20, Mahendra Singh Thalor < > > >

Re: Fix uninitialized variable access (src/backend/utils/mmgr/freepage.c)

2021-08-18 Thread Greg Nancarrow
On Wed, Aug 18, 2021 at 6:30 PM Kyotaro Horiguchi wrote: > > By a quick look, FreePageBtreeSearch is called only from > FreePageManagerPutInternal at three points. The first one assumes that > result.found == true, at the rest points are passed only when > fpm->btree_depth > 0, i.e, fpm->btree_roo

Re: Fix uninitialized variable access (src/backend/utils/mmgr/freepage.c)

2021-08-18 Thread Kyotaro Horiguchi
At Tue, 17 Aug 2021 17:04:44 +0900, Michael Paquier wrote in > On Fri, Jul 02, 2021 at 06:22:56PM -0300, Ranier Vilela wrote: > > Em qui., 1 de jul. de 2021 às 17:20, Mahendra Singh Thalor < > > mahi6...@gmail.com> escreveu: > >> Please can we try to hit this rare condition by any test case. If

Re: Fix uninitialized variable access (src/backend/utils/mmgr/freepage.c)

2021-08-17 Thread Ranier Vilela
Em ter., 17 de ago. de 2021 às 10:22, Greg Nancarrow escreveu: > On Tue, Aug 17, 2021 at 9:13 PM Ranier Vilela wrote: > > > > If that's conditions happen, all *result.index* touches are garbage. > > > > The patch looks valid to me, as the "index" member is not set in the > "btp == NULL" case, an

Re: Fix uninitialized variable access (src/backend/utils/mmgr/freepage.c)

2021-08-17 Thread Greg Nancarrow
On Tue, Aug 17, 2021 at 9:13 PM Ranier Vilela wrote: > > If that's conditions happen, all *result.index* touches are garbage. > The patch looks valid to me, as the "index" member is not set in the "btp == NULL" case, and so has a junk value in the caller, and it's being used to index an array, BU

Re: Fix uninitialized variable access (src/backend/utils/mmgr/freepage.c)

2021-08-17 Thread Ranier Vilela
Em ter., 17 de ago. de 2021 às 05:04, Michael Paquier escreveu: > On Fri, Jul 02, 2021 at 06:22:56PM -0300, Ranier Vilela wrote: > > Em qui., 1 de jul. de 2021 às 17:20, Mahendra Singh Thalor < > > mahi6...@gmail.com> escreveu: > >> Please can we try to hit this rare condition by any test case. I

Re: Fix uninitialized variable access (src/backend/utils/mmgr/freepage.c)

2021-08-17 Thread Michael Paquier
On Fri, Jul 02, 2021 at 06:22:56PM -0300, Ranier Vilela wrote: > Em qui., 1 de jul. de 2021 às 17:20, Mahendra Singh Thalor < > mahi6...@gmail.com> escreveu: >> Please can we try to hit this rare condition by any test case. If you have >> any test cases, please share. Yeah, this needs to be proved

Re: Fix uninitialized variable access (src/backend/utils/mmgr/freepage.c)

2021-07-02 Thread Ranier Vilela
Em qui., 1 de jul. de 2021 às 17:20, Mahendra Singh Thalor < mahi6...@gmail.com> escreveu: > On Fri, 2 Jul 2021 at 01:13, Ranier Vilela wrote: > > > > Hi, > > > > The function FreePageManagerPutInternal can access an uninitialized > variable, > > if the following conditions occur: > > Patch looks

Re: Fix uninitialized variable access (src/backend/utils/mmgr/freepage.c)

2021-07-01 Thread Mahendra Singh Thalor
On Fri, 2 Jul 2021 at 01:13, Ranier Vilela wrote: > > Hi, > > The function FreePageManagerPutInternal can access an uninitialized variable, > if the following conditions occur: Patch looks good to me. > 1. fpm->btree_depth != 0 > 2. relptr_off == 0 inside function (FreePageBtreeSearch) > > Perha