<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/12/1105bab9c10b9c01731f4c1bab489e1a"
  from="Nicolas Cannasse &lt;warplayer@f...&gt;"
  author="Nicolas Cannasse"
  date="2003-12-08T05:39:10"
  subject="Re: [Caml-list] language-based permissions?"
  prev="2003/12/083716029d8d303b29e49340afec64e0"
  next="2003/12/794dd4e65d8ed369f6a8bf00a7fc3953"
  prev-in-thread="2003/12/083716029d8d303b29e49340afec64e0"
  prev-thread="2003/12/9858c49f93267380e2253b15dcb61404"
  next-thread="2003/12/03fba8ae19894a59d47993bc1f31be69"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] language-based permissions?">
<msg 
  url="2003/12/083716029d8d303b29e49340afec64e0"
  from="Josh Burdick &lt;jburdick@g...&gt;"
  author="Josh Burdick"
  date="2003-12-08T05:12:28"
  subject="[Caml-list] language-based permissions?">
<msg 
  url="2003/12/1105bab9c10b9c01731f4c1bab489e1a"
  from="Nicolas Cannasse &lt;warplayer@f...&gt;"
  author="Nicolas Cannasse"
  date="2003-12-08T05:39:10"
  subject="Re: [Caml-list] language-based permissions?">
</msg>
</msg>
</thread>

<contents>
&gt;     I noticed that as of OCaml 3.05, there was a new option,
&gt; "-nostdlib".  It seems superficially like with this, and the
&gt; "-nopervasives" option, you could do language-based security (as in the
&gt; MMM web browser of yore, Java, and Perl's Safe module, among many others.)
&gt;     In the attached three files, it seems like "foo.ml" should only be
&gt; allowed to see, and use, the primitives in "fileworld.ml" (which aren't
&gt; much; this is a toy example.)  If "foo.ml" tries to use anything else
&gt; (as in the commented-out "print_string" line), it gets "Unbound value"
&gt; errors in compiling, and can't.
&gt;     My question: could "foo.ml" call other primitives somehow, even
&gt; though they're not linked in?  Using the preprocessor, or "external"
&gt; functions", maybe?  (Assuming that you don't use the  "-unsafe" option,
&gt; of course...)

About security :
Primitive calling is not the only way to compromise security in a virtual
machine, there is also buffer overflows, among others. Currently the Ocaml
bytecode VM is not performing any check, and then is relying on a
well-formed bytecode (means : correct structure, and passed through the
type-checker). Even if you forbid the use of all "dangerous" primitives they
might still be a lot of security holes involving malicious-formed bytecode.
One hope : since the ocaml GC-allocated memory is not on the C heap, it's
then a lot more difficult to exploit.

The bad news is that if you want a perfect secure VM, you should check most
of the primitives arguments types at runtime, thus giving back the speedup
you got from type checking at compile time.

Nicolas Cannasse

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

</contents>

</message>

