diff options
author | Luis Lozano <llozano@google.com> | 2012-06-12 00:33:30 +0000 |
---|---|---|
committer | Luis Lozano <llozano@google.com> | 2012-06-12 00:33:30 +0000 |
commit | ed46ad59b5231719615197de844d17993d612e4f (patch) | |
tree | 68ef4d23c59df0ad665745edf084306d8caf8a02 | |
parent | a8585bbc0f7b0497478c8ddd9c58bc287bd41437 (diff) |
Removed file entries for files that were moved to libsupc. I should have used "mv" but it is too late now.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/google/gcc-4_6-mobile@188410 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | vtable-security/gcc/temp-libgcc.cc | 207 | ||||
-rw-r--r-- | vtable-security/gcc/threaded-hash.c | 360 | ||||
-rw-r--r-- | vtable-security/gcc/threaded-hash.h | 52 | ||||
-rw-r--r-- | vtable-security/gcc/vtv_memory_pool/vtvmalloc.c | 138 | ||||
-rw-r--r-- | vtable-security/gcc/vtv_memory_pool/vtvmalloc.h | 33 |
5 files changed, 0 insertions, 790 deletions
diff --git a/vtable-security/gcc/temp-libgcc.cc b/vtable-security/gcc/temp-libgcc.cc deleted file mode 100644 index 3fe904af695..00000000000 --- a/vtable-security/gcc/temp-libgcc.cc +++ /dev/null @@ -1,207 +0,0 @@ -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <execinfo.h> - -#include "threaded-hash.h" -#include "vtv_memory_pool/vtvmalloc.h" - -/* TODO: review the reason for this */ -#ifndef __cplusplus -#error "This file must be compiled with a C++ compiler" -#endif - -static int debug_hash = 0; -static int debug_functions = 0; -static int debug_register_pairs = 0; -static int row_length = 30; -static FILE *log_file_fp =NULL; - -/* TODO: why is this returning a value ? */ -void * -__VLTChangePermission (const char *arg1, int len) -{ - const char *perm = arg1; - - if (debug_functions) - { - if (strncmp (perm, "rw", 2) == 0) - fprintf (stdout, "Changing VLT permisisons to Read-Write.\n"); - else if (strncmp (perm, "ro", 2) == 0) - fprintf (stdout, "Changing VLT permissions to Read-only.\n"); - else - fprintf (stdout, "Unrecognized permission string: %s\n", perm); - } - - if (strncmp (perm, "rw", 2) == 0) - { - VTV_malloc_init (); - VTV_unprotect (); - } - else if (strncmp (perm, "ro", 2) == 0) - VTV_protect (); - - if (debug_register_pairs) - { - if (strncmp (perm, "rw", 2) == 0) - { - if (!log_file_fp) - log_file_fp = fopen ("/tmp/vlt_register_pairs.log", "a"); - } - /* -- If we close the log file here, we can't access if in - __VLTVerifyVtablePointer. -- - else - { - if (log_file_fp) - fclose (log_file_fp); - } - */ - } - - return NULL; -} - -typedef int * vptr; - - /* For some reason, when the char * names get passed into these - functions, they are missing the '\0' at the end; therefore we - also pass in the length of the string and make sure, when writing - out the names, that we only write out the correct number of - bytes. */ -void -log_register_pairs (FILE *fp, const char *format_string_dummy, int format_arg1, - int format_arg2, char *base_var_name, char *vtable_name, - vptr vtbl_ptr) -{ - char format_string[50]; - - /* format_string needs to contain something like "%.10s" (for - example) to write a vtable_name that is of length - 10. Unfortunately the length varies with every name, so we need to - generate a new format string, with the correct length, EACH TIME. - That is what the 'format_string_dummy' parameter is for. It - contains something like '%%.%ds', and we then use that plus the - length argument to generate the correct format_string, to allow - us to write out the string that is missing the '\0' at it's - end. */ - - sprintf (format_string, format_string_dummy, format_arg1, format_arg2); - - fprintf (fp, format_string, base_var_name, vtable_name, vtbl_ptr); -} - - /* For some reason, when the char * names get passed into these - functions, they are missing the '\0' at the end; therefore we - also pass in the length of the string and make sure, when writing - out the names, that we only write out the correct number of - bytes. */ -void -print_debugging_message (const char *format_string_dummy, int format_arg1, - int format_arg2, - char *str_arg1, char *str_arg2) -{ - char format_string[50]; - - /* format_string needs to contain something like "%.10s" (for - example) to write a vtable_name that is of length - 10. Unfortunately the length varies with every name, so we need to - generate a new format string, with the correct length, EACH TIME. - That is what the 'format_string_dummy' parameter is for. It - contains something like '%%.%ds', and we then use that plus the - length argument to generate the correct format_string, to allow - us to write out the string that is missing the '\0' at it's - end. */ - - snprintf (format_string, sizeof(format_string), format_string_dummy, format_arg1, format_arg2); - - fprintf (stdout, format_string, str_arg1, str_arg2); -} - -void * -__VLTRegisterPair (void **data_pointer, void *test_value, - char *base_ptr_var_name, int len1, char *vtable_name, - int len2) -{ - struct vlt_hashtable **base_vtbl_row_ptr = (struct vlt_hashtable **) data_pointer; - vptr vtbl_ptr = (vptr) test_value; - - if ((*base_vtbl_row_ptr) == NULL) - *base_vtbl_row_ptr = vlt_hash_init_table (); - - if (base_ptr_var_name && vtable_name && debug_functions) - print_debugging_message ("Registering %%.%ds : %%.%ds\n", len1, len2, - base_ptr_var_name, vtable_name); - if (debug_register_pairs) - { - if (!log_file_fp) - log_file_fp = fopen ("/tmp/vlt_register_pairs.log", "a"); - log_register_pairs (log_file_fp, "Registering %%.%ds : %%.%ds (%%p)\n", - len1, len2, - base_ptr_var_name, vtable_name, vtbl_ptr); - if (*base_vtbl_row_ptr == NULL) - fprintf (log_file_fp, " vtable map variable is NULL.\n"); - } - - vlt_hash_insert (*base_vtbl_row_ptr, test_value); -} - -static void PrintStackTrace() -{ - #define STACK_DEPTH 20 - void * callers[STACK_DEPTH]; - int actual_depth = backtrace(callers, STACK_DEPTH); - char ** symbols = backtrace_symbols(callers, actual_depth); - if (symbols == NULL ) - { - fprintf(stderr, "Could not get backtrace\n"); - return; - } - - for (int i = 0; i < actual_depth; i++) - fprintf(stderr, "%s\n", symbols[i]); - - free(symbols); -} - -void * -__VLTVerifyVtablePointer (void **data_pointer, void *test_value, - char *base_vtbl_var_name, int len1, char *vtable_name, - int len2) -{ - struct vlt_hashtable **base_vtbl_ptr = (vlt_hashtable **) data_pointer; - vptr obj_vptr = (vptr) test_value; - static bool first_time = true; - - if ((*data_pointer) == NULL) - return test_value; - - if (first_time && debug_hash) - { - dump_hashing_statistics (); - first_time = false; - } - - if (vlt_hash_find ((*base_vtbl_ptr), test_value)) - { - if (debug_functions) - fprintf (stdout, "Verified object vtable pointer = %p\n", obj_vptr); - } - else - { - /* The data structure is not NULL, but we failed to find our - object's vtpr in it. Write out information and call abort.*/ - if (base_vtbl_var_name && vtable_name) - print_debugging_message ("Looking for %%.%ds in %%.%ds \n", len2, len1, - vtable_name, base_vtbl_var_name); - fprintf (stderr, "FAILED to verify object vtable pointer=%p!!!\n", - obj_vptr); - dump_table_to_vtbl_map_file (*base_vtbl_ptr, 1, base_vtbl_var_name, - len1); - /* Eventually we should call __stack_chk_fail (or something similar) - rather than just abort. */ - PrintStackTrace(); - abort (); - } - - return test_value; -} diff --git a/vtable-security/gcc/threaded-hash.c b/vtable-security/gcc/threaded-hash.c deleted file mode 100644 index 59d09d5a1e2..00000000000 --- a/vtable-security/gcc/threaded-hash.c +++ /dev/null @@ -1,360 +0,0 @@ -/* TO DO: Add copyright notices etc. */ - -#include <stdlib.h> -#include <math.h> -#include <stdio.h> -#include <string.h> - -#include "threaded-hash.h" -#include "vtv_memory_pool/vtvmalloc.h" - -#define my_malloc VTV_malloc -#define my_free VTV_free - -#define INITIAL_SIZE 16 -#define INITIAL_POWER 4 -#define REHASH_LIMIT 0.8 - - -/* Statistics/Profiling numbers (for debugging) */ - -static unsigned num_tables_allocated = 0; -static unsigned num_bucket_pointers_allocated = 0; -static unsigned num_buckets_created = 0; -static unsigned num_slots_filled = 0; -static unsigned num_rehashes = 0; -static unsigned num_rehashed_elements = 0; -static unsigned size_of_bucket = sizeof (struct vlt_hash_bucket); -static unsigned size_of_pointer = sizeof (void *); - -static uint32_t -hash_pointer (void *pointer) -{ - uint32_t result; - intptr_t numeric = (intptr_t) pointer; - -#if __SIZEOF_POINTER__ == 8 - numeric += numeric >> 32; -#elif __SIZEOF_POINTER__ != 4 -#error "Unsupported pointer size." -#endif - result = numeric; - result += result >> 15; - result += result >> 10; - result += result >> 6; - result += result >> 3; - result *= 0x953653a5u; - result += result >> 11; - return result; -} - -static void -bucket_insert (struct vlt_hash_bucket **slot, void *value) -{ - struct vlt_hash_bucket *new_bucket = - (struct vlt_hash_bucket *) my_malloc (sizeof (struct vlt_hash_bucket)); - - new_bucket->data = value; - new_bucket->next = *slot; - num_buckets_created++; /* Debug */ - if ((*slot) == NULL) /* Debug */ - num_slots_filled++; /* Debug */ - - *slot = new_bucket; -} - -static uint32_t -rehash_elements (struct vlt_hash_bucket **old_data, - struct vlt_hash_bucket **new_data, - uint32_t old_size, uint32_t new_size, uint32_t num_bits) -{ - uint32_t i; - uint32_t mask = 0xffffffff >> (32 - num_bits); - struct vlt_hash_bucket *cur_bucket; - uint32_t num_elements = 0; - - num_rehashes++; /* Debug */ - num_rehashed_elements += old_size; /* Debug */ - - for (i = 0; i < old_size; ++i) - { - if (old_data[i] != 0) - { - struct vlt_hash_bucket *bucket_list = old_data[i]; - for (cur_bucket = bucket_list; cur_bucket; - cur_bucket = cur_bucket->next) - { - void *value = cur_bucket->data; - if (value != NULL) - { - uint32_t hash = hash_pointer (value); - uint32_t new_index = hash & mask; - bucket_insert (&(new_data[new_index]), value); - num_elements++; - } - } - } - } - return num_elements; -} - -static void -grow_table (struct vlt_hashtable *table) -{ - uint32_t old_size = table->data_size; - uint32_t new_size = 2 * old_size; - uint32_t new_power_size = table->power_of_2 + 1; - - struct vlt_hash_bucket **new_data = - (struct vlt_hash_bucket **) - my_malloc (new_size * sizeof (struct vlt_hash_bucket *)); - struct vlt_hash_bucket **old_data = table->data; - - num_bucket_pointers_allocated += new_size; - - memset (new_data, 0, (new_size * sizeof (struct vlt_hash_bucket *))); - - table->num_elts = rehash_elements (old_data, new_data, old_size, new_size, - new_power_size); - - pthread_mutex_lock (&(table->mutex)); - table->data = new_data; - table->data_size = new_size; - table->power_of_2 = new_power_size; - table->hash_mask = 0xffffffff >> (32 - new_power_size); - pthread_mutex_unlock (&(table->mutex)); - - my_free (old_data); - - /* To do: need to 'my_free' each allocated bucket in old_data... */ -} - -static void * -bucket_find (struct vlt_hash_bucket *slot, void * value) -{ - struct vlt_hash_bucket *current; - - if (slot == NULL) - return NULL; - - for (current = slot; current; current = current->next) - if (current->data == value) - return current; - - return NULL; -} - -static void * -access (struct vlt_hashtable *table, void *value, - enum vlt_hash_access_kind access) -{ - uint32_t hash = hash_pointer (value); - uint32_t new_index = hash & table->hash_mask; - void *ret_val = NULL; - - /* pthread_mutex_lock (&(table->mutex));*/ - ret_val = bucket_find (table->data[new_index], value); - if (access == TABLE_INSERT) - { - if (!ret_val) - { - if (table->num_elts >= (REHASH_LIMIT * table->data_size)) - { - grow_table (table); - new_index = hash & table->hash_mask; - } - bucket_insert ( &(table->data[new_index]), value); - table->num_elts++; - } - ret_val = NULL; - } - /* pthread_mutex_unlock (&(table.mutex)); */ - - return ret_val; -} - -/* Externally Visible Functions */ - -struct vlt_hashtable* -vlt_hash_init_table (void) -{ - struct vlt_hashtable *new_table = - (struct vlt_hashtable *) my_malloc (sizeof (struct vlt_hashtable)); - new_table->data_size = INITIAL_SIZE; - new_table->power_of_2 = INITIAL_POWER; - new_table->hash_mask = 0xffffffff >> (32 - INITIAL_POWER); - new_table->num_elts = 0; - pthread_mutex_init (&(new_table->mutex), NULL); - - num_tables_allocated++; /* Debug */ - num_bucket_pointers_allocated += INITIAL_SIZE; /* Debug */ - - new_table->data = - (struct vlt_hash_bucket **) - my_malloc (INITIAL_SIZE * sizeof (struct vlt_hash_bucket *)); - memset (new_table->data, 0, - (INITIAL_SIZE * sizeof (struct vlt_hash_bucket *))); - - return new_table; -} - -void -vlt_hash_insert (struct vlt_hashtable *table, void *value) -{ - access (table, value, TABLE_INSERT); -} - -void * -vlt_hash_find (struct vlt_hashtable *table, void *value) -{ - access (table, value, TABLE_FIND); -} - -/* Debugging Functions */ - -/* Outputs the contents of a single SLOT in the hashtable. A slot - consists of a linked list of entries that all hashed to the same - entry in the table. IDX is the index of the SLOT in the hash table. - MAX_SIZE is the length of the longest linked list seen in any slot so - far (going through all the slots, from dump_table_to_file). DUMP_FILE - is where the output gets sent. */ - -void -dump_bucket_info (struct vlt_hash_bucket *slot, uint32_t idx, - uint32_t *max_size, FILE *dump_file) -{ - struct vlt_hash_bucket *cur; - int num_buckets = 0; - - if (slot == NULL) - { - fprintf (dump_file, "slot[%2d]: empty\n", idx); - return; - } - - for (cur = slot; cur; cur = cur->next) - num_buckets++; - - if (num_buckets > *max_size) - *max_size = num_buckets; - - fprintf (dump_file, "slot[%2d]: %d elements, ", idx, num_buckets); - - for (cur = slot; cur; cur = cur->next) - fprintf (dump_file, " %p ", cur->data); - - fprintf (dump_file, "\n"); -} - -/* Outputs the main information about the hashtable TABLE. DUMP_BUCKETS - is a boolean indicating whether or not to output the contents of all the - hashtable buckets. DUMP_FILE is where the output gets sent. */ - -void -dump_table_to_file (struct vlt_hashtable *table, uint32_t dump_buckets, - FILE *dump_file) -{ - uint32_t i; - uint32_t max_bucket_size = 0; - - fprintf (dump_file, "Table Stats:\n"); - fprintf (dump_file, " Max Array Size: %d (2^%d) \n", table->data_size, - table->power_of_2); - fprintf (dump_file, " Hash Mask: 0x%x\n", table->hash_mask); - fprintf (dump_file, " Current Number of Elements: %d\n\n", table->num_elts); - - if (dump_buckets) - { - fprintf (dump_file, "Bucket Data:\n"); - for (i = 0; i < table->data_size; ++i) - dump_bucket_info (table->data[i], i, &max_bucket_size, dump_file); - - fprintf (dump_file, "Max bucket size is: %d\n", max_bucket_size); - } - - fprintf (dump_file, "\n"); -} - - -/* Outputs the main information about the hashtable TABLE. DUMP_BUCKETS - is a boolean indicating whether or not to output the contents of all the - hashtable buckets. Output gets sent to stdout. */ - -void -dump_table (struct vlt_hashtable *table, uint32_t dump_buckets) -{ - dump_table_to_file (table, dump_buckets, stdout); -} - -/* Outputs the main information about the hashtable TABLE. DUMP_BUCKETS - is a boolean indicating whether or not to output the contents of all the - hashtable buckets. Very similar to dump_table, except output is - send to a newly created file named FILENAME, if we can open it. */ - -void -dump_table_to_filename (struct vlt_hashtable *table, uint32_t dump_buckets, - char *filename) -{ - FILE *fp; - - if (!filename) - return; - - fp = fopen (filename, "w"); - if (fp) - { - dump_table_to_file (table, dump_buckets, fp); - fclose (fp); - } -} - -void -dump_table_to_vtbl_map_file (struct vlt_hashtable *table, - uint32_t dump_buckets, - char *var_name, uint32_t name_len) -{ - char *filename = (char *) malloc ((name_len + 11) * sizeof (char)); - char *real_name = (char *) malloc ((name_len + 1) * sizeof (char)); - FILE *dump_file_fp = NULL; - - strncpy (real_name, var_name, name_len); - real_name[name_len] = '\0'; - - sprintf (filename, "/tmp/%s.log", real_name); - - dump_file_fp = fopen (filename, "w"); - if (dump_file_fp) - { - dump_table_to_file (table, dump_buckets, dump_file_fp); - fclose (dump_file_fp); - } - - free (real_name); - free (filename); -} - -void -dump_hashing_statistics (void) -{ - FILE *fp = fopen("/tmp/threaded-hash-statistics.log", "w"); - - if (fp) - { - fprintf (fp, "Threaded Hash Table Statistics\n\n"); - fprintf (fp, "# Hash Tables Created: %d\n", num_tables_allocated); - fprintf (fp, "# Slots Created: %d\n", num_bucket_pointers_allocated); - fprintf (fp, "# Slots Filled: %d\n", num_slots_filled); - fprintf (fp, "# Unused Slots: %d\n", - num_bucket_pointers_allocated - num_slots_filled); - fprintf (fp, "Slot Size (in bytes): %d\n\n", size_of_pointer); - - fprintf (fp, "# Buckets Created: %d\n", num_buckets_created); - fprintf (fp, "# Non-slot buckets (in collision chains): %d\n", - num_buckets_created - num_slots_filled); - fprintf (fp, "Bucket Size (in bytes): %d\n\n", size_of_bucket); - fprintf (fp, "# of re-hashes that occurred: %d\n", num_rehashes); - fprintf (fp, "# of re-hashed elements: %d\n", num_rehashed_elements); - - fclose (fp); - } -} diff --git a/vtable-security/gcc/threaded-hash.h b/vtable-security/gcc/threaded-hash.h deleted file mode 100644 index f5622557c00..00000000000 --- a/vtable-security/gcc/threaded-hash.h +++ /dev/null @@ -1,52 +0,0 @@ -/* TO DO: Add copyright, etc. */ - -#ifndef _THREADED_HASH_H -#define _THREADED_HASH_H 1 - -#include <pthread.h> -#include <inttypes.h> - -#ifdef __cplusplus -extern "C" { -#endif - -struct vlt_hash_bucket { - void *data; - struct vlt_hash_bucket *next; -}; - -struct vlt_hashtable { - uint32_t data_size; - uint32_t num_elts; - uint32_t power_of_2; - uint32_t hash_mask; - pthread_mutex_t mutex; - struct vlt_hash_bucket **data; -}; - -enum vlt_hash_access_kind { - TABLE_INSERT, - TABLE_FIND -}; - -/* Main hash table interface */ - -extern struct vlt_hashtable *vlt_hash_init_table (void); -extern void vlt_hash_insert (struct vlt_hashtable *, void *); -extern void *vlt_hash_find (struct vlt_hashtable *, void *); - -/* for debugging purposes... */ - -extern void dump_hashing_statistics (void); -extern void dump_bucket_info (struct vlt_hash_bucket *, uint32_t, uint32_t *, FILE *); -extern void dump_table_to_file (struct vlt_hashtable *, uint32_t, FILE *); -extern void dump_table (struct vlt_hashtable *, uint32_t); -extern void dump_table_to_filename (struct vlt_hashtable *, uint32_t, char *); -extern void dump_table_to_vtbl_map_file (struct vlt_hashtable *,uint32_t, - char *, uint32_t); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* _THREADED_HASH_H */ diff --git a/vtable-security/gcc/vtv_memory_pool/vtvmalloc.c b/vtable-security/gcc/vtv_memory_pool/vtvmalloc.c deleted file mode 100644 index 3bc061a3e85..00000000000 --- a/vtable-security/gcc/vtv_memory_pool/vtvmalloc.c +++ /dev/null @@ -1,138 +0,0 @@ -#include <stdlib.h> -#include <unistd.h> -#include <sys/mman.h> -#include <stdio.h> - -#include "vtvmalloc.h" -#include <obstack.h> - -/* Set the following macro to 1 to get internal debugging messages */ -#define VTV_DEBUG 1 - -/* TODO: Need to protect the following variables */ -static struct obstack VTV_obstack; -static unsigned long page_size = 0; -static void * current_chunk = 0; -static size_t current_chunk_size = 0; - -/* TODO: Define what is the expected behavior of assert and error */ -/* Handling of runtime error */ -static void -VTV_error (void) -{ - abort(); -} - -#define VTV_assert(EXPR) ((void)(!(EXPR) ? VTV_error() : (void) 0)) - -void -VTV_protect (void) -{ - struct _obstack_chunk * ci; - ci = (struct _obstack_chunk *) current_chunk; - while (ci) - { - VTV_assert(((unsigned long)ci & (page_size - 1)) == 0); - if (mprotect(ci, (ci->limit - (char *)ci), PROT_READ) == -1) - VTV_error(); - ci = ci->prev; - } -#if (VTV_DEBUG == 1) - { - int count = 0; - ci = (struct _obstack_chunk *) current_chunk; - while (ci) - { - count++; - ci = ci->prev; - } - fprintf(stderr, "VTV_protect(): protected %d pages\n", count); - } -#endif -} - -void -VTV_unprotect (void) -{ - struct _obstack_chunk * ci; - ci = (struct _obstack_chunk *) current_chunk; - while (ci) - { - VTV_assert(((unsigned long)ci & (page_size - 1)) == 0); - if (mprotect(ci, (ci->limit - (char *)ci), PROT_READ | PROT_WRITE) == -1) - VTV_error(); - ci = ci->prev; - } -} - -/* Allocates a chunk of memory that is aligned to a page boundary. - The amount of memory requested must be a multiple of the page size */ -static void * -obstack_chunk_alloc (size_t size) -{ - /* TODO: Why do we need to support chunk sizes less that page size? */ - /* Get size to next multiple of page_size */ - size = (size + (page_size - 1)) & (~(page_size - 1)); - VTV_assert((size & (page_size - 1)) == 0); - void * allocated; - if ((allocated = mmap (NULL, size, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)) == 0) - VTV_error(); - - VTV_assert(((unsigned long) allocated & (page_size - 1)) == 0); - current_chunk = allocated; - current_chunk_size = size; - return allocated; -} - -static void -obstack_chunk_free (size_t size) -{ - /* Do nothing. For our purposes there should be very little de-allocation. */ -} - -void -VTV_malloc_init (void) -{ - static int initialized = 0; - - /* Make sure we only execute the main body of this function ONCE. */ - if (initialized) - return; - - page_size = sysconf(_SC_PAGE_SIZE); - - obstack_chunk_size (&VTV_obstack) = page_size; - obstack_alignment_mask(&VTV_obstack) = sizeof(long) - 1; - /* We guarantee that the obstack alloc failed handler will never be called because - in case the allocation of the chunk fails, it will never return */ - obstack_alloc_failed_handler = NULL; - - obstack_init(&VTV_obstack); - initialized = 1; -} - -void * -VTV_malloc (size_t size) -{ - return obstack_alloc (&VTV_obstack, size); -} - -void -VTV_free (void * ptr) -{ - /* Do nothing. We dont care about recovering unneded memory */ -} - -void -VTV_malloc_stats (void) -{ - int count = 0; - struct _obstack_chunk * ci = (struct _obstack_chunk *) current_chunk; - while (ci) - { - count++; - ci = ci->prev; - } - fprintf(stderr, "VTV_malloc_stats:\n Page Size = %d bytes\n Number of pages = %d\n", page_size, count); -} diff --git a/vtable-security/gcc/vtv_memory_pool/vtvmalloc.h b/vtable-security/gcc/vtv_memory_pool/vtvmalloc.h deleted file mode 100644 index 416a4e68104..00000000000 --- a/vtable-security/gcc/vtv_memory_pool/vtvmalloc.h +++ /dev/null @@ -1,33 +0,0 @@ -/* TODO: add copyright and comments */ - -#ifndef _VTVMALLOC_H -#define _VTVMALLOC_H 1 - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdlib.h> - -/* Alignment mask for any object returned by the VTV memory pool */ -#ifdef __LP64__ -#define VTV_ALIGNMENT_MASK (0x7) -#else -#define VTV_ALIGNMENT_MASK (0x3) -#endif - -extern void VTV_malloc_init (); -/* TODO: Do we need an interface that destroys everything? */ - -extern void * VTV_malloc (size_t size); -extern void VTV_free (void * ptr); -extern void VTV_malloc_stats (void); - -extern void VTV_protect (void); -extern void VTV_unprotect (void); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* vtvmalloc.h */ |