Re: Re: pgsql: Convert contrib/seg's bool-returning SQL functions to V1 call co

From: Andres Freund <andres(at)anarazel(dot)de>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-committers(at)postgresql(dot)org
Subject: Re: Re: pgsql: Convert contrib/seg's bool-returning SQL functions to V1 call co
Date: 2016-04-27 02:44:15
Message-ID: 20160427024415.6mv2dtyifpkv7g6v@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On 2016-04-26 22:38:28 -0400, Noah Misch wrote:
> On Fri, Apr 22, 2016 at 03:54:48PM +0000, Tom Lane wrote:
> > Convert contrib/seg's bool-returning SQL functions to V1 call convention.
> >
> > It appears that we can no longer get away with using V0 call convention
> > for bool-returning functions in newer versions of MSVC. The compiler
> > seems to generate code that doesn't clear the higher-order bits of the
> > result register, causing the bool result Datum to often read as "true"
> > when "false" was intended. This is not very surprising, since the
> > function thinks it's returning a bool-width result but fmgr_oldstyle
> > assumes that V0 functions return "char *"; what's surprising is that
> > that hack worked for so long on so many platforms.
>
> Does this warrant a change to the "Section 2" comment of postgres.h,
> explaining that its precautions no longer suffice everywhere?

I don't understand why we don't just drop V0. It makes debugging harder,
exploitation easier (call arbitrary functions), and really has no
features making it desirable.

Andres

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2016-04-27 02:54:39 Re: pgsql: Convert contrib/seg's bool-returning SQL functions to V1 call co
Previous Message Noah Misch 2016-04-27 02:38:28 Re: pgsql: Convert contrib/seg's bool-returning SQL functions to V1 call co

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-04-27 02:54:39 Re: pgsql: Convert contrib/seg's bool-returning SQL functions to V1 call co
Previous Message Noah Misch 2016-04-27 02:38:28 Re: pgsql: Convert contrib/seg's bool-returning SQL functions to V1 call co