Re: Worth using personality(ADDR_NO_RANDOMIZE) for EXEC_BACKEND on linux?

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Worth using personality(ADDR_NO_RANDOMIZE) for EXEC_BACKEND on linux?
Date: 2021-08-10 23:59:02
Message-ID: CA+hUKGJiuKXXfwO=Y9H6eyJBzVciYnjr9hSA_1-0iDJtkvx-sQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Aug 11, 2021 at 7:07 AM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
> On Wed, Aug 11, 2021 at 2:12 AM Andres Freund <andres(at)anarazel(dot)de> wrote:
> > On Tue, Aug 10, 2021, at 15:19, Thomas Munro wrote:
> > > Yeah, make check always fails for me on macOS 11. With the attached
> > > experimental hack, it fails only occasionally (1 in 8 runs or so). I
> > > don't know why.
> >
> > I suspect you'd need to use the hack in pg_ctl to make it reliable. The layout of normally stayed position independent postmaster can be incompatible with the non ASLR spawned child.
>
> Yeah, but the patch already changes both pg_ctl.c and postmaster.c.

/me stares at vmmap output for a while

Oooh. It's working perfectly (for example if you export
PATH=binarys:$PATH, pg_ctl -D pgdata start, make installcheck), but
pg_regress.c has its own separate fork/exec to launch the temporary
cluster that needs to be similarly hacked. Unfortunately I have to
give this Macintosh back and go and do some real work on a different
computer now. That does seem to be a working solution to the problem,
though, and could be polished into proposable form.

I saw claims that you can also link with -Wl,-no_pie or toggle the PIE
bit on your executable and libraries, but that didn't work for me on
11, Intel (no effect) or ARM (linker option gone).

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2021-08-11 00:29:23 Re: ECPG bug fix: DECALRE STATEMENT and DEALLOCATE, DESCRIBE
Previous Message Tomas Vondra 2021-08-10 23:04:56 Re: Use extended statistics to estimate (Var op Var) clauses