00:45:05 -!- amby has quit (Quit: so long suckers! i rev up my motorcylce and create a huge cloud of smoke. when the cloud dissipates im lying completely dead on the pavement).
00:47:42 <Sgeo_> Someone should document IBM RPG as though it was an esolang
00:48:13 <Sgeo_> There's a lot of vintage computing stuff that seems esoteric to modern eyes, huh.
02:00:02 <esolangs> [[Smoothbrain]] N https://esolangs.org/w/index.php?oldid=165335 * Ashli Katt * (+6950) Create page
02:00:27 <esolangs> [[User:Ashli Katt]] M https://esolangs.org/w/index.php?diff=165336&oldid=165059 * Ashli Katt * (+54) /* Languages I've Made */
02:00:32 <esolangs> [[Nothing Of-course, Timeless Hitchhikes In New Gardens]] https://esolangs.org/w/index.php?diff=165337&oldid=165225 * Jk.NDC * (+55)
02:04:58 <esolangs> [[Smoothbrain]] M https://esolangs.org/w/index.php?diff=165338&oldid=165335 * Ashli Katt * (+8) Edit wording to make it clear that '>' instruction is += and not =, so to speak
02:09:03 <esolangs> [[Smoothbrain]] M https://esolangs.org/w/index.php?diff=165339&oldid=165338 * Ashli Katt * (+197) Clarify behavior when WRITING invalid UTF-8 characters.
02:09:32 <esolangs> [[Smoothbrain]] M https://esolangs.org/w/index.php?diff=165340&oldid=165339 * Ashli Katt * (-3) Fix list
02:10:01 <esolangs> [[Smoothbrain]] M https://esolangs.org/w/index.php?diff=165341&oldid=165340 * Ashli Katt * (+13) Clarify exit code of previous UTF-8 change. Whoops!
02:24:56 -!- FreeFull has quit (Quit: Lost terminal).
02:46:14 <esolangs> [[User:Jk.NDC]] https://esolangs.org/w/index.php?diff=165342&oldid=165270 * Jk.NDC * (-6) /* semi-Weekly Riddle */
02:46:31 <esolangs> [[User:Jk.NDC]] https://esolangs.org/w/index.php?diff=165343&oldid=165342 * Jk.NDC * (+8) /* semi-Weekly Riddle */
02:46:43 <esolangs> [[User:Jk.NDC]] https://esolangs.org/w/index.php?diff=165344&oldid=165343 * Jk.NDC * (+1) /* semi-Weekly Riddle */
02:47:03 <esolangs> [[User:Jk.NDC]] https://esolangs.org/w/index.php?diff=165345&oldid=165344 * Jk.NDC * (+18) /* semi-Weekly Riddle */
04:18:30 <esolangs> [[5D Brainfuck With Multiverse Time Travel]] https://esolangs.org/w/index.php?diff=165346&oldid=88264 * Quuxplusone * (+102) /* Examples */ per my last email...
05:38:27 <esolangs> [[Siyu]] N https://esolangs.org/w/index.php?oldid=165347 * None1 * (+1251) Created page with "'''Siyu''' (Pinyin of Chinese word meaning dead fish) is an esolang invented by [[User:None1]]. It is a [[deadfish]] derivative. ==Commands== {| class="wikitable" |- ! Command !! Corresponding Chinese word !! Meaning |- | z || zeng jia (increase) || Increment the accumula
06:05:37 <esolangs> [[Bleh]] M https://esolangs.org/w/index.php?diff=165348&oldid=144085 * Ashli Katt * (-11) Edit User: link to remove alias
06:06:16 <esolangs> [[Foreach]] M https://esolangs.org/w/index.php?diff=165349&oldid=126931 * Ashli Katt * (-11) Edit User: link to remove alias
06:11:07 <esolangs> [[User:Ashli Katt]] M https://esolangs.org/w/index.php?diff=165350&oldid=165336 * Ashli Katt * (+3) Reword sheep link
06:17:49 <esolangs> [[Smoothbrain]] M https://esolangs.org/w/index.php?diff=165351&oldid=165341 * Ashli Katt * (+286) /* IO */ Clarify that STDIN behavior still reads byte-by-byte
06:20:43 -!- tromp has joined.
06:34:00 -!- Sgeo_ has quit (Read error: Connection reset by peer).
07:24:58 -!- ais523 has joined.
07:34:42 <esolangs> [[Smoothbrain]] M https://esolangs.org/w/index.php?diff=165352&oldid=165351 * Ashli Katt * (-428) /* IO */ Clarify IO and allow binary data
07:35:35 <esolangs> [[Smoothbrain]] M https://esolangs.org/w/index.php?diff=165353&oldid=165352 * Ashli Katt * (-34) /* Error States */ Add new error state
07:37:14 <esolangs> [[Smoothbrain]] M https://esolangs.org/w/index.php?diff=165354&oldid=165353 * Ashli Katt * (+9) /* IO */ Adjust position of (U+000A)
07:46:43 -!- tromp has quit (Quit: My iMac has gone to sleep. ZZZzzz…).
07:55:25 <esolangs> [[Isec]] https://esolangs.org/w/index.php?diff=165355&oldid=165304 * U * (-137)
07:59:26 <esolangs> [[Isec TC proof]] https://esolangs.org/w/index.php?diff=165356&oldid=165318 * U * (+36)
09:03:01 -!- tromp has joined.
09:10:32 <ais523> is it possible on Linux for a process running as root to change the memory map permissions (i.e. ability for its owner to read/write/execute a given memory map) for a different process, in a case where the process couldn't make that change itself?
09:11:21 <ais523> (I know how to do it when the process could make that change itself – you ptrace the other process, break at a system call, change the call to be an mprotect call, then once the mprotect happens rewind over the system call and run the original call)
09:12:46 <ais523> the motivating use of this is for a sandboxed JIT – it creates the code it wants to run, then asks a higher-privileged process to verify that the machine code it generated fulfils certain constraints, and if that process agrees it changes the memory from writable to executable
09:15:52 -!- tromp has quit (Quit: My iMac has gone to sleep. ZZZzzz…).
09:33:26 <ais523> hmm, I wonder if process_vm_writev could overwrite a map that's already executable-and-not-writable – the documentation doesn't rule it out, but I suspect that's a documentation mistake
09:37:20 -!- tromp has joined.
09:45:20 -!- roper has joined.
10:04:10 -!- wob_jonas has joined.
10:06:19 <wob_jonas> ais523: I don't see how such a sandbox would work. how would you ensure that the process only jumps to the correct entry points in the code?
10:07:03 <ais523> wob_jonas: you could have verified the outer process first to make sure it only jumps in certain ways – otherwise, it's probably useless
10:07:22 <wob_jonas> also if you want to change a mapping to executable then I don't see how you'd also have to stop the process from just making an anonymous executable mapping
10:07:35 <ais523> it's much easier to verify code for type safety and jump targets than it is to verify that it's only capable of outputting type-safe asm
10:08:03 <ais523> oh, that's easy, most OSes allow you to restrict a process from making certain types of mapping nowadays
10:08:17 <ais523> on Linux you can do it using seccomp to ban certain parameters to the mmap and mprotect system calls
10:09:40 <wob_jonas> hmm, but at that point either you trust your verifier enough that you allow the process to make mprotect calls itself, or you put a full filter on all the system calls that the process is allowed to do, with like selinux or bpf or whatever, and allow the one mmap/mprotect call through the filter
10:09:53 <ais523> I guess what you'd have to do is to put the filter into ptrace mode (i.e. "a debugger can approve this system call but it's banned by default")
10:10:13 <wob_jonas> right, put a hole in the filter to temporarily allow a call
10:10:23 <ais523> and then when you attach the debugger to inject the mprotect call, it can allow itself
10:13:11 <wob_jonas> I'm not sure it even has to be a debugger -- at least as long as you checked a previous recvmsg system call to make sure the process received the file descriptor for the specific compiled code that you allowed, then filter all the system calls like close and fcntl to make sure nothing overwrites that file descriptor, then allow the one mmap call
10:14:18 <ais523> that's interesting but seems a bit fragile
10:14:35 <ais523> you would probably need to use a fixed fd number for it
10:15:11 <ais523> which, logically, should be 3 – but then you need a workaround for if the calling process tried to pass information using an open FD 3
10:15:53 <wob_jonas> no, you read the process's memory after the recvmsg call to see what file descriptor number it received -- I guess that counts as a debugger, unless your system call bps filter can do that for you
10:17:50 <wob_jonas> admittedly it's a bit ugly, because you need to dereference two levels of pointers from what the process passed to the recvmsg call
10:18:11 <wob_jonas> and you might even need to verify that the process doesn't do overlapping pointer shenanigans
10:18:51 <ais523> if you're reacting to what the process does dynamically you need/are a debugger
10:19:31 <ais523> anyway, I realised that this can be useful even if you haven't verified the existing code, as long as you're on a processor that requires branch targets to be marked
10:19:43 <ais523> because you can just scan for branch target sequences that are in the wrong place
10:20:48 <wob_jonas> you can probably at least skip verifying the dup2/fcntl/close calls if you require that the mmap is the immediately following syscall after recvmsg, and retry both calls a few times if it isn't
10:20:56 <ais523> (although I think this means you can't use a traditional linker, in case it created a branch target sequence using a relocation)
10:21:38 <ais523> ooh, dup2 lets you pick the new file descriptor number even if it wasn't previously open
10:21:54 <ais523> so you could use an fd of 65534 or whatever
10:22:38 <wob_jonas> yes, but there's a setrlimit for that
10:23:02 <wob_jonas> and I think a system-global limit too
10:24:10 <ais523> I thought it was on the number of FDs that were open, not on the FD number itself
10:25:07 <wob_jonas> https://man7.org/linux/man-pages/man2/setrlimit.2.html "a value one greater than the maximum file descriptor number that can be opened by this process."
10:26:05 <ais523> I agree, I just tested, I can't use an FD number greater than the open file limit
10:26:53 <ais523> now I'm wondering if the FDs are stored in a contiguous array
10:28:42 <wob_jonas> they probably are. outside of dup2/dup3/fcntl, every new file descriptor number is guaranteed to be the first unused one for the process, and this requires synchronization between multiple processors running threads of the process. this came up because the synchronization is ugly in high-performance network servers, but Linux didn't dare to just
10:28:42 <wob_jonas> break the guarantee that's been there for as long as there was a unix
10:29:19 <fizzie> It's also a POSIX guarantee.
10:30:01 <wob_jonas> I think this was part of the motivation to create all those new system calls that take an extra argument for an O_CLOFD flag, so that if it's ever needed they could add an O_* flag to indicate that you don't insist on the least unused file descriptor number
10:30:26 <fizzie> https://pubs.opengroup.org/onlinepubs/9799919799/functions/V2_chap02.html#tag_16_06 "All functions that open one or more file descriptors shall, unless specified otherwise, atomically allocate the lowest numbered available (that is, not already open in the calling process) file descriptor at the time of each allocation."
10:30:43 <ais523> fizzie: we're talking specifically about dup2, which lets you choose the new file descriptor number
10:31:14 <wob_jonas> ais523: no, we're talking about why the file descriptors are stored in a contiguous array
10:31:26 <ais523> but wouldn't dup2 be a reason not to?
10:31:59 <wob_jonas> no, if the process abuses dup2 it's their problem that they're allocating too much kernel memory, and if you don't want that then you rlimit it
10:32:37 <wob_jonas> there are other ways that a process can allocate lots of kernel memory, and most of them, including this one, has knobs in /proc or sysctl or something to limit it
10:34:30 <wob_jonas> select/pselect, they take a dense array indexed by file descriptor numbers. you can use alternate APIs these days, but select/pselect are still useful, so that's another reason why a process won't use unnecessarily large file descriptors
10:35:35 <fizzie> Interestingly, my shell has open file descriptors 0, 1, 2 and 255 (all pointing at the same pty), where the latter is -- well, okay, it's not a *big* number, but still.
10:36:07 <HackEso> /hackenv/bin/`: line 5: cd: /proc/fd: No such file or directory
10:36:17 <wob_jonas> `` set -e; cd /proc/self/fd; ls -dF
10:36:27 <wob_jonas> `` set -e; cd /proc/self/fd; ls -F
10:36:31 <ais523> fizzie: mine too, but it seems to be specifically the shell, other processes don't do that
10:36:53 <wob_jonas> `` bash -ic 'set -e; cd /proc/self/fd; ls -F'
10:36:55 <HackEso> bash: cannot set terminal process group (-1): Inappropriate ioctl for device \ bash: no job control in this shell \ 0@ \ 1@ \ 2@ \ 255@
10:37:25 <wob_jonas> `` bash -ic 'set -e; cd /proc/self/fd; printf "(%s)" *'
10:37:27 <HackEso> bash: cannot set terminal process group (-1): Inappropriate ioctl for device \ bash: no job control in this shell \ (0)(1)(2)(255)(3)
10:37:42 <ais523> ooh, even more interesting: I tried with dash, and it had fds 0, 1, 2, 10 open
10:37:45 <fizzie> (Got curious about the process with the largest-numbered file descriptor, which on this system is (unsuprisingly) Chrome, with 719 open files, with the highest number of 829.)
10:37:57 <ais523> 0, 1, 2 were all /dev/pts files, 10 was /dev/tty (which I think is an alias for the same /dev/pts)
10:38:39 <ais523> zsh has 10 as the same /dev/pts as 0, 1, 2, also 12 and 13 holding completion databases open
10:39:59 <ais523> so I guess there's some need for shells to hold a reference to their terminal in a weirdly-numbered fd, it's hard to imagine them all doing that otherwise
10:40:18 <wob_jonas> ais523: only login shells, which use the terminal for job control
10:40:21 <ais523> busybox sh is also holding /dev/tty open on fd 10
10:40:22 <wob_jonas> `` bash -c 'set -e; cd /proc/self/fd; printf "(%s)" *'
10:40:29 <wob_jonas> `` bash -ic 'set -e; cd /proc/self/fd; printf "(%s)" *'
10:40:31 <HackEso> bash: cannot set terminal process group (-1): Inappropriate ioctl for device \ bash: no job control in this shell \ (0)(1)(2)(255)(3)
10:40:37 <wob_jonas> sorry, not login shells, *interactive* shells
10:40:51 <ais523> yes, interactive seems like the right condition
10:41:10 <wob_jonas> they need to be able to use the controlling terminal for job control even if their input/output is redirected, since redirecting is allowed
10:41:11 <fizzie> https://sources.debian.org/src/bash/4.3-11%2Bdeb8u1/jobs.c/#L3813 "move_to_high_fd" (in an `else` branch of `if (interactive == 0 && force == 0)`).
10:50:00 <wob_jonas> `` script -c 'set -e; cd /proc/self/fd; printf "(%s)" *' # wait, you can't even open a pty in HackEso because devpts isn't mounted?
10:50:04 <HackEso> script: openpty failed: No such file or directory
10:50:43 <wob_jonas> ouch, I thought it was possible to open one
10:53:02 <ais523> I think it's theoretically possible to open one without devpts, but it probably involves manually setting device numbers and HackEso probably doesn't like that either
10:53:29 <HackEso> ls: cannot access '/dev/pty*': No such file or directory
10:54:33 <HackEso> lrwxrwxrwx 1 0 0 8 Jul 1 2024 /dev/ptmx -> pts/ptmx
10:54:42 <fizzie> Mm. `umlbox` mounts /dev as read-only hostfs mount from outside the UML, which is a pretty dubious choice, but I guess it is expedient in the sense that there's no need to create the expected /dev nodes.
10:54:44 <fizzie> `` cat /proc/mounts | grep /dev
10:54:46 <HackEso> none /dev hostfs ro,nosuid,relatime,/dev/ 0 0
10:54:48 <ais523> ah, OK, I was wondering how that one was going to work
10:55:46 <ais523> now I'm wondering if anything abusive can be done with read-only access to all a system's devices
10:56:09 <ais523> isn't there one that contains a screenshot of boot messages?
10:56:24 <wob_jonas> ais523: I don't think you really access them, because when you open them, UML will just look at their stat and opens the right device *inside* the guest, not in the host
10:57:29 <HackEso> HackEgo, also known as HackBot, is a bot that runs arbitrary commands on Unix. See `help for info on using it. You should totally try to hax0r it! Make sure you imagine it's running as root with no sandboxing. HackEgo is the slowest bot in all Mexico!
10:57:32 <fizzie> `` ls /dev # it's a pretty minimal /dev because the host is a systemd-nspawn namespaced container of a minimal Debian system
10:57:34 <HackEso> char \ console \ core \ fd \ full \ initctl \ log \ mqueue \ net \ null \ ptmx \ pts \ random \ shm \ stderr \ stdin \ stdout \ tty \ urandom \ zero
10:59:24 <wob_jonas> yeah, but some of those few devices are used by a lot of user-mode processes, so a minimal /dev is still worth, even if it's not the host's /dev but a specially created directory
11:00:16 <ais523> `` head -c 40 /dev/urandom | base64
11:00:19 <HackEso> BcGOW7+Mns5Sj/LhmKlzTsbP77vHUCqV/APwXOg21MJprUwFucbdTQ==
11:00:43 <ais523> `` cat test > /dev/tty
11:00:45 <HackEso> /hackenv/bin/`: line 5: /dev/tty: No such device or address
11:01:02 <ais523> I don't think I've seen that errno code before
11:01:40 <wob_jonas> I think /dev/tty is your controlling terminal, which you don't have, and you won't have without being able to create pseudo-terminals
11:02:42 <ais523> wob_jonas: yes – I knew it "shouldn't" have one but was wondering if the framework would point it to its normal stdout/stderr stream somehow
11:03:18 <fizzie> Funny note about (u)random, by the way: there's a bit in the umlbox init where the Python script that invokes it can optionally give it a few bytes of randomness to preload the entropy pool with.
11:03:23 <fizzie> https://github.com/fis/umlbox/blob/master/umlbox#L66-L68 -> https://github.com/fis/umlbox/blob/master/umlbox#L206-L207 -> https://github.com/fis/umlbox/blob/master/init.c#L131-L132 -> https://github.com/fis/umlbox/blob/master/init.c#L151-L163
11:03:31 <wob_jonas> `` readlink /dev/console # though I think the top-level process has access to a terminal, but then a startup script spawns your command with its standard handles redirected
11:03:32 <ais523> looks like this errno code is ENXIO
11:04:07 <ais523> and the specific cause listed in the open(2) documentation was "The file is a device special file and no corresponding device exists."
11:04:29 <ais523> `` cat test > /dev/ttyS4
11:04:30 <HackEso> /hackenv/bin/`: line 5: /dev/ttyS4: Read-only file system
11:04:39 <HackEso> cat: /dev/ttyS4: No such file or directory
11:04:56 <ais523> oh, I see, there aren't 4 serial terminals so it was trying to create a new file in /dev
11:05:04 <HackEso> cat: /dev/ttyS0: No such file or directory
11:05:28 <ais523> aren't any serial terminals, boring (I thought the device for one might be defined even though the terminal itself probably doesn't exist)
11:06:32 <wob_jonas> ais523: I think you only proved that our /dev/ doesn't have any entry for them, not that there aren't serial terminals
11:06:38 <ais523> hmm, I just realised that that /dev doesn't have any disks
11:07:22 <HackEso> tty0 -W- (EC p a) 4:0 \ mc-1 -W- (E )
11:07:28 <wob_jonas> when I rand the emulated DOS machine connected to IRC, the emulated machine actually communicated through serial port to and from IRC
11:07:33 <fizzie> I'm not exactly sure what "mc-1" is.
11:10:10 <ais523> VPSes often allow access via the serial console to recover them if ssh or the like breaks
11:10:28 <ais523> I assume it's an emulated serial console rather than an actual serial port, but am not sure what level of the stack it gets emulated at
11:16:31 <fizzie> UML does provide emulated "consoles" and "serial lines"; on the outside, you can connect them to terminals, TCP ports (that speak telnet) or just existing open file descriptors. umlbox uses up to three: one for the command, one as the system console (for kernel messages) for troubleshooting, and one for the "mudem" (a program to multiplex TCP and Unix domain socket connections over a single
11:16:48 <fizzie> I don't think the current installation uses mudem though.
11:23:54 <wob_jonas> wait, unix domain sockets? I've heard of tunneling out IP network through an emulated ethernet stream, I think the linux host has built-in support for that. but I assumed the unix sockets would just be restricted to within the UML instance
11:27:29 <ais523> I hope they at least can't send FDs
11:28:16 <ais523> (I think CLC-INTERCAL has an option to steal FDs from other processes over a network – sending FDs across the UML boundary would be similar)
11:30:49 <wob_jonas> is that from other CLC-INTERCAL processes?
11:31:09 <wob_jonas> wait, since when does INTERCAL even know the concept of file descriptors?
11:31:29 <ais523> wob_jonas: other CLC-INTERCAL processes, yes
11:33:37 -!- Lord_of_Life has quit (Ping timeout: 264 seconds).
11:35:16 -!- Lord_of_Life has joined.
11:37:07 <ais523> I looked it up: CLC-INTERCAL has a system call interface, you can store filehandles (not quite FDs) in variables
11:37:12 <ais523> and if you steal the variable you steal the filehandle along with it
11:39:07 -!- wob_jonas has quit (Ping timeout: 250 seconds).
11:45:58 -!- tromp has quit (Quit: My iMac has gone to sleep. ZZZzzz…).
11:49:30 -!- roper has quit (Read error: Connection reset by peer).
11:53:29 <fizzie> I'm pretty sure umlbox-mudem can't forward file descriptors, it just reads and writes normal data. But you can use it to connect a Unix domain socket on one side into a TCP socket on the other, if you want.
11:53:44 <fizzie> There's an `--x11` flag in the wrapper script which will configure the guest mudem instance to listen on TCP port :6000 and for every connection attempt, tell the host mudem instance to connect to /tmp/.X11-unix/X0 (hardcoded path), with the intention that you can use X11 applications inside the UML wrapper.
11:55:14 -!- roper has joined.
11:58:41 <fizzie> (I guess that would probably even magically work without having to worry about xauth complications, since from the X server's perspective the UML process is just like any other X client? TBH, I've never really followed the X11 authorization thing.)
12:00:19 <esolangs> [[Joke language list]] https://esolangs.org/w/index.php?diff=165357&oldid=165156 * None1 * (+58)
12:00:44 <esolangs> [[User:None1]] https://esolangs.org/w/index.php?diff=165358&oldid=164727 * None1 * (+58) /* My Esolangs */
12:11:34 -!- APic has quit (Ping timeout: 260 seconds).
12:17:33 -!- APic has joined.
13:07:53 -!- tromp has joined.
13:36:13 -!- Sgeo has joined.
13:59:08 -!- roper has quit (Read error: Connection reset by peer).
14:05:07 -!- roper has joined.
14:33:25 -!- tromp has quit (Quit: My iMac has gone to sleep. ZZZzzz…).
14:57:55 <esolangs> [[ bits, 0 Bytes]] M https://esolangs.org/w/index.php?diff=165359&oldid=148247 * TheBigH * (-25) Made character table readable without having the font Consolas installed.
15:06:57 -!- tromp has joined.
15:09:58 <esolangs> [[ bits, 0 Bytes]] https://esolangs.org/w/index.php?diff=165360&oldid=165359 * Aadenboy * (+60) undoing to add a proper font stack
15:21:59 <esolangs> [[-2147483648 bytes .-.]] N https://esolangs.org/w/index.php?oldid=165361 * TheBigH * (+4385) Page creation
15:23:31 <esolangs> [[Joke language list]] M https://esolangs.org/w/index.php?diff=165362&oldid=165357 * TheBigH * (+69) Added -2147483648 bytes .-.
15:30:14 <esolangs> [[User:TheBigH]] M https://esolangs.org/w/index.php?diff=165363&oldid=165172 * TheBigH * (+67) Added -2147483648 bytes .-.
15:45:08 <esolangs> [[5D Brainfuck With Multiverse Time Travel]] https://esolangs.org/w/index.php?diff=165364&oldid=165346 * Quuxplusone * (+163) /* hello world */
15:45:26 -!- ais523 has quit (Quit: sorry about my connection).
15:51:55 -!- ais523 has joined.
16:09:13 -!- roper has quit (Read error: Connection reset by peer).
16:15:01 -!- roper has joined.
16:47:35 -!- simcop2387 has quit (Ping timeout: 250 seconds).
16:48:04 -!- perlbot has quit (Ping timeout: 260 seconds).
17:18:29 -!- perlbot has joined.
17:22:03 -!- simcop2387 has joined.
17:25:37 -!- tromp has quit (Quit: My iMac has gone to sleep. ZZZzzz…).
17:45:44 <b_jonas> I have a terminology question. So in the Enchain standard library, I want to provide an array of integers type. This means I expose to Enchain code a type and four functions that look basically like this:
17:45:51 <b_jonas> #include <stdlib.h> \ typedef uint32_t *array; array aalloc(uint32_t len) { return (array)calloc(len, sizeof uint32_t); } void afree(array arr) { free(arr); } uint32_t aget(array arr, uint32_t ind) { return arr[ind]; } void aset(array arr, uint32_t ind, uint32_t val) { array[ind] = val; }
17:46:01 <b_jonas> The plan is that Enchain should be typesafe and doesn't allow using uninitialized values. If this is sound and the compiler is implemented correctly, then in a pure Enchain code you can only call afree, aget, aset with a value that was returned by aalloc earlier in the program.
17:46:12 <b_jonas> But there's still a safety problem: you could try to use an array that has been freed, or index past the end of an array. To avoid this, the library lets you use a compile-time setting (probably just a C define) to enable one of two alternate implementations for arrays.
17:46:25 <b_jonas> One alternate implementation is completely memory safe, which means that the afree, aget, aset functions always verify that the array was allocated by aalloc and hasn't been freed yet and the index isn't too large, and if those conditions fail then the program aborts safely. This is useful for eg. developing an Enchain program.
17:46:31 <b_jonas> The other alternate implementation can't always fully verify the conditions, but if you misuse the functions then it can only corrupt the array memory.
17:46:36 <b_jonas> That means that the incorrect call or any future call to alloc, afree, aget, aset may abort the program safely, or an incorrect aget call or any future aget call may return any integer, but apart from those effects on these four functions, the program executes correctly. This can be useful for eg. running untrusted Enchain code, like a browser client-side script.
17:46:45 <b_jonas> My question is, what do you call these two types of memory safety, in particular what do I call the macro that enables them?
17:48:42 -!- tromp has joined.
17:52:50 <zzo38> I don't know, although for type and memory safety something I used in another program is storing the type together with the value, and for object references to have a generation number to detect errors. However, this is not necessarily suitable for what you are making.
17:59:45 <ais523> <b_jonas> The other alternate implementation can't always fully verify the conditions, but if you misuse the functions then it can only corrupt the array memory. ← the implementation you've given doesn't have that property, if the index is far enough out of bounds it could hit another valid allocation
18:00:05 <ais523> as for the naming thing, I have these concepts existing in my head but don't think I've named them yet
18:02:38 <ais523> I guess my thoughts for the second version are along the lines of "contained undefined behavior"
18:02:46 <ais523> but I don't think that's a standard name for it
18:03:05 <ais523> in Rust documentation I normally write it as "may return an arbitrary value or panic"
18:04:58 -!- ais523 has quit (Quit: quit).
18:06:39 <b_jonas> ais523: I didn't give that implementation. there are three implementations, and I only gave code for one, the least safe one.
18:19:21 -!- roper has quit (Read error: Connection reset by peer).
18:24:54 -!- roper has joined.
18:26:13 -!- Sgeo_ has joined.
18:29:25 -!- Sgeo has quit (Ping timeout: 264 seconds).
19:17:48 -!- roper has quit (Quit: zzz).
19:31:33 <b_jonas> here's an untested implementation (probably has lots of bugs) of the arrays in the three different memory safety modes => https://dpaste.org/eusge
19:32:36 <b_jonas> the actual implementation for enchain will use different names, and it'll probably be included three times, once for array of 32-bit integer, once for array of 16-bit integer, and once for array of 8-bit integer, each a separate type. and of course I'll have to fix all the bugs.
19:43:47 <b_jonas> and there might be other functions, eg. copy_n a range from an array to another array (may be the same array), lexicographically lexicographically_compare_three_way two ranges, and, for arrays of 8-bit integers, fwrite or fread a range
20:14:02 -!- amby has joined.
20:41:15 -!- lynndotpy60 has quit (Quit: bye bye).
20:42:39 -!- lynndotpy60 has joined.
20:43:50 -!- lynndotpy60 has quit (Client Quit).
20:44:48 -!- lynndotpy60 has joined.
20:48:03 <esolangs> [[Arbitrary memory emulation]] https://esolangs.org/w/index.php?diff=165365&oldid=157608 * Aadenboy * (+214)
20:49:29 <esolangs> [[Arbitrary memory emulation]] M https://esolangs.org/w/index.php?diff=165366&oldid=165365 * Aadenboy * (+0)
20:55:22 <esolangs> [[Arbitrary memory emulation]] https://esolangs.org/w/index.php?diff=165367&oldid=165366 * Aadenboy * (+128)
21:01:12 <esolangs> [[Special:Log/newusers]] create * Sprock * New user account
21:11:27 -!- tromp has quit (Quit: My iMac has gone to sleep. ZZZzzz…).
21:13:00 -!- tromp has joined.
21:57:48 -!- tromp has quit (Quit: My iMac has gone to sleep. ZZZzzz…).
22:18:20 -!- Lord_of_Life has quit (Quit: Laa shay'a waqi'un moutlaq bale kouloun moumkine).
22:19:13 -!- Lord_of_Life has joined.
23:07:56 <esolangs> [[Malfunge]] https://esolangs.org/w/index.php?diff=165368&oldid=87626 * Kaveh Yousefi * (+737) Added a hyperlink to my implementation of the Malfunge programming language on GitHub, marked the extant implementation's provenance as absent, and improved the code fragments' formatting.
23:10:35 <esolangs> [[Malfunge]] https://esolangs.org/w/index.php?diff=165369&oldid=165368 * Kaveh Yousefi * (+124) Introduced an infinitely repeating cat program as a third example and changed the example programs' headings to subsections.
23:58:47 -!- Lord_of_Life has quit (Quit: Laa shay'a waqi'un moutlaq bale kouloun moumkine).
23:59:09 -!- Lord_of_Life has joined.