guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mmap for guile


From: Maxime Devos
Subject: Re: mmap for guile
Date: Tue, 19 Jul 2022 15:30:22 +0200
User-agent: Evolution 3.42.1

Ludovic Courtès schreef op ma 04-07-2022 om 12:09 [+0200]:
> But we could provide special semantics: the bytevector would become
> zero-length (possible, but weird, as Maxime points out), or it would
> be turned into a /dev/zero mapping (weird as well).
> 
> Thoughts?

The former is weird and can currently cause out-of-bound reads/writes
(see the TOCTTOU issue I pointed out).  It also would also prevent
optimisations (for things like (bytevector-ref bv 9999) (bytevector-ref
bv 1), to eliminate some range checks).

The latter is weird too, but it's easy to reason about -- the compiler
can assume the bytevector length is fixed, so no TOCTTOU issue and
possibility of optimisations, user code also doesn't have to worry
about changing lengths, no bad interactions with the
bytevector->pointer + pointer->bytevector trick to reduce the range of
a bytevector ... (except potential GC issues, to which I haven't yet
received a response to test for them or resolve them or document
limitations).

As such, I would recommend the latter.  Though if we go for the former,
we might as well implement a bytevector-free! (why is there a munmap
but not a bytevector-free!).

Greetings,
Maxime.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]