During initialization, LibOS parses the LD_PRELOAD environment variable
and allocates memory to store its entries. On error, this allocated
memory must be freed. This commit correctly frees memory on error.
Fixes the following bugs:
* sched_getaffinity(2) should return # of bytes, not bits.
* It should honor `len` argument.
* Linux sched_getaffinity() aligns the result to sizeof(long).
Some Linux applications get the number of CPU cores by querying
/proc/cpuinfo. Before, such apps would be confused by a wrong
format of /proc/cpuinfo in Graphene. This commit updates format
to exactly the same as in Linux kernel.
This commit also adds a LibOS regression test for /proc/cpuinfo.
glibc: remove unnecessary pushq/popq so that shim_clone can run without segv.
This is a preparation for later patch to clean up shim_clone() to
remove glibc modification.
libos: Currently child thread ret ip is taken from new child stack.
But it can be retrieved from parent's thread context, so such a hack
isn't needed.
Now the modification to clone.S is not needed anymore. So remove it.
See #389.
Per the manpage, POLLERR and POLLUP are returned in `revents` and
ignored in `events`. Indeed, programs should not be setting, and
typically don't set -- `events` with these values.
The effect of this bug is, among others, that a process will never get a
disconnect event from a peer socket.
Before, pause() was emulated by sleeping for 1s in a loop until
signal interrupted it. If signal arrived in-between these invocations
then pause() could never return. Also, pause() incorrectly returned 0
instead of -1 and errno=EINTR.
This patch emulates pause() by sleeping for a very long time (years).
Also, it correctly returns EINTR.
On weaker machines (Intel NUCs and SGX-enabled laptops),
SGX regression tests take longer than 5 seconds because
Graphene measures/zeroes all enclave memory at startup.
Increase the timeout for SGX regression tests to 20 sec.
Currently cp to Runtime dir is used. Sometimes it is confusing when
binaries are re-built under Pal or LibOS. Symlink is better, so use
it instead.
- It's easy to understand where a file under Runtime dir comes from
- It's easy to understand in which directory to run `make`
- If cp is used, it's quite easy to test old binary under Runtime.
This patch create ln_sf rule and use it instead of cp and applies to
other recipe with cp.
In this context, creating symlink of glibc libraries is mess. This
patch also cleans it up to use Makefile instead of embedding the logic
into python script.
Signed-off-by: Isaku Yamahata <isaku.yamahata@gmail.com>
_dl_debug_state has hidden visibility, so there is no risk in using it
with Pal. We can remove the modification to glibc and rename
__libc_dl_debug_state back to _dl_debug_state.
When debug buf reached to the end, it should be reset to the start after
output.
This can happen with
debug_printf("%s",
"string-without-newline-longer-than-debug_buf-DEBUGBUF_SIZE=255"...);
Signed-off-by: Isaku Yamahata <isaku.yamahata@gmail.com>
The regression python scripts are not marked executable. Also they
expect that the Makefile has setup the environment correctly so just
marking them executable would not be useful. So drop the unused shebang
to avoid encoding the interpreter in multiple places.
Script/regression.py is a library so it also doesn't need a shebang.
This patch auto-generates asm offsets for Pal/Linux-SGX and uses them.
Also to share the generation logic among Pal and LibOS, header file for
it is created under Pal.
Signed-off-by: Isaku Yamahata <isaku.yamahata@gmail.com>
this patch cleans up shim_signal.c without logic change.
- remove unnecessary goto
In this file, goto is abused unnecessarily.
- remove unnecessary macro
Two macros, is_internal, internal_fault can be inline function.
Signed-off-by: Isaku Yamahata <isaku.yamahata@gmail.com>
This bug just occurs when reading a symlink on procfs.
If input is an absolute path, it will get wrong my_dent.
So we use stat syscall to check whether the "/proc/1/root"
and "/" is same path in graphene.
Signed-off-by: Zhang Chen <chen.zhang@intel.com>