Skip to content
Snippets Groups Projects
  1. May 22, 2013
    • Nadav Har'El's avatar
      Power off the guest after it finishes its work. · a333d85d
      Nadav Har'El authored
      Call the new poweroff() function after the payload finishes running.
      Makes sense on a cloud (why would you want to pay the provider after
      your workload is done?) as well as for our benchmarking, where we want
      qemu to exit after running the benchmark.
      
      When the "--leak" option is used, instead of calling poweroff(), we
      call hang(), so that QEMU continues to run and we can attach the
      debugger to run "osv leak show".
      
      Note that before this patch, if the payload spawned threads, they could
      continue running after the payload's main() return. This is no longer
      the case - after main() returns, the entire virtual machine is shut down
      (or just hung). This is reasonable behavior, though: If the payload needs
      some threads to continue running, it should join() them before returning.
      The behavior on Linux (and Posix threads in general) is identical to our
      new behavior: When main() of a multithreaded program returns, all threads
      are killed.
      a333d85d
  2. May 20, 2013
  3. May 06, 2013
  4. May 02, 2013
  5. Apr 25, 2013
    • Nadav Har'El's avatar
      Added "--leak" command line option · 600f960b
      Nadav Har'El authored
      Added to the loader a command-line option "--leak" to enable the leak
      detector immediately before running the payload's main(). For example, to
      look for leaks in tst-fpu.so (there are none, by the way ;-)), do
      
      	scripts/imgedit.py setargs build/release/loader.img --leak tests/tst-fpu.so
      
      and when it ends, look at the leak detection results:
      	$ gdb build/release/loader.elf
      	(gdb) connect
      	(gdb) osv leak show
      
      Unfortunately, this doesn't work when the payload is Java - I'm still trying
      to figure out why.
      600f960b
  6. Apr 24, 2013
    • Nadav Har'El's avatar
      Fix leak of PTHREAD_CREATE_DETACHED pthreads · ebce9887
      Nadav Har'El authored
      A pthread created with the attribute
      	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
      Does not need to be pthread_join()ed - and its resources, most importantly
      its stack, should be deleted as soon as it is done.
      
      Previously, we ignored this mode, causing its users (Java uses it for all
      its threads!) which do not ever pthread_join() on these threads, to leak
      the threads' stacks.
      
      This patch adds support for this mode, and adds a test to tst_leak.cc
      which verifies that before the patch, we had a leak, and now we don't.
      
      Unfortunately, this patch is a bit ugly, and I was surprised how much time
      it took me to actually get it to work :( Because of the convoluted
      relationships between pthread_*, pthread_private::pthread, sched::thread
      and sched::detached_thread, I ended up, after many rewrites (!) duplicating
      the "reaper" code from sched::detached_thread to do something very similar
      for detached pthreads. I.e., when a detached pthread finishes, it can't
      pthread_join() itself (which would cause a mess as it destroys its own
      stack) so instead it tells a different thread, the "reaper" thread, to
      run this pthread_join().
      
      In the future it would be nice to create one generic "reaper" which
      is used by both detached sched::threads and pthreads, or even find
      a way to allow a thread to pthread_join itself as its last action.
      ebce9887
    • Avi Kivity's avatar
      memory: debug allocator · 56b1f6b2
      Avi Kivity authored
      This allocator works by giving each allocation its own virtual address
      range which is not reused for later allocations.  After a free(), the
      range is made inaccessible, forever, so use-after-free will result in a
      page fault.
      
      Sub-page overruns are also detected by filling unallocated space with a
      pattern, and checking whether the pattern has been altered during free().
      56b1f6b2
    • Avi Kivity's avatar
      main: disable the PIC earlier · ecf5f794
      Avi Kivity authored
      Early code may enable interrupts and get hit by a spurious interrupt.
      ecf5f794
  7. Apr 17, 2013
    • Nadav Har'El's avatar
      Abort when loader can't load the given object · de49d7a7
      Nadav Har'El authored
      Without adding this check, if you change the command line with to run
      file.so which doesn't exist, it would start using random garbage in
      memory and fail in mysterious ways. Better just let the user know we can't
      open the specified program.
      de49d7a7
  8. Apr 15, 2013
  9. Apr 14, 2013
  10. Apr 11, 2013
  11. Apr 09, 2013
  12. Feb 28, 2013
    • Avi Kivity's avatar
      drivers: switch back to device enumeration, rather than driver enumeration · c86b2969
      Avi Kivity authored
      Driver enumeration requires instantiating a driver even for devices which
      are not present; and if a device is present multiple times, we need to
      pre-create multiple driver instances, which is awkward.  Further, driver
      life-cycle is complicated, with separation between instantiation and binding
      to a device.
      
      Switch (back) to the traditional device-driven model, where we iterate over
      all devices, try to find a matching driver factory, and when found, call it
      to instantiate the driver and bind to the device.
      c86b2969
    • Avi Kivity's avatar
      loader: drop bogus wait_for_interrupts() · 57006f89
      Avi Kivity authored
      The main thread has a bogus wait_for_interrupts() which consumed wakeups,
      so the scheduler on the cpu running it could not schedule stuff.  This
      manifested itself in lots of zombies from bsd callouts not getting reaped.
      
      Drop.
      57006f89
  13. Feb 26, 2013
  14. Feb 25, 2013
  15. Feb 19, 2013
  16. Feb 13, 2013
  17. Feb 11, 2013
  18. Feb 09, 2013
  19. Feb 07, 2013
  20. Feb 06, 2013
  21. Feb 03, 2013
Loading