Commit Graph

11 Commits

Author SHA1 Message Date
Catherine
7528b13170
Extend wasi-emulated-mman with mprotect. (#500)
This implementation never changes actual memory protection, but it does
verify that the address range and flags are valid. The direct motivation
is fixing a linker error where LLVM links to `mprotect` in dead code.
2024-05-22 10:09:22 -07:00
whitequark
3e9892fc41
Make mmap() possible to use in a conformant way. (#197) 2020-05-26 12:49:13 -07:00
whitequark
9b9d243bea
Make munmap() actually work. (#198)
Before this commit, he header of a mapped area, `struct map`, was
defined as follows:

    struct map {
        int prot;
        int flags;
        off_t offset;
        size_t length;
        char body[];
    };

Because the size and alignment of an `off_t` is 8 bytes, the entire
structure was padded to 24 bytes. However, the offset of `body` into
`struct map` was only 20 bytes. Therefore the code in mmap() and
munmap() did not agree on the offset from header to body.

This commit changes mmap() to skip the entire header, which is what
munmap() expects and what the size calculation uses.
2020-05-26 12:14:52 -07:00
Dan Gohman
0cc57ac7b4
Multi-license wasi-libc under Apache and MIT licenses. (#174)
Multi-license wasi-libc under the Apache-2.0 WITH LLVM-exception,
Apache-2.0, and MIT licenses.
2020-02-29 10:52:28 +01:00
Dan Gohman
ca9046d872
Use consistent style for wasi-libc C source files. (#131)
For now, this means using `//`-style comments in .c source files (though
not public header files), and spaces rather than tabs. No strong opinion
here; this is just what the majority of the current code is using.

This also synchronizes basics/crt/crt1.c with libc-bottom-half's
version, though this is just a cleanup as the former isn't currently used
by the main wasi-libc build.
2019-11-08 11:59:57 -08:00
vms
d987aad467 use ENOMEM instead of EINVAL, set EINVAL if length == 0 2019-05-06 09:46:36 -07:00
vms
30e5a1fd1f move to __builtin_add_overflow 2019-05-06 09:46:36 -07:00
vms
ccfe4bda30 code deduplication 2019-05-06 09:46:36 -07:00
vms
4a8d1c7cf5 fix comment to correspond existing coding style 2019-05-06 09:46:36 -07:00
vms
20c48b57c7 fix mmap overflow and some other stuff 2019-05-06 09:46:36 -07:00
Dan Gohman
320054e84f WASI libc prototype implementation.
This incoporates pieces from musl-libc, cloudlibc, cloudabi, libpreopen,
and dlmalloc, as well as a significant amount of new code.
2019-03-27 07:59:55 -07:00