Skip to content
Snippets Groups Projects
  1. Apr 04, 2013
    • Nadav Har'El's avatar
      abort() instead of errno when mprotect()ing malloc()ed memory · 7d49d9f8
      Nadav Har'El authored
      Though the application should test mprotect()'s success before assuming it
      succeeded, let's be extra sure and kill it. (By Avi's request)
      7d49d9f8
    • Nadav Har'El's avatar
      Don't allow mprotect() to modify the linear map · 4a6ec45e
      Nadav Har'El authored
      mprotect() is normally used on mmap()ed memory. It usually makes little
      sense to for applications to mprotect() memory they got from malloc()ed,
      for several reasons including the fact that free()ing this memory without
      mprotect()ing it back to normal back is a recipe for big trouble (while
      with munmap(), there is no need to mprotect() back). We therefore don't
      expect Java to use mprotect() on malloc()ed memory.
      
      For us, mprotect() on malloc() memory is particularly undesirable, because
      malloc() returns addresses in the linear map, and mprotect()ing that can
      "downgrade" this map (change huge pages into small pages) which will never
      be fixed later, not even when if mprotect()ing the memory back to normal.
      So for now, I'll just forbid mprotect() on addresses in the linear map.
      4a6ec45e
  2. Apr 03, 2013
    • Nadav Har'El's avatar
      Handle #DE (divide error) exception · 372c4a73
      Nadav Har'El authored
      In the existing code, #PF was handled correctly (generating a SIGSEGV),
      but on most other x86 hardware exceptions, we just abort()ed the kernel.
      
      The #DE (divide error) exception should, like #PF, generate a signal
      (the inappropriately-named SIGFPE), and this patch does this. Strangely,
      the SPECjvm2008 benchmark depends on this behavior (I didn't check its
      source code to figure out why).
      
      To make it easier to generate other signals in the future, I abstracted
      the existing function handle_segmentation_fault() into a more general
      generate_signal() which is used in both #PF and #DE handling.
      372c4a73
  3. Mar 25, 2013
    • Nadav Har'El's avatar
      TLB flush and other fixes to mmap/munmap/protect · 8eca17eb
      Nadav Har'El authored
      Added the missing TLB flush to the mmap()/munmap()/mprotect() operations.
      Note that currently I only do this on the processor running mmap(), which
      is incorrect (I put in a TODO), but is good enough for Java's use case
      (which is to do these things on startup).
      
      Also added more tests, and fixed a bug on mmap(PROT_NONE) (mprotect(PROT_NONE)
      used to work, but mmap(PROT_NONE) didn't).
      8eca17eb
  4. Mar 19, 2013
    • Nadav Har'El's avatar
      Implement mprotect(PROT_NONE) · d1e83a59
      Nadav Har'El authored
      Java uses mprotect(..., PROT_NONE) for guard pages (e.g., to catch stack
      overflow). This patch implements it by removing the present bit on these
      pages' mappings, which does not mean the pages have been unmapped (their
      memory is kept intact, and running mprotect again can make them readable
      again.
      d1e83a59
    • Nadav Har'El's avatar
      Fix memory leak in mmap (where for allocations smaller than a huge page, · ba90a695
      Nadav Har'El authored
      some of the small pages were allocated twice and one was leaked).
      Also, prepare mmap/munmap for supporting PROT_NONE in mprotect: instead
      of relying on present-bit to say which pages are free, rely on the
      information in vma_list, and double-check this (with assertions added)
      against zeroing of the PTE when a page is freed.
      I'll add support for mprotect(PROT_NONE) in a following patch.
      ba90a695
    • Avi Kivity's avatar
      4589db87
  5. Mar 18, 2013
  6. Mar 06, 2013
  7. Mar 04, 2013
  8. Mar 03, 2013
  9. Feb 28, 2013
  10. Feb 27, 2013
  11. Feb 24, 2013
    • Avi Kivity's avatar
      printf: reduce stack usage · 37ce1854
      Avi Kivity authored
      printfs uses ~80K stack; this easily overflows and causes corruption.
      
      We can't simply increase the stack size since this huge stack footprint
      means that stack guard pages won't work.
      
      Reduce the footprint for now, later switch to per-cpu allocation or some
      other scheme.
      37ce1854
  12. Feb 23, 2013
    • Avi Kivity's avatar
      sched: don't auto-start threads · f5c34d80
      Avi Kivity authored
      While easy to use, auto-starting threads generates problems when more
      complicated initialization takes place.
      
      Rather than making auto-start optional (as Guy suggested), remove it
      completely, to keep the API simple.
      
      Use thread::start() to start a thread.  Unstarted threads ignore wakeups
      until started.
      f5c34d80
  13. Feb 21, 2013
  14. Feb 19, 2013
  15. Feb 17, 2013
  16. Feb 14, 2013
  17. Feb 12, 2013
  18. Feb 11, 2013
  19. Feb 07, 2013
Loading