NetBSD Problem Report #51170

From bjjl@db.qwabbl.com  Thu May 26 12:02:57 2016
Return-Path: <bjjl@db.qwabbl.com>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id E047E7A494
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 26 May 2016 12:02:56 +0000 (UTC)
Message-Id: <20160526120253.CB1912E0B0@db.qwabbl.com>
Date: Thu, 26 May 2016 14:02:53 +0200 (CEST)
From: netbsd@benjaminlorenz.email
To: gnats-bugs@NetBSD.org
Subject: SIGSEGV during build of nodejs4 with netbsd/current
X-Send-Pr-Version: 3.95

>Number:         51170
>Category:       pkg
>Synopsis:       SIGSEGV during build of nodejs4 with netbsd/current
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 26 12:05:00 +0000 2016
>Last-Modified:  Fri May 27 09:05:00 +0000 2016
>Originator:     Benjamin Lorenz
>Release:        NetBSD 7.99.29
>Organization:

>Environment:


System: NetBSD db.qwabbl.com 7.99.29 NetBSD 7.99.29 (GENERIC) #0: Thu May 26 09:51:40 CEST 2016 root@db.qwabbl.com:/usr/obj/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
	While compiling nodejs 4.4.5 from pkgsrc, I get a segmentation fault with
	a current system.

1]   Segmentation fault (core dumped) "/usr/pkg/src/la...
gmake[1]: *** [deps/v8/tools/gyp/v8_snapshot.target.mk:13: /usr/pkg/src/lang/nodejs4/work/node-v4.4.5/out/Release/obj.target/v8_snapshot/geni/snapshot.cc] Error 139
gmake[1]: Leaving directory '/usr/pkg/src/lang/nodejs4/work/node-v4.4.5/out'
gmake: *** [Makefile:45: node] Error 2
*** Error code 2

bash-4.3# pwd
/usr/pkg/src/lang/nodejs4/work/node-v4.4.5/deps/v8/tools/gyp
bash-4.3# ls -l
total 4180
-rw-------  1 root  wheel  2045528 May 26 13:59 mksnapshot.core
-rw-r--r--  1 root  wheel    74177 May 24 19:39 v8.gyp
bash-4.3# 

Used to compile fine with netbsd current from February 2016. 

>How-To-Repeat:

>Fix:


>Audit-Trail:
From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@NetBSD.org, pkg-manager@netbsd.org, gnats-admin@netbsd.org, 
	pkgsrc-bugs@netbsd.org
Cc: 
Subject: Re: pkg/51170: SIGSEGV during build of nodejs4 with netbsd/current
Date: Thu, 26 May 2016 08:37:42 -0400

 On May 26, 12:05pm, netbsd@benjaminlorenz.email (netbsd@benjaminlorenz.email) wrote:
 -- Subject: pkg/51170: SIGSEGV during build of nodejs4 with netbsd/current


 Sounds like PaX mprotect. Find out which binary coredumps and paxctl +m it.

 christos

From: christos@zoulas.com (Christos Zoulas)
To: Benjamin Lorenz <inbox@benjaminlorenz.email>, gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/51170: SIGSEGV during build of nodejs4 with netbsd/current
Date: Thu, 26 May 2016 10:41:58 -0400

 On May 26,  3:35pm, inbox@benjaminlorenz.email (Benjamin Lorenz) wrote:
 -- Subject: Re: pkg/51170: SIGSEGV during build of nodejs4 with netbsd/curren

 | Hi Christos,
 | 
 | about to recompile nodejs and checking if this helps.
 | 
 | I had another program, /usr/pkg/bin/mongo (from pkgsrc/databases/MongoDB), =
 | which crashed as well with a memory error. paxctl +m makes it run fine. Tha=
 | nks for your quick advise!
 | 
 | Does this mean the programs are buggy?

 They are misbehaving. They might need to do this or they might just
 be careless when mapping memory. PaX MPROTECT prevents programs
 from mapping memory that is both writable and executable at the
 same time. It will take away one or the other bit. Some programs
 (like just-in-time compilers for example java) need to do this
 because they generate code on the fly and they need to be able to
 write the code and execute it. Mongo apparently uses V8 internally:
 https://jira.mongodb.org/browse/SERVER-1592

 christos

From: Benjamin Lorenz <inbox@benjaminlorenz.email>
To: gnats-bugs@NetBSD.org
Cc: christos@zoulas.com
Subject: Re: pkg/51170: SIGSEGV during build of nodejs4 with netbsd/current
Date: Thu, 26 May 2016 15:35:44 +0200

 --=-NlGeJZD2y1R3BjMLUtrv
 Content-Type: text/plain; charset="utf-8"
 Content-Transfer-Encoding: quoted-printable

 Hi Christos,


 about to recompile nodejs and checking if this helps.


 I had another program, /usr/pkg/bin/mongo (from pkgsrc/databases/MongoDB), =
 which crashed as well with a memory error. paxctl +m makes it run fine. Tha=
 nks for your quick advise!


 Does this mean the programs are buggy?=C2=A0


 Best,
 Benjamin



  From:   Christos Zoulas <christos@zoulas.com>=20
  To:   <pkg-manager@netbsd.org>, <gnats-admin@netbsd.org>, <pkgsrc-bugs@net=
 bsd.org>, <netbsd@benjaminlorenz.email>=20
  Sent:   5/26/2016 2:40 PM=20
  Subject:   Re: pkg/51170: SIGSEGV during build of nodejs4 with netbsd/curr=
 ent=20

 The following reply was made to PR pkg/51170; it has been noted by GNATS.=20
 =20
 From: christos@zoulas.com (Christos Zoulas)=20
 To: gnats-bugs@NetBSD.org, pkg-manager@netbsd.org, gnats-admin@netbsd.org, =
 =20
  =C2=A0 =C2=A0 pkgsrc-bugs@netbsd.org=20
 Cc: =20
 Subject: Re: pkg/51170: SIGSEGV during build of nodejs4 with netbsd/current=
 =20
 Date: Thu, 26 May 2016 08:37:42 -0400=20
 =20
  On May 26, 12:05pm, netbsd@benjaminlorenz.email (netbsd@benjaminlorenz.ema=
 il) wrote:=20
  -- Subject: pkg/51170: SIGSEGV during build of nodejs4 with netbsd/current=
 =20
  =20
  =20
  Sounds like PaX mprotect. Find out which binary coredumps and paxctl +m it=
 .=20
  =20
  christos=20
  =20
 =

 --=-NlGeJZD2y1R3BjMLUtrv
 Content-Type: text/html; charset="utf-8"

 <html><head></head><body>Hi Christos,<div><br></div><div>about to recompile nodejs and checking if this helps.</div><div><br></div><div>I had another program, /usr/pkg/bin/mongo (from pkgsrc/databases/MongoDB), which crashed as well with a memory error. paxctl +m makes it run fine. Thanks for your quick advise!</div><div><br></div><div>Does this mean the programs are buggy?&nbsp;</div><div><br></div><div>Best,</div><div>Benjamin<br><br><br><div>
 From:
 

 Christos Zoulas &lt;christos@zoulas.com&gt;
 <br>
 
 To:
 

 &lt;pkg-manager@netbsd.org&gt;, &lt;gnats-admin@netbsd.org&gt;, &lt;pkgsrc-bugs@netbsd.org&gt;, &lt;netbsd@benjaminlorenz.email&gt;
 <br>
 
 Sent:

 
 5/26/2016 2:40 PM
 <br>
 
 Subject:
 

 Re: pkg/51170: SIGSEGV during build of nodejs4 with netbsd/current
 <br><br><blockquote class="mori" style="margin:0 0 0 .8ex;border-left:1px solid #CCC;padding-left:1ex;">The following reply was made to PR pkg/51170; it has been noted by GNATS.
 <br>
 <br>From: christos@zoulas.com (Christos Zoulas)
 <br>To: gnats-bugs@NetBSD.org, pkg-manager@netbsd.org, gnats-admin@netbsd.org, 
 <br> &nbsp; &nbsp; pkgsrc-bugs@netbsd.org
 <br>Cc: 
 <br>Subject: Re: pkg/51170: SIGSEGV during build of nodejs4 with netbsd/current
 <br>Date: Thu, 26 May 2016 08:37:42 -0400
 <br>
 <br> On May 26, 12:05pm, netbsd@benjaminlorenz.email (netbsd@benjaminlorenz.email) wrote:
 <br> -- Subject: pkg/51170: SIGSEGV during build of nodejs4 with netbsd/current
 <br> 
 <br> 
 <br> Sounds like PaX mprotect. Find out which binary coredumps and paxctl +m it.
 <br> 
 <br> christos
 <br> 
 <br></blockquote></div></div></body></html>
 --=-NlGeJZD2y1R3BjMLUtrv--

From: Benjamin Lorenz <inbox@benjaminlorenz.email>
To: Christos Zoulas <christos@zoulas.com>, gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/51170: SIGSEGV during build of nodejs4 with netbsd/current
Date: Thu, 26 May 2016 19:24:06 +0200

 --=-+6FPdhDN9cixzT0IJ1jw
 Content-Type: text/plain; charset="utf-8"
 Content-Transfer-Encoding: quoted-printable

 Hi Christos,


 They are misbehaving. They might need to do this or they might just=20
 be careless when mapping memory. PaX MPROTECT prevents programs=20
 from mapping memory that is both writable and executable at the=20
 same time. It will take away one or the other bit. Some programs=20
 (like just-in-time compilers for example java) need to do this=20
 because they generate code on the fly and they need to be able to=20
 write the code and execute it. Mongo apparently uses V8 internally:=20
 https://jira.mongodb.org/browse/SERVER-1592=C2=A0





 Yes, indeed, the two problematic programs share some code.


 How to fix this problem? Is it about changing the pkgsrc build process, to =
 include the paxctl call?=C2=A0


 And, why did this problem not occur back in January? Did we change our memo=
 ry management to become more pedantic in the last months?


 Cheers,
 Benjamin

 =

 --=-+6FPdhDN9cixzT0IJ1jw
 Content-Type: text/html; charset="utf-8"

 <html><head></head><body>Hi Christos,<div><br><div><blockquote class="mori" style="margin:0 0 0 .8ex;border-left:1px solid #CCC;padding-left:1ex;">They are misbehaving. They might need to do this or they might just
 <br>be careless when mapping memory. PaX MPROTECT prevents programs
 <br>from mapping memory that is both writable and executable at the
 <br>same time. It will take away one or the other bit. Some programs
 <br>(like just-in-time compilers for example java) need to do this
 <br>because they generate code on the fly and they need to be able to
 <br>write the code and execute it. Mongo apparently uses V8 internally:
 <br>https://jira.mongodb.org/browse/SERVER-1592&nbsp;</blockquote></div></div><br><div><div><blockquote class="mori" style="margin:0 0 0 .8ex;border-left:1px solid #CCC;padding-left:1ex;"></blockquote></div></div><div><div><blockquote class="mori" style="margin:0 0 0 .8ex;border-left:1px solid #CCC;padding-left:1ex;"></blockquote></div></div><div>Yes, indeed, the two problematic programs share some code.</div><div><br></div><div>How to fix this problem? Is it about changing the pkgsrc build process, to include the paxctl call?&nbsp;</div><div><br></div><div>And, why did this problem not occur back in January? Did we change our memory management to become more pedantic in the last months?</div><div><br></div><div>Cheers,</div><div>Benjamin</div><div><br></div></body></html>
 --=-+6FPdhDN9cixzT0IJ1jw--

From: christos@zoulas.com (Christos Zoulas)
To: Benjamin Lorenz <inbox@benjaminlorenz.email>, gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/51170: SIGSEGV during build of nodejs4 with netbsd/current
Date: Thu, 26 May 2016 14:00:54 -0400

 On May 26,  7:24pm, inbox@benjaminlorenz.email (Benjamin Lorenz) wrote:
 -- Subject: Re: pkg/51170: SIGSEGV during build of nodejs4 with netbsd/curren

 | Yes, indeed, the two problematic programs share some code.
 | 
 | 
 | How to fix this problem? Is it about changing the pkgsrc build process, to =
 | include the paxctl call?=C2=A0

 Yes...

 | And, why did this problem not occur back in January? Did we change our memo=
 | ry management to become more pedantic in the last months?

 And yes. You can turn it back off with:

 sysctl -w security.pax.mprotect.global=0

 But we are working on getting all the pkgsrc issues automatically ironed out.
 christos

From: Benjamin Lorenz <inbox@benjaminlorenz.email>
To: gnats-bugs@NetBSD.org, pkg-manager@netbsd.org, gnats-admin@netbsd.org,
	pkgsrc-bugs@netbsd.org, netbsd@benjaminlorenz.email
Cc: christos@zoulas.com
Subject: Re: pkg/51170: SIGSEGV during build of nodejs4 with netbsd/current
Date: Thu, 26 May 2016 23:26:49 +0200

 --=-8EoRdhr+eo4tytawrSzW
 Content-Type: text/plain; charset="utf-8"


 Hi Christos,



 | And, why did this problem not occur back in January? Did we change our memo= 
  | ry management to become more pedantic in the last months? 

  And yes. You can turn it back off with: 

  sysctl -w security.pax.mprotect.global=0 

  But we are working on getting all the pkgsrc issues automatically ironed out.


 The build process of nodejs4 resumes nicely after calling sysctl like above.


 Can I help in any way to fix mongodb and nodejs packages, or is it very well put in your hands?


 Best,
 Benjamin


 --=-8EoRdhr+eo4tytawrSzW
 Content-Type: text/html; charset="utf-8"

 <html><head></head><body><div><blockquote class="mori" style="margin:0 0 0 .8ex;border-left:1px solid #CCC;padding-left:1ex;"></blockquote></div>Hi Christos,<div><br></div><div><div><blockquote class="mori" style="margin:0 0 0 .8ex;border-left:1px solid #CCC;padding-left:1ex;">| And, why did this problem not occur back in January? Did we change our memo=
 <br> | ry management to become more pedantic in the last months?
 <br> 
 <br> And yes. You can turn it back off with:
 <br> 
 <br> sysctl -w security.pax.mprotect.global=0
 <br> 
 <br> But we are working on getting all the pkgsrc issues automatically ironed out.</blockquote></div><br><div><blockquote class="mori" style="margin:0 0 0 .8ex;border-left:1px solid #CCC;padding-left:1ex;"></blockquote></div><div>The build process of nodejs4 resumes nicely after calling sysctl like above.</div><div><br></div><div>Can I help in any way to fix mongodb and nodejs packages, or is it very well put in your hands?</div><div><br></div><div>Best,</div><div>Benjamin</div><div><br></div></div></body></html>
 --=-8EoRdhr+eo4tytawrSzW--

From: christos@zoulas.com (Christos Zoulas)
To: Benjamin Lorenz <inbox@benjaminlorenz.email>, gnats-bugs@NetBSD.org, 
	pkg-manager@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org, 
	netbsd@benjaminlorenz.email
Cc: 
Subject: Re: pkg/51170: SIGSEGV during build of nodejs4 with netbsd/current
Date: Thu, 26 May 2016 17:37:08 -0400

 On May 26, 11:26pm, inbox@benjaminlorenz.email (Benjamin Lorenz) wrote:
 -- Subject: Re: pkg/51170: SIGSEGV during build of nodejs4 with netbsd/curren

 | The build process of nodejs4 resumes nicely after calling sysctl like above.
 | 
 | Can I help in any way to fix mongodb and nodejs packages, or is it very well
 | put in your hands?

 You can send-pr with the broken packages so that they don't get lost...

 christos

From: Leonardo Taccari <leot@NetBSD.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/51170: SIGSEGV during build of nodejs4 with netbsd/current
Date: Fri, 27 May 2016 10:48:41 +0200

 Hello Benjamin!

 Benjamin Lorenz writes:
 > [...]  =

 >  I had another program, /usr/pkg/bin/mongo (from pkgsrc/databases/MongoD=
 B), =3D
 >  which crashed as well with a memory error. paxctl +m makes it run fine.=
  Tha=3D
 >  nks for your quick advise!
 > [...]  =

 Can you please try the following patch:

  http://netbsd.org/~leot/pkgsrc-patches/mongodb-pkg51170-patches

 Just fetch it (e.g. via ftp(1)) and then please apply it via:

  $ cd pkgsrc/databases/mongodb
  $ patch < <somewhere>/mongodb-pkg51170-patches

 (...where `<somewhere>' is the directory where is the above patch)

 Then completely rebuild databases/mongodb (e.g. via "make update")?
 This will avoid to manually invoke `paxctl +m' invokation against
 bin/mongo everytime you update the package.


 Please let us know if it will fix the issue!
 Ciao,
 L.

From: Leonardo Taccari <leot@NetBSD.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/51170: SIGSEGV during build of nodejs4 with netbsd/current
Date: Fri, 27 May 2016 11:00:47 +0200

 Hello Benjamin,

 netbsd@benjaminlorenz.email writes:
 > [...]
 > >Description:
 > 	While compiling nodejs 4.4.5 from pkgsrc, I get a segmentation fault wi=
 th
 > 	a current system.
 > =

 > 1]   Segmentation fault (core dumped) "/usr/pkg/src/la...
 > gmake[1]: *** [deps/v8/tools/gyp/v8_snapshot.target.mk:13: /usr/pkg/src/=
 lang/nodejs4/work/node-v4.4.5/out/Release/obj.target/v8_snaps
 > hot/geni/snapshot.cc] Error 139
 > gmake[1]: Leaving directory '/usr/pkg/src/lang/nodejs4/work/node-v4.4.5/=
 out'
 > gmake: *** [Makefile:45: node] Error 2
 > *** Error code 2
 > =

 > bash-4.3# pwd
 > /usr/pkg/src/lang/nodejs4/work/node-v4.4.5/deps/v8/tools/gyp
 > bash-4.3# ls -l
 > total 4180
 > -rw-------  1 root  wheel  2045528 May 26 13:59 mksnapshot.core
 > -rw-r--r--  1 root  wheel    74177 May 24 19:39 v8.gyp
 > bash-4.3# =

 > [...]
 JFT: unfortunately it seems that `mksnapshot' is compiled and then
 directly used during the build phase of lang/nodejs4 so unlike
 mongodb we can not use NOT_PAX_MPROTECT_SAFE here.

 For the moment the only work-around is to temporary disable PaX MPROTECT
 as Christos suggested and as you've done.


 Ciao,
 L.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.