1. paintcan
  2. shmdb

Commits

Sebastian Hubbard  committed 694660d

testing has determined that the card marking code (in the amt library) is not safe

  • Participants
  • Parent commits e07f657
  • Branches default

Comments (0)

Files changed (2)

File test/fuzz.c

View file
  • Ignore whitespace
 
 void insert_block(struct t_keylist *block) {
   while (block) {
-    print_key(block->key); printf("\n");
+    printf("%p\n", get_context_amt());
     context_add(block->key->key, block->key->len, block->key->key, block->key->len);
     block = block->next;
   }
 
   int i = 1000;
   while (--i) {
+    context_sync();
     printf("ruff\n");
     amt_gc(get_context_amt());
     printf("ruff\n");
-    struct t_keylist *new_keys = random_block(100, 7, 8);
+    struct t_keylist *new_keys = random_block(2, 7, 8);
     insert_block(new_keys);
     printf("woof\n");
     testset = join_lists(testset, new_keys);

File test/shamtctxt.c

View file
  • Ignore whitespace
 static image *current;
 static amt_context *_context;
 
+#include <errno.h>
+
+
+#include <sys/time.h>
+#include <sys/resource.h>
+
+int getrlimit(int resource, struct rlimit *rlim);
+
 static void *allocator(size_t nbytes) {
+  printf("before alloc image has size %d (want %d)\n", current->last_length, current->last_length + nbytes);
   void *n = image_alloc(current, nbytes);
-  if (!n)
+  if (!n) {
+    struct rlimit ar;
+    getrlimit(RLIMIT_RSS, &ar);
+    printf("RLIMIT_AS is %d/%d\n", ar.rlim_cur, ar.rlim_max);
+
+    if (current->status == SHM_ERR_MMAP) {
+      printf("mmap failed, errno is %d\n", errno);
+      if (errno == ENOMEM)
+	printf("aw yeah\n");
+    }
+    
     die("image_alloc");
+  }
   return n;
 }
 
     die("context_add for non WRITE context");
   context_sync();
   void *valcopy = amt_copy_value((amt *) _context->img.contents, val, valsz);
+  context_sync();
   amtnode *root = amt_insert((amt *) _context->img.contents, _context->root,
 			     key, keysz, valcopy);
   amt_setroot((amt *) _context->img.contents, root);