caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: BOBOT Francois <Francois.BOBOT@cea.fr>
To: "xavier.leroy@college-de-france.fr" <xavier.leroy@college-de-france.fr>
Cc: "caml-list@inria.fr" <caml-list@inria.fr>
Subject: Re: [Caml-list] Dynamic link of C library
Date: Wed, 16 Feb 2022 07:32:14 +0000	[thread overview]
Message-ID: <093f4b4a021dc425bafc14ec4311141c45ac0747.camel@cea.fr> (raw)
In-Reply-To: <CAH=h3gGJgTMuk4jC4sRf5x0UjtsSOiZjmYkrw_i5+hbrwHEj8Q@mail.gmail.com>

Le dimanche 13 février 2022 à 17:55 +0100, Xavier Leroy a écrit :
> On Fri, Feb 11, 2022 at 7:18 PM BOBOT Francois 
> 
> Popular wisdom says that .so files must be installed in /usr/lib or
> /usr/local/lib or some other public place advertised in
> /etc/ld.so.conf.  (With semantic versioning, if applicable.)  Some
> applications install their own .so files in a specific directory, then
> consist in a shell script that sets LD_LIBRARY_PATH before running the
> main executable.

Thank you a lot for this bit of wisdom, I though LD_LIBRARY_PATH was
more widely used by tools.

> 
> I'm not convinced OCaml tools should try to implement a different
> behavior.  In particular, I would object to OPAM setting
> LD_LIBRARY_PATH in the environment to point to a directory owned by the
> user: it looks like a security risk.


It is true that it has been in the past source of security holes
(setuid program, sudo, ...), perhaps other holes remain.

Should we use -rpath[1] with $ORIGIN or @loader_path in order to use
relative path? I discarded this as too hackish, but other community
uses it (go, npm). Windows doesn't seems to have direct support for it,
but there are always an unknown way on this plateform[2].

More importantly if -rpath with relative path would solve the problem
for .cmxs it seems not to work for .cmxa. Since the OCaml part is
statically linked, the relative path will be to the executable not the
directory of the library, isn't it? An ld for OCaml executable[3] would
solve the problem (by not using .cmxa) but it is untested even if easy
to add to Dune.


[1]: https://www.lekensteyn.nl/rpath.html#what-is-rpath
[2]:
https://stackoverflow.com/questions/107888/is-there-a-windows-msvc-equivalent-to-the-rpath-linker-flag
[3] https://github.com/ocaml/dune/issues/3866

Kind regards,

-- 
François

  reply	other threads:[~2022-02-16  7:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-11 18:18 BOBOT Francois
2022-02-13 16:55 ` Xavier Leroy
2022-02-16  7:32   ` BOBOT Francois [this message]
2022-03-11 14:48 ` BOBOT Francois

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=093f4b4a021dc425bafc14ec4311141c45ac0747.camel@cea.fr \
    --to=francois.bobot@cea.fr \
    --cc=caml-list@inria.fr \
    --cc=xavier.leroy@college-de-france.fr \
    /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.
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).