Commit Graph

752 Commits

Author SHA1 Message Date
Kartik K. Agaram 56f1b97b9c sandbox os.remove 2022-03-17 15:38:50 -07:00
Kartik K. Agaram 1d3101507e fix some warnings 2022-03-17 00:15:16 -07:00
Kartik K. Agaram f9fc4a3d58 file handles vs file objects, ugh 2022-03-17 00:01:36 -07:00
Kartik K. Agaram 5380817ce6 function names from globals rather than debug info
This reclaims all the slowdown in sieve.tlv, and it also is now smart
enough to detect calls to global bindings that pass through variables.

On the flip side, we lose names for non-globals. But that's not very
useful anyway in Teliva's context.

This is still not enough to detect callers through coroutines
(intervening anonymous functions), though.
2022-03-16 23:53:08 -07:00
Kartik K. Agaram 76d1dda240 bring back hack when caller is main
Partially undoes commit f2d29c22f8.
2022-03-16 23:45:42 -07:00
Kartik K. Agaram 785dfaa1ec cache function names
This brings down the slowdown in sieve.tlv from 50% to 25% (15s).
2022-03-16 23:45:38 -07:00
Kartik K. Agaram 155f6a8027 standardize some names 2022-03-16 21:48:41 -07:00
Kartik K. Agaram fffcc8b9ab stop running task.scheduler by default
sieve.tlv is 50% slower (18s vs 12s) with the new function call
instrumentation.
2022-03-16 21:38:34 -07:00
Kartik K. Agaram d6554919b1 delete dead code 2022-03-16 21:28:58 -07:00
Kartik K. Agaram ef5195dee9 simplify function call instrumentation
src/ldo.c now has a minimal diff with Lua 5.1.

It might be a bit slower than it was before, but not noticeably so..

This approach doesn't support indirect calls.
2022-03-16 21:19:19 -07:00
Kartik K. Agaram 182408ec54 drop a header 2022-03-16 20:33:28 -07:00
Kartik K. Agaram ed5efcd8a0 drop a forward decl 2022-03-16 20:31:43 -07:00
Kartik K. Agaram 709cc25130 start cleaning up function call instrumentation
It's a mess. I calculate call-graph depth one way and calculate caller
names another way. At least one of the ways fails to work with indirect
calls. Hopefully the other way works?
2022-03-16 20:29:50 -07:00
Kartik K. Agaram b9c187d259 stop using tasks in start_reading/start_writing
We just need queues/streams for file I/O. No need to complect
concurrency concerns with them.
2022-03-16 17:03:38 -07:00
Kartik K. Agaram ab89be1ed3 Teliva's been broken 2 days while I mess with docs 2022-03-15 16:00:08 -07:00
Kartik K. Agaram 2662b1afed . 2022-03-14 18:37:56 -07:00
Kartik K. Agaram 5e976554dd drop the lfs library
I can't feel confident about its sandboxing story yet. And if we can't
build a file navigator, what are we even doing with it.
2022-03-14 17:26:13 -07:00
Kartik K. Agaram 6f5f6849dd . 2022-03-14 17:23:38 -07:00
Kartik K. Agaram babaa235b1 update link to manual 2022-03-14 16:46:05 -07:00
Kartik K. Agaram 2b81ded335 typo 2022-03-14 16:35:24 -07:00
Kartik K. Agaram 06a5e841d1 doc: curses 2022-03-14 11:47:15 -07:00
Kartik K. Agaram a8df25c497 doc: flesh out tasks and channels 2022-03-14 09:56:41 -07:00
Kartik K. Agaram b571a342d7 doc: correct and flesh out json 2022-03-14 09:32:38 -07:00
Kartik K. Agaram 1eb37f220d typo 2022-03-14 07:59:41 -07:00
Kartik K. Agaram 4e89474820 document functions that are sandboxed 2022-03-13 17:45:10 -07:00
Kartik K. Agaram 6133cfa524 drop docs for 2 functions removed from Lua 2022-03-13 17:39:57 -07:00
Kartik K. Agaram b68405fe31 delete debug library
There's security issues here, and they're subtle. Dropping for now until
I or someone else finds a need for them.
2022-03-13 17:36:01 -07:00
Kartik K. Agaram 776d9f9032 standard markup 2022-03-13 17:32:53 -07:00
Kartik K. Agaram 7c843c0b8a . 2022-03-13 17:31:28 -07:00
Kartik K. Agaram e67e61a063 one more highlight 2022-03-13 16:49:04 -07:00
Kartik K. Agaram 4e6ea0adad rudimentary docs for libraries added to Teliva 2022-03-13 16:46:46 -07:00
Kartik K. Agaram ee7f893a7e drop string.dump, clean up docs around it 2022-03-13 14:41:41 -07:00
Kartik K. Agaram 35a6794386 rip out most references to C and userdata in docs 2022-03-13 14:19:08 -07:00
Kartik K. Agaram 23e7cf9c52 starting to spend some time improving docs 2022-03-13 14:01:13 -07:00
Kartik K. Agaram 1017e80fe5 less confusing error when apps get past main 2022-03-13 12:12:19 -07:00
Kartik K. Agaram 6ece3bb664 toot-toot.tlv: scrolling 2022-03-12 09:06:12 -08:00
Kartik K. Agaram cebe9abffe more extensive deletions from the Lua manual
I'm trying to represent where Teliva borrows from Lua, but without
making it seem identical.

Please support the Lua project!
2022-03-10 23:36:22 -08:00
Kartik K. Agaram cee42880e5 zet.tlv: thoroughly test rendering single zettel 2022-03-10 15:38:26 -08:00
Kartik K. Agaram 04a65e05f8 leak check 2022-03-10 09:56:37 -08:00
Kartik K. Agaram 0fa83e1d94 support fixing >1 test failure from within Teliva
This bug was caused by me forgetting that lua_setglobal affects the
stack.
2022-03-10 09:47:10 -08:00
Kartik K. Agaram 7030e70ef3 reconcile template in all apps 2022-03-10 04:32:57 -08:00
Kartik K. Agaram e627114751 zet.tlv: first screen tests
In the process I found a couple of bugs in fake screen primitives.
2022-03-10 04:30:58 -08:00
Kartik K. Agaram 70c3ec42bc screen tests: support bold, reverse, color
We can't test combinations of these yet because Lua 5.1 doesn't support
bitwise operators. Reason #1 to upgrade.
2022-03-08 22:42:32 -08:00
Kartik K. Agaram 08c49b5a0a protect framework files from apps
There's a separate open question here of where Teliva should store files
like teliva_editor_state and teliva_editor_buffer. One school of thought
is that apps should never be dropping crud into people's directories. On
the other hand, I'm kinda encouraging people so far to just run apps
from Teliva's directory. Perhaps that makes it ok?
2022-03-08 19:20:53 -08:00
Kartik K. Agaram 2b47f76308 just always temp files to be created
Implication: os.rename now needs to be sandboxed. Hopefully it's
tractable to treat it as conceptually identical to opening two files.
2022-03-07 21:57:11 -08:00
Kartik K. Agaram 2d393bfb80 stop loading libraries after app code
This whole approach of disallowing overriding is suspect.
2022-03-07 21:43:00 -08:00
Kartik K. Agaram dd8730920a purge all support for per-function permissions
We're now back to the problem of how to transparently allow Teliva to
create temporary filenames without every app having to explicitly allow
them.

I think I may need to define start_writing in C, so that it can use a
non-sandboxed version of io.open.
2022-03-07 20:50:41 -08:00
Kartik K. Agaram b9fea70b0a yup, this whole caller-based approach is busted
How can we scope anything to a subset of an app that is user-visible in
such a dynamic language as Lua?! X(
2022-03-07 19:23:26 -08:00
Kartik K. Agaram a0674f7b85 hokey primitive to create temporary file
The trouble with os.tmpname() is that it always creates in /tmp.
If /tmp is in a different volume from our real filename, os.rename()
will fail.

This new primitive doesn't support primitive paths yet.

I'm also again nervous about the security implications of my whole
approach. What if we create an inner function called start_writing?
Would we be able to do anything inside it? I'm starting to suspect this
whole approach of going by caller name is broken. An app could also
create inner functions called 'main'..
2022-03-07 19:14:02 -08:00
Kartik K. Agaram 88827db20d slightly firm up phases in pmain 2022-03-07 16:01:19 -08:00