Re: Upgrade 10.5->10.6 : db crash BUS ERROR (sig 10), reproducible

From: Palle Girgensohn <girgen(at)FreeBSD(dot)org>
To: Peter <pmc(at)citylink(dot)dinoex(dot)sub(dot)org>
Cc: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, pgsql-admin(at)postgresql(dot)org, "pgsql(at)freebsd(dot)org" <pgsql(at)FreeBSD(dot)org>, "gerald(at)freebsd(dot)org" <gerald(at)FreeBSD(dot)org>
Subject: Re: Upgrade 10.5->10.6 : db crash BUS ERROR (sig 10), reproducible
Date: 2019-03-09 12:42:55
Message-ID: 4BD693C6-B287-4153-A296-D65BB9874CB2@FreeBSD.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

> 9 mars 2019 kl. 01:17 skrev Peter <pmc(at)citylink(dot)dinoex(dot)sub(dot)org>:
>
> On Fri, Mar 08, 2019 at 08:22:33PM +0000, Andrew Gierth wrote:
> ! >>>>> "Peter" == Peter <pmc(at)citylink(dot)dinoex(dot)sub(dot)org> writes:
> !
> ! Peter> Extra Compiler-Options:
> ! Peter> -march=pentium3
> !
> ! I CC'd you on my response to Palle, but to spell it out, what you need
> ! to do to fix this is either:
> !
> ! 1. Remove the -march=pentium3 option.
> !
> ! 2. Add the -mstackrealign option as well.
>
> Yes, thank You, this got clear to me in the afternoon.
>
> ! Either way should work. Could you try (one or both, your preference) and
> ! report back?
>
> Yes, -mstackrealign helps. So, as my local problem is now solved,
> I am thinking about that "greater good for mankind" thing. ;)
>
> At least one other person did run into the issue, and from Your
> explanation I understand that this is not a postgres issue, but
> could happen to any piece of software that decides to use gcc.
>
> Now it seems easy to put this compiler option into the port's
> specific makefile for postgreSQL, but it should actually be fixed
> systemwide.
>
> But, while it gets recommended to set the cpu-type systemwide on
> FreeBSD, it is not recommend for the system owner to set CFLAGS
> systemwide (even less specific ones for gcc - and I didn't find
> a proper way to do that, anyway).
>
> So my proposal is that this one belongs into /usr/ports/Mk/bsd.gcc.mk
>
> + .if ${MACHINE_CPU:Msse} && ${MACHINE_ARCH} == i386
> + CFLAGS+= -mstackrealign
> + .endif
>
> That seems to work. Palle, Your opinion?

Well, we ideally want the binary packages built with the ports framework, for a specific platform, in this case i386, to work on all i386 machines. This makes it a bit more complicated. We would have to check if the user has any of -msse, -msse2, -march=pentium3 or later, or any similar flag that enables use of SSE or later, and if the underlying userland is built with clang, and in that case add -mstackrealign as well.

Perhaps, as Andrew suggests, just adding -mstackrealign defensively in the port for i386 is a reasonable tradeoff? It would not help for other ports though.

I'm cc:ing gerald(at)FreeBSD(dot)org <mailto:gerald(at)FreeBSD(dot)org>, maintainer of Mk/bsd.gcc.mk, to see if he has any i thoughts about this. I will forward Andrew's analyze to Gerald as well.

Palle

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Peter 2019-03-09 14:43:36 Re: Upgrade 10.5->10.6 : db crash BUS ERROR (sig 10), reproducible
Previous Message Peter 2019-03-09 00:17:07 Re: Upgrade 10.5->10.6 : db crash BUS ERROR (sig 10), reproducible