1. 16 Jan, 2016 4 commits
    • Charlie Jacobsen's avatar
      Updates ci jenkins config to build user test apps. · d97e0ffd
      Charlie Jacobsen authored
      Tests are not built by default now.
      d97e0ffd
    • Charlie Jacobsen's avatar
      Updates cptr cache defs and build so that cspace config can truly vary. · 40077300
      Charlie Jacobsen authored
      Before, I just had some CPP checks that would stop the build
      if the cspace depth wasn't 4, etc. So it required some manual
      changes. Now it should be fully automated.
      
      There are three awk scripts that generate some C code / do some
      calculations, and the results are plugged into some headers (that
      are now templates and generated by configure). I did it this way
      because the CPP doesn't seem powerful enough to generate variable
      length definitions like this (without some serious CPP hacking).
      Easier to use awk and then AC_SUBST the results in.
      
      If we want to make the code even faster, we could precompute some
      other stuff like this as well.
      
      I tested the user build, and ran multi_thrd_cap with a cspace
      depth of 8, and cnode table size of 8. Looked ok.
      40077300
    • Charlie Jacobsen's avatar
      Adds symbol exports for kernel land. · 8e2fb16b
      Charlie Jacobsen authored
      When we install libcap as a kernel module, in order for other
      kernel code (modules) to link with it, we need to mark public
      functions with EXPORT_SYMBOL.
      8e2fb16b
    • Charlie Jacobsen's avatar
      Adds contributors file, updates install notes, tweaks kernel install. · 6f8ce609
      Charlie Jacobsen authored
      Adds KERNEL_HEADERS_INSTALL param so you can install the headers
      in a place of your choosing. (Otherwise, they're strewn across the
      source and build dirs - nice to coalesce into one spot.)
      6f8ce609
  2. 15 Jan, 2016 10 commits
  3. 14 Jan, 2016 7 commits
  4. 13 Jan, 2016 1 commit
  5. 11 Jan, 2016 4 commits
    • Charlie Jacobsen's avatar
      Fixes config include in types header. · bf9ae686
      Charlie Jacobsen authored
      bf9ae686
    • Charlie Jacobsen's avatar
      cnode-metadata: Adds metadata field to capability/cnode/slot. · 468c4b15
      Charlie Jacobsen authored
      Motivation: The libcap user may want to associate some contextual
      information for each capability (rather than with the object). For
      example, the LCD microkernel uses metadata to track whether a page
      referred to by a page capability has been mapped and where.
      
      This metadata field *is not* carried over to child capabilities
      during grant, and is NULL'd out when a capability is deleted from
      a cspace (so when the slot is used again, the field starts out as
      NULL).
      
      Internals note: The cnode will start out with NULL metadata as well
      when it is first used because we do a zalloc to create cnode tables.
      468c4b15
    • Charlie Jacobsen's avatar
      static-cptr-cache: Adds lock to cptr cache, fixes race conditions in tests. · 8c39cffc
      Charlie Jacobsen authored
      All looks OK now.
      
      Few other misc things:
      
         - config.h header goes with install
         - Some debug code in cap.c.
         - Wasn't handling return value of make cnode table in cap.c.
      
      For now, until we (possibly) move stuff around, I'm including the
      internal header in the public header so that I have access to
      the cap mutex type. I'm considering re-working things so that this
      won't be necessary in the future. Temporary hack for now.
      8c39cffc
    • Charlie Jacobsen's avatar
      static-cptr-cache: Updates cptr and cspace code for new cache, and tests. · fc4c8ed8
      Charlie Jacobsen authored
      I'm seeing what appears to be race conditions in the tests, so
      we're not out of the woods yet. I think I just need to introduce
      a lock for the cptr cache. It wasn't originally designed to be
      thread safe since only one thread at a time was using it. But we
      need it now.
      
      There are a few other miscellaneous changes:
      
        - Moves cptr manipulation into public header. Doc cleanup.
        - cptr_init returns an integer now (non-zero signals failure).
        - Adds CAP_BUG macro. Library code invokes this to abort or signal
          a serious internal library error (e.g., unexpected switch case).
      
                    kernel:   CAP_BUG ==> BUG
                    user:     CAP_BUG ==> abort
      
        - Aside from the cptr cache code updates for the modified struct,
          separates cptr cache initialization into two parts: alloc and init.
          Motivation: Some users of libcap will have already allocated the
          cptr cache (e.g., declared it as a static global), and only need
          it initialized. So, to fully initialize a cptr cache, you now need
          to do, e.g.,
      
                      int ret;
                      cptr_cache *cache;
      
                      ret = cptr_cache_alloc(&cache);
                      if (ret)
                            ... handle error ...
      
                      ret = cptr_cache_init(cache);
                      if (ret) {
                            cptr_cache_free(cache);
                            ... handle error ...
                      }
      
        - Updates test apps to use new cptr cache API (alloc then init). Adds
          some extra error handling/clean up code.
      fc4c8ed8
  6. 10 Jan, 2016 1 commit
    • Charlie Jacobsen's avatar
      static-cptr-cache: Changes cptr cache defs to use statically alloc'd bmaps. · 48ee0d11
      Charlie Jacobsen authored
      That is, the bitmaps are now arrays inside the cptr cache, rather
      than pointers. We need this for LCDs because the cptr cache needs
      to be up and running before we even initialize the page allocator
      and malloc.
      
      I need to tweak the code slightly next.
      
      Note: I considered using a packed struct for cptr's, with char
      fields. But I realized the allocation algorithm would become a little
      less efficient, due to extra required calculations. The advantage of
      the current algorithm is that, because the cnode table size is
      a power of 2 *and* the bits are packed (they would no longer be
      packed if we used chars, unless the cnode table size was 512), translating
      a bitmap index to a path in the cspace radix tree is really simple.
      If we switched to a struct with char's, such as:
      
          struct cptr {
             char level;
             char path[CAP_CSPACE_DEPTH];
             char slot;
          };
      
      we would need to do a handful of bit shifts and masks to set up
      these fields properly. (For the current algorithm, there's just
      one bitwise OR to set the level bits.)
      
      I also realized the bit-level ops we currently use are not that
      bad/obscure. We just sacrifice a slight amount of clarity.
      48ee0d11
  7. 09 Jan, 2016 2 commits
    • Charlie Jacobsen's avatar
      Adds free to kernel version. · 96adabf2
      Charlie Jacobsen authored
      free => kfree.
      96adabf2
    • Charlie Jacobsen's avatar
      Fixes two minor memory leaks. · 8c5a1b80
      Charlie Jacobsen authored
      1 - Need to free name strings in cap types when we
          do cap_fini.
      
      I decided to ran valgrind to check for any others.
      
      2 - Need to free fake slab cache for user version.
      
      There are a handful of innocuous leaks in the
      multi_thrd_cap test app. There are also some innocuous
      leaks reported due to glib's use of memory pooling (it appears).
      8c5a1b80
  8. 18 Dec, 2015 1 commit
  9. 23 Nov, 2015 1 commit
  10. 20 Nov, 2015 1 commit
  11. 17 Nov, 2015 8 commits