mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Laurent Bercot <ska-dietlibc@skarnet.org>
To: musl@lists.openwall.com
Subject: Re: static build and dlopen
Date: Wed, 27 Aug 2014 21:59:55 +0100	[thread overview]
Message-ID: <53FE46CB.1040609@skarnet.org> (raw)
In-Reply-To: <CAKfGGh2A2zsSks_jknMDNy4kr2=jF+GbZwCWq8Hc8ceN46nZ6g@mail.gmail.com>

> 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



  parent reply	other threads:[~2014-08-27 20:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-27 14:14 piranna
2014-08-27 15:27 ` Szabolcs Nagy
2014-08-27 17:01   ` piranna
2014-08-27 17:20     ` Justin Cormack
2014-08-27 20:07       ` piranna
2014-08-27 16:43 ` Rich Felker
2014-08-27 17:10   ` piranna
2014-08-27 18:48     ` Laurent Bercot
2014-08-27 20:19       ` piranna
2014-08-27 20:51         ` Rich Felker
2014-08-27 20:59         ` Laurent Bercot [this message]
2014-08-27 21:04           ` Rich Felker
2014-08-27 22:54           ` Kurt H Maier
2014-08-27 23:24             ` Laurent Bercot
2014-08-27 23:36               ` Brent Cook
2014-09-01 23:38                 ` piranna
2014-09-02  0:38                   ` Rich Felker
2014-09-02  0:49                     ` piranna

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53FE46CB.1040609@skarnet.org \
    --to=ska-dietlibc@skarnet.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).