Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h2dfV-0007HP-0W for pgsql-admin@arkaria.postgresql.org; Sat, 09 Mar 2019 15:13:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h2dfR-0004nL-Nr for pgsql-admin@arkaria.postgresql.org; Sat, 09 Mar 2019 15:13:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h2dfR-0004jT-E5 for pgsql-admin@lists.postgresql.org; Sat, 09 Mar 2019 15:13:41 +0000 Received: from uucp.dinoex.org ([2a0b:f840::12] helo=uucp.dinoex.sub.de) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h2dfJ-00018V-QJ for pgsql-admin@postgresql.org; Sat, 09 Mar 2019 15:13:40 +0000 Received: from uucp.dinoex.sub.de (uucp.dinoex.sub.de [194.45.71.2]) by uucp.dinoex.sub.de (8.15.2/8.15.2) with ESMTPS id x29FD5FA043953 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 9 Mar 2019 16:13:06 +0100 (CET) (envelope-from pmc@citylink.dinoex.sub.org) Received: from citylink.dinoex.sub.org (uucp@localhost) by uucp.dinoex.sub.de (8.15.2/8.15.2/Submit) with UUCP id x29FD5ij043952; Sat, 9 Mar 2019 16:13:05 +0100 (CET) (envelope-from pmc@citylink.dinoex.sub.org) Received: from gate.oper.dinoex.org (gate-e [192.168.98.2]) by citylink.dinoex.sub.de (8.15.2/8.15.2) with ESMTP id x29Ehr5S023015; Sat, 9 Mar 2019 15:43:53 +0100 (CET) (envelope-from peter@gate.oper.dinoex.org) Received: from gate.oper.dinoex.org (gate-e [192.168.98.2]) by gate.oper.dinoex.org (8.15.2/8.15.2) with ESMTP id x29Ehar4023011; Sat, 9 Mar 2019 15:43:36 +0100 (CET) (envelope-from peter@gate.oper.dinoex.org) Received: (from peter@localhost) by gate.oper.dinoex.org (8.15.2/8.15.2/Submit) id x29EhaHL023010; Sat, 9 Mar 2019 15:43:36 +0100 (CET) (envelope-from peter) Date: Sat, 9 Mar 2019 15:43:36 +0100 From: Peter To: Palle Girgensohn Cc: Andrew Gierth , pgsql-admin@postgresql.org, "pgsql@freebsd.org" , "gerald@freebsd.org" Subject: Re: Upgrade 10.5->10.6 : db crash BUS ERROR (sig 10), reproducible Message-ID: <20190309144336.GA17688@gate.oper.dinoex.org> References: <20190308012012.GA49481@gate.oper.dinoex.org> <87y35p9l0k.fsf@news-spur.riddles.org.uk> <20190309001707.GA14810@gate.oper.dinoex.org> <4BD693C6-B287-4153-A296-D65BB9874CB2@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4BD693C6-B287-4153-A296-D65BB9874CB2@FreeBSD.org> User-Agent: Mutt/1.11.1 (2018-12-01) X-Milter: Spamilter (Reciever: uucp.dinoex.sub.de; Sender-ip: 194.45.71.2; Sender-helo: uucp.dinoex.sub.de;) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (uucp.dinoex.sub.de [194.45.71.2]); Sat, 09 Mar 2019 16:13:10 +0100 (CET) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi Palle! On Sat, Mar 09, 2019 at 01:42:55PM +0100, Palle Girgensohn wrote: ! > 9 mars 2019 kl. 01:17 skrev Peter : ! > 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. Yes, that was my intention! The MACHINE_CPU variable gets already populated with "sse" (from somewhere in /usr/share/mk). What I usually do, I do only set the proper CPU type in /etc/make.conf, and then the "-march=pentium3" (or whatever CPU there is) appears magically in all builds. I didn't configure this! /etc/make.conf: ! # Maschine ist Pentium-3 ! CPUTYPE?= p3 Nothing more is needed, and now in any ports' directory, we get ! >postgresql10-server$ make -V MACHINE_CPU ! sse i686 mmx i586 i486 Contrarily, if I remove the CPUTYPE from /etc/make.conf, then it says: ! >postgresql10-server$ make -V MACHINE_CPU ! i486 And I suppose these strings appear to be tested for such cases. ! 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, If the user explicitely drop in those options, then it gets indeed complicated. I don't do that - I do NOT set any -march or whatever options, I only set CPUTYPE in make.conf, as it gets recommended by developers, e.g. here: https://forums.freebsd.org/threads/whats-in-your-make-conf.36150/post-199595 And that's why I am thinking of a global fix - because this fault is happening on recommended practices ground! ! and if the ! underlying userland is built with clang Ouch, that one I did neglect. One could have built the whole system with gcc, and then no action is needed. Hmm... ! 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. That is reasonable, certainly. :) PMc