diff options
author | Mike Pall <mike> | 2020-07-12 15:09:55 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2020-07-12 15:09:55 +0200 |
commit | 7eb96843ff9d4bed019e8cd7c17727557e39e89c (patch) | |
tree | 14b220ce0928164a8c25e79c205fb61369bbc98b | |
parent | 53f82e6e2e858a0a62fd1a2ff47e9866693382e6 (diff) | |
download | luajit-7eb96843ff9d4bed019e8cd7c17727557e39e89c.tar.gz luajit-7eb96843ff9d4bed019e8cd7c17727557e39e89c.tar.bz2 luajit-7eb96843ff9d4bed019e8cd7c17727557e39e89c.zip |
Add FAQ about sandboxing. Minor fixes.
-rw-r--r-- | doc/extensions.html | 2 | ||||
-rw-r--r-- | doc/faq.html | 40 |
2 files changed, 33 insertions, 9 deletions
diff --git a/doc/extensions.html b/doc/extensions.html index b36e2855..0fc65330 100644 --- a/doc/extensions.html +++ b/doc/extensions.html | |||
@@ -326,7 +326,7 @@ the toolchain used to compile LuaJIT: | |||
326 | </tr> | 326 | </tr> |
327 | <tr class="odd"> | 327 | <tr class="odd"> |
328 | <td class="excplatform">Windows/x64</td> | 328 | <td class="excplatform">Windows/x64</td> |
329 | <td class="exccompiler">MSVC or WinSDK</td> | 329 | <td class="exccompiler">MSVC</td> |
330 | <td class="excinterop"><b style="color: #00a000;">Full</b></td> | 330 | <td class="excinterop"><b style="color: #00a000;">Full</b></td> |
331 | </tr> | 331 | </tr> |
332 | <tr class="even"> | 332 | <tr class="even"> |
diff --git a/doc/faq.html b/doc/faq.html index 6208882b..65b0d842 100644 --- a/doc/faq.html +++ b/doc/faq.html | |||
@@ -55,7 +55,7 @@ dd { margin-left: 1.5em; } | |||
55 | </li></ul> | 55 | </li></ul> |
56 | </div> | 56 | </div> |
57 | <div id="main"> | 57 | <div id="main"> |
58 | <dl> | 58 | <dl id="info"> |
59 | <dt>Q: Where can I learn more about LuaJIT and Lua?</dt> | 59 | <dt>Q: Where can I learn more about LuaJIT and Lua?</dt> |
60 | <dd> | 60 | <dd> |
61 | <ul style="padding: 0;"> | 61 | <ul style="padding: 0;"> |
@@ -75,7 +75,7 @@ has information about diverse topics.</li> | |||
75 | </ul> | 75 | </ul> |
76 | </dl> | 76 | </dl> |
77 | 77 | ||
78 | <dl> | 78 | <dl id="tech"> |
79 | <dt>Q: Where can I learn more about the compiler technology used by LuaJIT?</dt> | 79 | <dt>Q: Where can I learn more about the compiler technology used by LuaJIT?</dt> |
80 | <dd> | 80 | <dd> |
81 | I'm planning to write more documentation about the internals of LuaJIT. | 81 | I'm planning to write more documentation about the internals of LuaJIT. |
@@ -91,7 +91,7 @@ And, you know, reading the source is of course the only way to enlightenment. :- | |||
91 | </dd> | 91 | </dd> |
92 | </dl> | 92 | </dl> |
93 | 93 | ||
94 | <dl> | 94 | <dl id="arg"> |
95 | <dt>Q: Why do I get this error: "attempt to index global 'arg' (a nil value)"?<br> | 95 | <dt>Q: Why do I get this error: "attempt to index global 'arg' (a nil value)"?<br> |
96 | Q: My vararg functions fail after switching to LuaJIT!</dt> | 96 | Q: My vararg functions fail after switching to LuaJIT!</dt> |
97 | <dd>LuaJIT is compatible to the Lua 5.1 language standard. It doesn't | 97 | <dd>LuaJIT is compatible to the Lua 5.1 language standard. It doesn't |
@@ -101,7 +101,7 @@ functions from Lua 5.0.<br>Please convert your code to the | |||
101 | vararg syntax</a>.</dd> | 101 | vararg syntax</a>.</dd> |
102 | </dl> | 102 | </dl> |
103 | 103 | ||
104 | <dl> | 104 | <dl id="x87"> |
105 | <dt>Q: Why do I get this error: "bad FPU precision"?<br> | 105 | <dt>Q: Why do I get this error: "bad FPU precision"?<br> |
106 | <dt>Q: I get weird behavior after initializing Direct3D.<br> | 106 | <dt>Q: I get weird behavior after initializing Direct3D.<br> |
107 | <dt>Q: Some FPU operations crash after I load a Delphi DLL.<br> | 107 | <dt>Q: Some FPU operations crash after I load a Delphi DLL.<br> |
@@ -123,7 +123,7 @@ Please check the Delphi docs for the Set8087CW method. | |||
123 | 123 | ||
124 | </dl> | 124 | </dl> |
125 | 125 | ||
126 | <dl> | 126 | <dl id="ctrlc"> |
127 | <dt>Q: Sometimes Ctrl-C fails to stop my Lua program. Why?</dt> | 127 | <dt>Q: Sometimes Ctrl-C fails to stop my Lua program. Why?</dt> |
128 | <dd>The interrupt signal handler sets a Lua debug hook. But this is | 128 | <dd>The interrupt signal handler sets a Lua debug hook. But this is |
129 | currently ignored by compiled code (this will eventually be fixed). If | 129 | currently ignored by compiled code (this will eventually be fixed). If |
@@ -134,7 +134,31 @@ twice to get stop your program. That's similar to when it's stuck | |||
134 | running inside a C function under the Lua interpreter.</dd> | 134 | running inside a C function under the Lua interpreter.</dd> |
135 | </dl> | 135 | </dl> |
136 | 136 | ||
137 | <dl> | 137 | <dl id="sandbox"> |
138 | <dt>Q: Can Lua code be safely sandboxed?</dt> | ||
139 | <dd> | ||
140 | Maybe for an extremly restricted subset of Lua and if you relentlessly | ||
141 | scrutinize every single interface function you offer to the untrusted code.<br> | ||
142 | |||
143 | Although Lua provides some sandboxing functionality (<tt>setfenv()</tt>, hooks), | ||
144 | it's very hard to get this right even for the Lua core libraries. Of course, | ||
145 | you'll need to inspect any extension library, too. And there are libraries | ||
146 | that are inherently unsafe, e.g. the <a href="ext_ffi.html">FFI library</a>.<br> | ||
147 | |||
148 | Relatedly, <b>loading untrusted bytecode is not safe!</b> It's trivial | ||
149 | to crash the Lua or LuaJIT VM with maliciously crafted bytecode. This is | ||
150 | well known and there's no bytecode verification on purpose, so please | ||
151 | don't report a bug about it. Check the <tt>mode</tt> parameter for the | ||
152 | <tt>load*()</tt> functions to disable loading of bytecode.<br> | ||
153 | |||
154 | In general, the only promising approach is to sandbox Lua code at the | ||
155 | process level and not the VM level.<br> | ||
156 | |||
157 | More reading material at the <a href="http://lua-users.org/wiki/SandBoxes"><span class="ext">»</span> Lua Wiki</a> and <a href="https://en.wikipedia.org/wiki/Sandbox_(computer_security)">Wikipedia</a>. | ||
158 | </dd> | ||
159 | </dl> | ||
160 | |||
161 | <dl id="patches"> | ||
138 | <dt>Q: Why doesn't my favorite power-patch for Lua apply against LuaJIT?</dt> | 162 | <dt>Q: Why doesn't my favorite power-patch for Lua apply against LuaJIT?</dt> |
139 | <dd>Because it's a completely redesigned VM and has very little code | 163 | <dd>Because it's a completely redesigned VM and has very little code |
140 | in common with Lua anymore. Also, if the patch introduces changes to | 164 | in common with Lua anymore. Also, if the patch introduces changes to |
@@ -145,7 +169,7 @@ can use source transformations or use wrapper or proxy functions. | |||
145 | The compiler will happily optimize away such indirections.</dd> | 169 | The compiler will happily optimize away such indirections.</dd> |
146 | </dl> | 170 | </dl> |
147 | 171 | ||
148 | <dl> | 172 | <dl id="arch"> |
149 | <dt>Q: Lua runs everywhere. Why doesn't LuaJIT support my CPU?</dt> | 173 | <dt>Q: Lua runs everywhere. Why doesn't LuaJIT support my CPU?</dt> |
150 | <dd>Because it's a compiler — it needs to generate native | 174 | <dd>Because it's a compiler — it needs to generate native |
151 | machine code. This means the code generator must be ported to each | 175 | machine code. This means the code generator must be ported to each |
@@ -156,7 +180,7 @@ architectures. Other architectures will follow based on sufficient user | |||
156 | demand and/or sponsoring.</dd> | 180 | demand and/or sponsoring.</dd> |
157 | </dl> | 181 | </dl> |
158 | 182 | ||
159 | <dl> | 183 | <dl id="when"> |
160 | <dt>Q: When will feature X be added? When will the next version be released?</dt> | 184 | <dt>Q: When will feature X be added? When will the next version be released?</dt> |
161 | <dd>When it's ready.<br> | 185 | <dd>When it's ready.<br> |
162 | C'mon, it's open source — I'm doing it on my own time and you're | 186 | C'mon, it's open source — I'm doing it on my own time and you're |