- Oct 16, 2013
-
-
Avi Kivity authored
Needed by boost.asio. Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
Avi Kivity authored
Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
- Oct 14, 2013
-
-
Nadav Har'El authored
I forgot to commit the change to dlfcn.cc in the previous patch. Sorry... Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com>
-
Avi Kivity authored
Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
Nadav Har'El authored
Our default signal handler (for, e.g., ^C) used abort(), which results in a hung VM, and is not very useful. Change this to osv::poweroff(), which gives more useful behavior. Now one can, for example, run a test with run.py and interrupt it in the middle with ^C causing the VM to power off and run.py to complete. Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com>
-
- Oct 11, 2013
-
-
Dinakar Guniguntala authored
Noticed a minor bug in the OSv dlfcn implementation. According to the linux man pages, dladdr returns non-zero on success and zero on error -> http://linux.die.net/man/3/dladdr Signed-off-by:
Dinakar Guniguntala <dino@linux.vnet.ibm.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
- Oct 08, 2013
-
-
Nadav Har'El authored
We had a different Linux version compiled into uname() (3.7.0) than we had compiled into other code (via <linux/version.h>). This patch makes them both pretend to be 3.7.0 - arbitrarily chosen as the current Linux version at the time OSv was created. The new code verifies with a static assertion that both files contain the same version, so if they diverge, uname.c will fail compilation. Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com>
-
- Oct 07, 2013
-
-
Pekka Enberg authored
Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Benoît Canet authored
Signed-off-by:
Benoit Canet <benoit@irqsave.net> Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
Benoît Canet authored
Also convert it's header and change it's caller includes. This patch is done so the libc resolver will be able to retrieve the dns from OSv dns API. Signed-off-by:
Benoit Canet <benoit@irqsave.net> Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
- Oct 06, 2013
-
-
Benoît Canet authored
Debug build was broken by it since boost::asio was used. Signed-off-by:
Benoit Canet <benoit@irqsave.net> Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
- Oct 05, 2013
-
-
Benoît Canet authored
boost's asio.hpp module init() function was calling pthread_key_create which tried to manipulate some libc/pthread.cc unitialized objects. pthread_key_create then returned -ENOMEM so an exception was thrown by boost causing the loader's premain() function to fail and the boot to loop. This patch lower the priority of the initialization of the libc/pthread.cc objects so they are ready when premain is calling the boost module init() function. Signed-off-by:
Benoit Canet <benoit@irqsave.net> Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
- Oct 03, 2013
-
-
Nadav Har'El authored
Used somewhere within libcurses, so provide an implementation. Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com>
-
Nadav Har'El authored
This patch adds a few simple terminal-related libc functions that ncurses requires (needed to run curses-based applications on OSv). Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com>
-
Pekka Enberg authored
Exit tracepoints are useful to record errors, and also for timing the mmap operation. Signed-off-by Pekka Enberg <penberg@cloudius-systems.com>
-
- Sep 29, 2013
-
-
Nadav Har'El authored
This patch adds support for Linux's alarm(2) system call. alarm() is needed in some ancient Unix software, like netperf :( This implementation is fully compatible with Linux's alarm(), but please note that what alarm() does when the alarm times out is a kill(SIGALRM) - so all the caveats mentioned in the previous patch regarding kill(), will also apply here. Alarm() is implemented by running one "alarm thread", started on the first alarm() call. This alarm-thread waits for the alarm to expire, or for instructions to change the alarm. When an alarm expires the alarm thread does a kill(0,SIGALRM). tst-kill.cc (from the previous patch) includes a test to see that alarm() really sends a SIGALRM signal on time, and also that we can cancel a pending alarm and not receive a signal. Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com>
-
Nadav Har'El authored
This patch adds support for the Linux kill(2) function. The next patch will add alarm(2) support, which uses kill(2). To be honest, we sort-of implement kill(). This implementation is compatible with the API, but the semantics are somewhat different: While in Linux kill() causes the signal handler to run on one of the existing threads, in this implementation, the signal handler is run in a *new* thread. Implementing the exact Linux semantics in OSv would require tracking when OSv runs kernel code (i.e., code in the main executable, not a shared object) so we can delay running the signal handler until returning to the user code. Moreover, we'll need to be able to interrupt sleeping kernel code. This is complicated and adds overhead even if signals aren't used (and they aren't used in most modern code). I expect that this code will be "good enough" in many use cases. This code will *not* be good in enough in programs that expect one of the following: 1. A program that by using Posix Thread's "signal masks" tried to ensure that the signal is delivered to one specific thread, and not to an arbitrary thread. 2. A program that used kill() or alarm() not intending to run a signal handler, but rather intending to interrupt a sleeping system call like sleep() or read(). Our kill() does not interrupt sleeping OSv function calls, which will continue to sleep on the thread they run on. The support in this patch (and see next patch, for alarm()) is good enough for netperf's use of alarm(). P.S. kill() can be used only to send a signal to the current process, the only process we have in OSv (you can also use pid=0 and pid=-1 to achieve the same results). This patch also adds a test for kill() and alarm(). The alarm() test will fail until the next patch :-) Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com>
-
- Sep 25, 2013
-
-
Nadav Har'El authored
signal() verified that its argument is not >nsigs, but it should be >=nsigs because nsigs itself is already illegal (0...nsigs-1 are valid signals). Discovered by Coverity. Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com>
-
Nadav Har'El authored
Add to libc/user.cc stub setresgid(), setresgid(), which as usual in OSv only allow user and group 0. These functions are used by Rogue ;-) Also move getuid() and friends from runtime.cc to libc/user.cc, where they feel more at home. Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com>
-
- Sep 24, 2013
-
-
Nadav Har'El authored
We used to return the POLLRDHUP event when polling a write-side of a pipe whose reader is closed, but Linux returns POLLERR|POLLOUT, so let's do the same. Linux's behavior can be explained in that when the reader is closed, a write will return immediately (and hence POLLOUT) but moreover, will return with an error (EPIPE). And since a read will also cause an error (EBADF when reading on the write side of the pipe), a POLLERR makes sense and says that any operation on this fd will now result in an error. This patch also adds a test for this case. Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com>
-
Nadav Har'El authored
The code in pipe_buffer.cc had the meaning of POLLHUP and POLLRDHUP reversed, and as a result POLLHUP wasn't correctly returned when polling a read-end of the pipe whose write-end is closed. This fixes the mixup, and as a result the test added to tst-pipe.cc in the previous commit, and also another one added in this patch, all pass. We are still incompatible with Linux with what we do regarding POLLRDHUP. This will be a separate patch. Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com>
-
- Sep 15, 2013
-
-
Nadav Har'El authored
Add Cloudius copyright statements in libc/. One unfortunate problem we have in libc/ is that most of the code there was copied from Musl, and Musl is copyrighted and licensed, but individual files do not carry any statements - Rich Felker explains in Musl's COPYRIGHT file: "The decision to exclude such comments is intentional, as it should be possible to carry around the complete source code on tiny storage media." In the future, we should find all the Musl files and add to each one the line Copyright (C) 2005-2013 Rich Felker. But we'll need to do it carefully so as not to wrongly attribute non-Musl code to Musl. In the meantime, if we just have documentation/LICENSE-musl, and don't claim our own copyright on the musl files, I think we're playing fair.
-
- Sep 12, 2013
-
-
Guy Zana authored
the musl implementation immidiately issues a DNS query, instead of looking first at the /etc/hosts file, this patch fixes it. As a side effect, the long boot duration is shortened by 3-4 seconds.
-
- Sep 03, 2013
-
-
Pekka Enberg authored
If "-javaagent" option is enabled, the JVM page faults: (gdb) bt #0 0x000000000033d432 in halt_no_interrupts () at ../../arch/x64/processor.hh:232 #1 osv::halt () at ../../core/power.cc:20 #2 0x0000000000214d82 in abort (msg=msg@entry=0x57ea90 "page fault outside application") at ../../runtime.cc:98 #3 0x00000000002fd4d8 in page_fault (ef=0xffffc0003ffe6008) at ../../core/mmu.cc:943 #4 <signal handler called> #5 0x0000000000373169 in __stpncpy (d=d@entry=0x2000001fe7f0 "dlsym: symbol JVM_begin_signal_setting not found", s=0x0, n=1023) at ../../libc/string/stpncpy.c:19 #6 0x0000000000373ad1 in strncpy (d=0x2000001fe7f0 "dlsym: symbol JVM_begin_signal_setting not found", s=<optimized out>, n=<optimized out>) at ../../libc/string/strncpy.c:7 #7 0x0000100000b0ab67 in os::dll_load (filename=filename@entry=0x2000001febf0 "libinstrument.so", ebuf=ebuf@entry=0x2000001fe7f0 "dlsym: symbol JVM_begin_signal_setting not found", ebuflen=ebuflen@entry=1024) at /usr/src/debug/java-1.7.0-openjdk-1.7.0.25-2.3.12.3.fc19.x86_64/openjdk/hotspot/src/os/linux/vm/os_linux.cpp:1841 #8 0x0000100000c247eb in lookup_on_load (agent=agent@entry=0xffffc0003976ccc0, on_load_symbols=on_load_symbols@entry=0x2000001ffd40, num_symbol_entries=1) at /usr/src/debug/java-1.7.0-openjdk-1.7.0.25-2.3.12.3.fc19.x86_64/openjdk/hotspot/src/share/vm/runtime/thread.cpp:3585 #9 0x0000100000c2a64f in lookup_agent_on_load (agent=0xffffc0003976ccc0) at /usr/src/debug/java-1.7.0-openjdk-1.7.0.25-2.3.12.3.fc19.x86_64/openjdk/hotspot/src/share/vm/runtime/thread.cpp:3617 #10 create_vm_init_agents () at /usr/src/debug/java-1.7.0-openjdk-1.7.0.25-2.3.12.3.fc19.x86_64/openjdk/hotspot/src/share/vm/runtime/thread.cpp:3656 #11 Threads::create_vm (args=<optimized out>, canTryAgain=canTryAgain@entry=0x2000001ffdb0) at /usr/src/debug/java-1.7.0-openjdk-1.7.0.25-2.3.12.3.fc19.x86_64/openjdk/hotspot/src/share/vm/runtime/thread.cpp:3177 #12 0x000010000094d7b0 in JNI_CreateJavaVM (vm=0x2000001ffe58, penv=0x2000001ffe60, args=<optimized out>) at /usr/src/debug/java-1.7.0-openjdk-1.7.0.25-2.3.12.3.fc19.x86_64/openjdk/hotspot/src/share/vm/prims/jni.cpp:5127 #13 0x0000100000007b3b in main (argc=<optimized out>, argv=0xffffc0003fff2008) at ../../java/java.cc:73 #14 0x0000000000208ac8 in run_main (prog=<optimized out>, args=args@entry=0xffffc0003fe9bfa0) at ../../loader.cc:196 #15 0x0000000000208c68 in do_main_thread (_args=0xffffc0003fe9bfa0) at ../../loader.cc:217 #16 0x0000000000376d36 in operator() (__closure=0xffffc0003b5e2a00) at ../../libc/pthread.cc:59 #17 std::_Function_handler<void(), pthread_private::pthread::pthread(void* (*)(void*), void*, sigset_t, const pthread_private::thread_attr*)::__lambda0>::_M_invoke(const std::_Any_data &) (__functor=...) at ../../external/gcc.bin/usr/include/c++/4.8.1/functional:2071 #18 0x000000000032ed6b in main (this=0xffffc0003a807010) at ../../core/sched.cc:536 #19 sched::thread_main_c (t=0xffffc0003a807010) at ../../arch/x64/arch-switch.hh:133 #20 0x000000000031873e in thread_main () at ../../arch/x64/entry.S:101 Backtrace stopped: frame did not save the PC This is caused by the JVM expecting dlerror() to return an error string if dlopen() fails. Fix that up.
-
- Sep 02, 2013
-
-
Pekka Enberg authored
Use the new mmu::msync() function to make sure file-backed memory maps are written out to disk in munmap().
-
Pekka Enberg authored
This adds simple msync() implementation for file-backed memory maps. It uses the newly added 'file_vma' data structure to write out and fsync the msync'd region as suggested by Avi Kivity.
-
Pekka Enberg authored
Add a new 'file_vma' class that extends 'vma'. This is needed to keep track of fileref and offset for file-backed VMAs for msync().
-
- Sep 01, 2013
-
-
Pekka Enberg authored
Fixes the following build brekage caused by commit a7d6b269 ("mman: Use libc_error() in mprotect()"): ../../libc/mman.cc: In function ‘int mprotect(void*, size_t, int)’: ../../libc/mman.cc:36:33: error: ‘libc_error’ was not declared in this scope return libc_error(EINVAL); ^ ../../libc/mman.cc:41:33: error: ‘libc_error’ was not declared in this scope return libc_error(ENOMEM); ^ CXX libc/pipe_buffer.o CXX libc/pipe.o make[1]: *** [libc/mman.o] Error 1
-
Pekka Enberg authored
-
- Aug 29, 2013
-
-
Pekka Enberg authored
-
- Aug 26, 2013
-
-
Nadav Har'El authored
sched.hh included elf.hh, just so it can refer to the elf::tls_data type. But now that we have rcu.hh which includes sched.hh and therefore elf.hh, if we wish to use rcu in elf.hh (we'll do this in a later patch), we have an include loop mess. So better not include elf.hh from sched.hh, and just declare the one struct we need. After sched.hh no longer includes elf.hh and the dozen includes that it further included, we need to add missing includes to some of the code that included sched.hh and relied on its implict includes.
-
- Aug 21, 2013
-
-
Avi Kivity authored
The dependency on sse4.1 crashes on older cpus, use the generic musl implementation.
-
- Aug 14, 2013
-
-
Avi Kivity authored
libstdc++ switched to relying on this symbol for the gthread machinery, define it so it works. Fixes std::thread used in mpsc queue tests.
-
- Aug 12, 2013
-
-
Avi Kivity authored
Needed for statically linking the entirety of libgcc_eh.a.
-
- Aug 08, 2013
-
-
Nadav Har'El authored
This patch fixes the exception handling bug seen in tst-except.so. The callback given dl_iterate_phdr (such as _Unwind_IteratePhdrCallback in libgcc_eh.a used to implement exceptions) may decide to cache previous information we gave it, as long as the "adds" and "subs" fields are unchanged. The bug was that we passed to the callback a on-stack *copy* of the obj->_phdrs vector, and if the callback saved pointers to that in its cache, they became invalid on the next call. We need the pointers to remain valid as long as adds/subs do not change. So we need to pass the actual obj->_phdrs (which doesn't change after the object's load), NOT a copy. Note there's a locking issue remaining here - if someone dlclose()s an object while the callback is running (and already checked adds/subs) it can use a stale pointer. This should be fixed separately, probably by using reference counting on objects.
-
Nadav Har'El authored
The callback function passed to dl_iterate_phdr, such as _UnWind_IteratePhdrCallback (used in libgcc_eh.a to implement exceptions), may want to cache previous lookups, and wants to know when the list of iterated modules hasn't changed since the last call to dl_iterate_phdr. For this, dl_iterate_phdr() is supposed to fill two fields, dlpi_adds and dlpi_subs, counting the number of times objects were loaded or unloaded from the program. If both dlpi_subs and dlpi_adds are unchanged, the callback is guaranteed the list of objects is unchanged. In the existing code, we forgot to set these two fields, so they got random values which caused the exception unwinding code to sometimes cache, and sometime not cache, depending on the phase of the moon. This patch adds the counting of the correct "subs" and "adds" counters, and after it exception unwinding will always use its cache (as long as the list of objects doesn't change). Note that this does NOT fix the crash in tst-except.so. That is a bug which appears when caching is enabled (which before this patch happend randomly), and will be fixed by the next patch.
-
Pekka Enberg authored
dlerror is needed when an application is started on the JVM with the "-javaagent" option defined.
-
- Jul 28, 2013
-
-
Avi Kivity authored
-
- Jul 22, 2013
-
-
Avi Kivity authored
We want to use backtrace() (and therefore dl_allocate_phdr(), and therefore program::with_modules()) in interrupt disabled context; change with_modules() to avoid any allocations.
-
- Jul 18, 2013
-
-
Avi Kivity authored
-