From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/5947 Path: news.gmane.org!not-for-mail From: Laurent Bercot Newsgroups: gmane.linux.lib.musl.general Subject: Re: static build and dlopen Date: Wed, 27 Aug 2014 21:59:55 +0100 Message-ID: <53FE46CB.1040609@skarnet.org> References: <20140827164309.GO12888@brightrain.aerifal.cx> <53FE27E6.60902@skarnet.org> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1409173203 18684 80.91.229.3 (27 Aug 2014 21:00:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 Aug 2014 21:00:03 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-5954-gllmg-musl=m.gmane.org@lists.openwall.com Wed Aug 27 22:59:56 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1XMkJw-0005jO-9h for gllmg-musl@plane.gmane.org; Wed, 27 Aug 2014 22:59:56 +0200 Original-Received: (qmail 26387 invoked by uid 550); 27 Aug 2014 20:59:55 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 26379 invoked from network); 27 Aug 2014 20:59:55 -0000 X-SourceIP: 80.111.163.198 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: Xref: news.gmane.org gmane.linux.lib.musl.general:5947 Archived-At: > I tried to do it that way, but didn't worked. Seems on Linux when you > are using a dynamically linked executable this is not run directly, > but instead it is exec internally /lib/ld-linux.so.2, that's a program > that load and link your executable and it's dynamic libraries and > later exec it, so it takes the PID 1 and when it finish and give > control to your dynamically linked executable (Node.js in this case), > then since PID 1 has exited, the kernel has a kernel panic. No, the dynamic linker will run your executable with the same PID. What happened in your case was that for some reason either the dynamic linker failed to load your executable, and exited, or Node.js exited. In any case, the system didn't work as it was intended to; I can assure you it's supposed to work. Remember that with musl, the dynamic linker is called /lib/ld-musl-${ARCH}.so.1 instead of /lib/ld-linux.so.2 so you might want to check your setup again. That said, unless your Node.js really takes care of everything, it's a good idea to not run it as PID 1, if only to make your filesystem read-only at shutdown time. > I've done a dumb /init program that just exec the dynamically linked > Node.js with the real /init in Javascript and it worked. Ugly hack, > but at least it does its job :-) By doing this, you are effectively using Node.js as process 1, since it is your Javascript interpreter. So there is no reason you cannot run it directly without your hack. I'm still concerned about Node.js' ability to shutdown your machine properly though. -- Laurent