From 8bbdc947c4f92fc9b1711adc0b00337dae2ed666 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 26 Jan 2016 16:26:12 -0500 Subject: [svn-r28972] Removed option to clear file buffers from autotools, CMake, and library. Buffers that will be written to disk will now always be cleared since not doing this has huge security implications. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0, x86_64) gcc 5.2.1 serial autotools parallel autotools (MPICH 3.1.4) serial CMake --- config/cmake/ConfigureChecks.cmake | 9 --------- config/cmake/H5pubconf.h.in | 4 ---- configure.ac | 26 -------------------------- src/H5B.c | 11 +++++------ src/H5B2cache.c | 4 ---- src/H5B2hdr.c | 4 +--- src/H5B2int.c | 22 ++++++++-------------- src/H5Bcache.c | 2 -- src/H5Dcontig.c | 7 +++---- src/H5FDcore.c | 4 ---- src/H5Faccum.c | 35 +++++++++++++++++------------------ src/H5Gcache.c | 2 -- src/H5HFdblock.c | 4 +--- src/H5HFtiny.c | 5 ++--- src/H5HG.c | 16 ++++++---------- src/H5HLcache.c | 2 -- src/H5SMcache.c | 3 +-- src/H5Zscaleoffset.c | 4 ---- src/libhdf5.settings.in | 1 - test/objcopy.c | 2 -- 20 files changed, 44 insertions(+), 123 deletions(-) diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 8bd6f45..49e9a05 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -6,15 +6,6 @@ include (${HDF_RESOURCES_EXT_DIR}/ConfigureChecks.cmake) include (${CMAKE_ROOT}/Modules/TestForSTDNamespace.cmake) #----------------------------------------------------------------------------- -# Option to Clear File Buffers before write --enable-clear-file-buffers -#----------------------------------------------------------------------------- -option (HDF5_Enable_Clear_File_Buffers "Securely clear file buffers before writing to file" ON) -if (HDF5_Enable_Clear_File_Buffers) - set (H5_CLEAR_MEMORY 1) -endif (HDF5_Enable_Clear_File_Buffers) -MARK_AS_ADVANCED (HDF5_Enable_Clear_File_Buffers) - -#----------------------------------------------------------------------------- # Option for --enable-strict-format-checks #----------------------------------------------------------------------------- option (HDF5_STRICT_FORMAT_CHECKS "Whether to perform strict file format checks" OFF) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index ce8219f..31c5afb 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -18,10 +18,6 @@ /* Define if building universal (internal helper macro) */ #cmakedefine H5_AC_APPLE_UNIVERSAL_BUILD @H5_AC_APPLE_UNIVERSAL_BUILD@ -/* Define if the memory buffers being written to disk should be cleared before - writing. */ -#cmakedefine H5_CLEAR_MEMORY @H5_CLEAR_MEMORY@ - /* Define if C++ compiler recognizes offsetof */ #cmakedefine H5_CXX_HAVE_OFFSETOF @H5_CXX_HAVE_OFFSETOF@ diff --git a/configure.ac b/configure.ac index b1c26a2..aeb4cf7 100644 --- a/configure.ac +++ b/configure.ac @@ -2004,32 +2004,6 @@ case "X-$INSTRUMENT" in esac ## ---------------------------------------------------------------------- -## Check if they would like to securely clear file buffers before they are -## written. -## -AC_SUBST([CLEARFILEBUF]) -AC_MSG_CHECKING([whether to clear file buffers]) -AC_ARG_ENABLE([clear-file-buffers], - [AS_HELP_STRING([--enable-clear-file-buffers], - [Securely clear file buffers before writing - to file. Default=yes.])], - [CLEARFILEBUF=$enableval]) - -case "X-$CLEARFILEBUF" in - *) - CLEARFILEBUF=yes - AC_MSG_RESULT([yes]) - AC_DEFINE([CLEAR_MEMORY], [1], - [Define if the memory buffers being written to disk should be - cleared before writing.]) - ;; - X-no) - CLEARFILEBUF=no - AC_MSG_RESULT([no]) - ;; -esac - -## ---------------------------------------------------------------------- ## Check if they would like to use a memory checking tool (like valgrind's ## 'memcheck' tool, or Rational Purify, etc) and the library should be ## more scrupulous with it's memory operations. Enabling this also diff --git a/src/H5B.c b/src/H5B.c index b26c38b..c87e332 100644 --- a/src/H5B.c +++ b/src/H5B.c @@ -1731,14 +1731,13 @@ H5B_shared_new(const H5F_t *f, const H5B_class_t *type, size_t sizeof_rkey) (shared->two_k + 1) * shared->sizeof_rkey); /*keys */ HDassert(shared->sizeof_rnode); - /* Allocate shared buffers */ + /* Allocate and clear shared buffers */ if(NULL == (shared->page = H5FL_BLK_MALLOC(page, shared->sizeof_rnode))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree page") -#ifdef H5_CLEAR_MEMORY -HDmemset(shared->page, 0, shared->sizeof_rnode); -#endif /* H5_CLEAR_MEMORY */ + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree page") + HDmemset(shared->page, 0, shared->sizeof_rnode); + if(NULL == (shared->nkey = H5FL_SEQ_MALLOC(size_t, (size_t)(shared->two_k + 1)))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree native keys") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree native keys") /* Initialize the offsets into the native key buffer */ for(u = 0; u < (shared->two_k + 1); u++) diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 57f794b..b899f6a 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -698,10 +698,8 @@ H5B2__cache_int_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) <= len); -#ifdef H5_CLEAR_MEMORY /* Clear rest of internal node */ HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image)); -#endif /* H5_CLEAR_MEMORY */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -975,10 +973,8 @@ H5B2__cache_leaf_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED l /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) <= len); -#ifdef H5_CLEAR_MEMORY /* Clear rest of leaf node */ HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image)); -#endif /* H5_CLEAR_MEMORY */ done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c index ab424b7..49ffb5b 100644 --- a/src/H5B2hdr.c +++ b/src/H5B2hdr.c @@ -152,9 +152,7 @@ H5B2__hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata, /* Allocate "page" for node I/O */ if(NULL == (hdr->page = H5FL_BLK_MALLOC(node_page, hdr->node_size))) HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, FAIL, "memory allocation failed") -#ifdef H5_CLEAR_MEMORY -HDmemset(hdr->page, 0, hdr->node_size); -#endif /* H5_CLEAR_MEMORY */ + HDmemset(hdr->page, 0, hdr->node_size); /* Allocate array of node info structs */ if(NULL == (hdr->node_info = H5FL_SEQ_MALLOC(H5B2_node_info_t, (size_t)(hdr->depth + 1)))) diff --git a/src/H5B2int.c b/src/H5B2int.c index a69774a..09addce 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -2191,32 +2191,30 @@ H5B2__create_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *node_ptr) /* Increment ref. count on B-tree header */ if(H5B2__hdr_incr(hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, FAIL, "can't increment ref. count on B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, FAIL, "can't increment ref. count on B-tree header") /* Share B-tree header information */ leaf->hdr = hdr; /* Allocate space for the native keys in memory */ if(NULL == (leaf->leaf_native = (uint8_t *)H5FL_FAC_MALLOC(hdr->node_info[0].nat_rec_fac))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree leaf native keys") -#ifdef H5_CLEAR_MEMORY -HDmemset(leaf->leaf_native, 0, hdr->cls->nrec_size * hdr->node_info[0].max_nrec); -#endif /* H5_CLEAR_MEMORY */ + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree leaf native keys") + HDmemset(leaf->leaf_native, 0, hdr->cls->nrec_size * hdr->node_info[0].max_nrec); /* Set number of records */ leaf->nrec = 0; /* Allocate space on disk for the leaf */ if(HADDR_UNDEF == (node_ptr->addr = H5MF_alloc(hdr->f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)hdr->node_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree leaf node") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree leaf node") /* Cache the new B-tree node */ if(H5AC_insert_entry(hdr->f, dxpl_id, H5AC_BT2_LEAF, node_ptr->addr, leaf, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree leaf to cache") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree leaf to cache") done: if(ret_value < 0) { - if(leaf) + if(leaf) if(H5B2__leaf_free(leaf) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to release v2 B-tree leaf node") } /* end if */ @@ -2313,16 +2311,12 @@ H5B2__create_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *node_ptr, /* Allocate space for the native keys in memory */ if(NULL == (internal->int_native = (uint8_t *)H5FL_FAC_MALLOC(hdr->node_info[depth].nat_rec_fac))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal native keys") -#ifdef H5_CLEAR_MEMORY -HDmemset(internal->int_native, 0, hdr->cls->nrec_size * hdr->node_info[depth].max_nrec); -#endif /* H5_CLEAR_MEMORY */ + HDmemset(internal->int_native, 0, hdr->cls->nrec_size * hdr->node_info[depth].max_nrec); /* Allocate space for the node pointers in memory */ if(NULL == (internal->node_ptrs = (H5B2_node_ptr_t *)H5FL_FAC_MALLOC(hdr->node_info[depth].node_ptr_fac))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal node pointers") -#ifdef H5_CLEAR_MEMORY -HDmemset(internal->node_ptrs, 0, sizeof(H5B2_node_ptr_t) * (hdr->node_info[depth].max_nrec + 1)); -#endif /* H5_CLEAR_MEMORY */ + HDmemset(internal->node_ptrs, 0, sizeof(H5B2_node_ptr_t) * (hdr->node_info[depth].max_nrec + 1)); /* Set number of records & depth of the node */ internal->nrec = 0; diff --git a/src/H5Bcache.c b/src/H5Bcache.c index d08f1bc..747e4c4 100644 --- a/src/H5Bcache.c +++ b/src/H5Bcache.c @@ -344,10 +344,8 @@ H5B__serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) <= len); -#ifdef H5_CLEAR_MEMORY /* Clear rest of node */ HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image)); -#endif /* H5_CLEAR_MEMORY */ done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index 3edf8b2..484514f 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -1026,10 +1026,9 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, if(NULL == (dset_contig->sieve_buf = H5FL_BLK_CALLOC(sieve_buf, dset_contig->sieve_buf_size))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed") -#ifdef H5_CLEAR_MEMORY -if(dset_contig->sieve_size > len) - HDmemset(dset_contig->sieve_buf + len, 0, (dset_contig->sieve_size - len)); -#endif /* H5_CLEAR_MEMORY */ + /* Clear memory */ + if(dset_contig->sieve_size > len) + HDmemset(dset_contig->sieve_buf + len, 0, (dset_contig->sieve_size - len)); /* Determine the new sieve buffer size & location */ dset_contig->sieve_loc = addr; diff --git a/src/H5FDcore.c b/src/H5FDcore.c index f4aa240..778baa0 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -1295,9 +1295,7 @@ H5FD__core_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UN HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "unable to allocate memory block of %llu bytes", (unsigned long long)new_eof) } /* end else */ -#ifdef H5_CLEAR_MEMORY HDmemset(x + file->eof, 0, (size_t)(new_eof - file->eof)); -#endif /* H5_CLEAR_MEMORY */ file->mem = x; file->eof = new_eof; @@ -1469,10 +1467,8 @@ H5FD__core_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "unable to allocate memory block") } /* end else */ -#ifdef H5_CLEAR_MEMORY if(file->eof < new_eof) HDmemset(x + file->eof, 0, (size_t)(new_eof - file->eof)); -#endif /* H5_CLEAR_MEMORY */ file->mem = x; /* Update backing store, if using it and if closing */ diff --git a/src/H5Faccum.c b/src/H5Faccum.c index 53f51ad..73c0bfd 100644 --- a/src/H5Faccum.c +++ b/src/H5Faccum.c @@ -164,9 +164,9 @@ H5F__accum_read(const H5F_io_info_t *fio_info, H5FD_mem_t type, haddr_t addr, /* Note the new buffer size */ accum->alloc_size = new_alloc_size; -#ifdef H5_CLEAR_MEMORY - HDmemset(accum->buf + accum->size, 0, (accum->alloc_size - accum->size)); -#endif /* H5_CLEAR_MEMORY */ + + /* Clear the memory */ + HDmemset(accum->buf + accum->size, 0, (accum->alloc_size - accum->size)); } /* end if */ /* Read the part before the metadata accumulator */ @@ -395,9 +395,9 @@ H5F__accum_adjust(H5F_meta_accum_t *accum, const H5F_io_info_t *fio_info, /* Update accumulator info */ accum->buf = new_buf; accum->alloc_size = new_size; -#ifdef H5_CLEAR_MEMORY -HDmemset(accum->buf + accum->size, 0, (accum->alloc_size - (accum->size + size))); -#endif /* H5_CLEAR_MEMORY */ + + /* Clear the memory */ + HDmemset(accum->buf + accum->size, 0, (accum->alloc_size - (accum->size + size))); } /* end if */ } /* end if */ @@ -623,9 +623,9 @@ H5F__accum_write(const H5F_io_info_t *fio_info, H5FD_mem_t type, haddr_t addr, /* Note the new buffer size */ accum->alloc_size = new_alloc_size; -#ifdef H5_CLEAR_MEMORY -HDmemset(accum->buf + size, 0, (accum->alloc_size - size)); -#endif /* H5_CLEAR_MEMORY */ + + /* Clear the memory */ + HDmemset(accum->buf + size, 0, (accum->alloc_size - size)); } /* end if */ /* Copy the new metadata to the buffer */ @@ -656,6 +656,7 @@ HDmemset(accum->buf + size, 0, (accum->alloc_size - size)); /* Check if we need to resize the buffer */ if(size > accum->alloc_size) { size_t new_size; /* New size of accumulator */ + size_t clear_size; /* Size of memory that needs clearing */ /* Adjust the buffer size to be a power of 2 that is large enough to hold data */ new_size = (size_t)1 << (1 + H5VM_log2_gen((uint64_t)(size - 1))); @@ -666,12 +667,10 @@ HDmemset(accum->buf + size, 0, (accum->alloc_size - size)); /* Note the new buffer size */ accum->alloc_size = new_size; -#ifdef H5_CLEAR_MEMORY -{ -size_t clear_size = MAX(accum->size, size); -HDmemset(accum->buf + clear_size, 0, (accum->alloc_size - clear_size)); -} -#endif /* H5_CLEAR_MEMORY */ + + /* Clear the memory */ + clear_size = MAX(accum->size, size); + HDmemset(accum->buf + clear_size, 0, (accum->alloc_size - clear_size)); } /* end if */ else { /* Check if we should shrink the accumulator buffer */ @@ -716,9 +715,9 @@ HDmemset(accum->buf + clear_size, 0, (accum->alloc_size - clear_size)); /* Note the new buffer size */ accum->alloc_size = new_size; -#ifdef H5_CLEAR_MEMORY -HDmemset(accum->buf + size, 0, (accum->alloc_size - size)); -#endif /* H5_CLEAR_MEMORY */ + + /* Clear the memory */ + HDmemset(accum->buf + size, 0, (accum->alloc_size - size)); } /* end if */ /* Update the metadata accumulator information */ diff --git a/src/H5Gcache.c b/src/H5Gcache.c index e7d44b5..e3303d1 100644 --- a/src/H5Gcache.c +++ b/src/H5Gcache.c @@ -316,10 +316,8 @@ H5G__cache_node_serialize(const H5F_t *f, void *_image, size_t len, if(H5G__ent_encode_vec(f, &image, sym->entry, sym->nsyms) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't serialize") -#ifdef H5_CLEAR_MEMORY /* Clear rest of symbol table node */ HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image)); -#endif /* H5_CLEAR_MEMORY */ done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c index 73db840..1272ab0 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -146,9 +146,7 @@ H5HF_man_dblock_create(hid_t dxpl_id, H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblo /* XXX: Change to using free-list factories */ if((dblock->blk = H5FL_BLK_MALLOC(direct_block, dblock->size)) == NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") -#ifdef H5_CLEAR_MEMORY -HDmemset(dblock->blk, 0, dblock->size); -#endif /* H5_CLEAR_MEMORY */ + HDmemset(dblock->blk, 0, dblock->size); dblock->write_buf = NULL; dblock->write_size = 0; diff --git a/src/H5HFtiny.c b/src/H5HFtiny.c index bdfe30d..711ceb9 100644 --- a/src/H5HFtiny.c +++ b/src/H5HFtiny.c @@ -177,10 +177,9 @@ HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size); ((enc_obj_size & H5HF_TINY_MASK_EXT_1) >> 8)); *id++ = enc_obj_size & H5HF_TINY_MASK_EXT_2; } /* end else */ + HDmemcpy(id, obj, obj_size); -#ifdef H5_CLEAR_MEMORY -HDmemset(id + obj_size, 0, (hdr->id_len - ((size_t)1 + (size_t)hdr->tiny_len_extended + obj_size))); -#endif /* H5_CLEAR_MEMORY */ + HDmemset(id + obj_size, 0, (hdr->id_len - ((size_t)1 + (size_t)hdr->tiny_len_extended + obj_size))); /* Update statistics about heap */ hdr->tiny_size += obj_size; diff --git a/src/H5HG.c b/src/H5HG.c index 57a1cf2..de25bc6 100644 --- a/src/H5HG.c +++ b/src/H5HG.c @@ -154,22 +154,20 @@ H5HG_create(H5F_t *f, hid_t dxpl_id, size_t size) /* Create it */ H5_CHECK_OVERFLOW(size, size_t, hsize_t); if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_GHEAP, dxpl_id, (hsize_t)size))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate file space for global heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate file space for global heap") if(NULL == (heap = H5FL_MALLOC(H5HG_heap_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") heap->addr = addr; heap->size = size; heap->shared = H5F_SHARED(f); if(NULL == (heap->chunk = H5FL_BLK_MALLOC(gheap_chunk, size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") -#ifdef H5_CLEAR_MEMORY -HDmemset(heap->chunk, 0, size); -#endif /* H5_CLEAR_MEMORY */ + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") + HDmemset(heap->chunk, 0, size); heap->nalloc = H5HG_NOBJS(f, size); heap->nused = 1; /* account for index 0, which is used for the free object */ if(NULL == (heap->obj = H5FL_SEQ_MALLOC(H5HG_obj_t, heap->nalloc))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") /* Initialize the header */ HDmemcpy(heap->chunk, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC); @@ -452,9 +450,7 @@ H5HG_extend(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t need) /* Re-allocate the heap information in memory */ if(NULL == (new_chunk = H5FL_BLK_REALLOC(gheap_chunk, heap->chunk, (heap->size + need)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "new heap allocation failed") -#ifdef H5_CLEAR_MEMORY -HDmemset(new_chunk + heap->size, 0, need); -#endif /* H5_CLEAR_MEMORY */ + HDmemset(new_chunk + heap->size, 0, need); /* Adjust the size of the heap */ old_size = heap->size; diff --git a/src/H5HLcache.c b/src/H5HLcache.c index faa5ff2..95ab65d 100644 --- a/src/H5HLcache.c +++ b/src/H5HLcache.c @@ -572,10 +572,8 @@ H5HL__cache_prefix_serialize(const H5F_t *f, void *_image, size_t len, /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) <= len); -#ifdef H5_CLEAR_MEMORY /* Clear rest of local heap */ HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image)); -#endif /* H5_CLEAR_MEMORY */ } /* end else */ FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5SMcache.c b/src/H5SMcache.c index bbd7e87..4de86e2 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -678,9 +678,8 @@ H5SM__cache_list_serialize(const H5F_t *f, void *_image, size_t len, /* sanity check */ HDassert((size_t)(image - (uint8_t *)_image) <= list->header->list_size); -#ifdef H5_CLEAR_MEMORY + /* Clear memory */ HDmemset(image, 0, (list->header->list_size - (size_t)(image - (uint8_t *)_image))); -#endif /* H5_CLEAR_MEMORY */ done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index 89aea81..ae3d2a1 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -883,10 +883,8 @@ H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") -#ifdef H5_CLEAR_MEMORY /* Initialize the parameters to a known state */ HDmemset(cd_values, 0, sizeof(cd_values)); -#endif /* H5_CLEAR_MEMORY */ /* Get the filter's current parameters */ if(H5P_get_filter_by_id(dcpl_plist, H5Z_FILTER_SCALEOFFSET, &flags, &cd_nelmts, cd_values, (size_t)0, NULL, NULL) < 0) @@ -1266,13 +1264,11 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value for(i = 0; i < sizeof(unsigned long long); i++) ((unsigned char *)outbuf)[5+i] = (unsigned char)((minval & ((unsigned long long)0xff << i*8)) >> i*8); -#ifdef H5_CLEAR_MEMORY /* Zero out remaining, unused bytes */ /* (Looks like an error in the original determination of how many * bytes would be needed for parameters. - QAK, 2010/08/19) */ HDmemset(outbuf + 13, 0, (size_t)8); -#endif /* H5_CLEAR_MEMORY */ /* special case: minbits equal to full precision */ if(minbits == p.size * 8) { diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in index 90224c1..b0e5628 100644 --- a/src/libhdf5.settings.in +++ b/src/libhdf5.settings.in @@ -64,7 +64,6 @@ Features: MPE: @MPE@ Direct VFD: @DIRECT_VFD@ dmalloc: @HAVE_DMALLOC@ -Clear file buffers before write: @CLEARFILEBUF@ Using memory checker: @USINGMEMCHECKER@ Memory allocation sanity checks: @MEMORYALLOCSANITYCHECK@ Function Stack Tracing: @CODESTACK@ diff --git a/test/objcopy.c b/test/objcopy.c index cd978f2..9bdb50d 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -2309,9 +2309,7 @@ test_copy_dataset_compound(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t TESTING("H5Ocopy(): compound dataset"); -#ifdef H5_CLEAR_MEMORY HDmemset(buf, 0, sizeof(buf)); -#endif /* H5_CLEAR_MEMORY */ for(i = 0; i < DIM_SIZE_1; i++) { buf[i].a = i; buf[i].d = (double)1.0F / (double)(i + 1); -- cgit v0.12