#define _magic_asr_map_max_padding_pages ( \
_magic_vars->asr_map_max_padding_pages)
+/* Runtime flags. */
+#define _magic_no_mem_inst (_magic_vars->no_mem_inst)
+
/* Magic type array. */
#define _magic_types (_magic_vars->types)
#define _magic_types_num (_magic_vars->types_num)
#define MAGIC_RSTRUCT_FIELD_ASR_HEAP_MAX_PADDING "asr_heap_max_padding"
#define MAGIC_RSTRUCT_FIELD_ASR_MAP_MAX_OFFSET_PAGES "asr_map_max_offset_pages"
#define MAGIC_RSTRUCT_FIELD_ASR_MAP_MAX_PADDING_PAGES "asr_map_max_padding_pages"
+#define MAGIC_RSTRUCT_FIELD_NO_MEM_INST "no_mem_inst"
#define MAGIC_RSTRUCT_FIELD_TYPES "types"
#define MAGIC_RSTRUCT_FIELD_TYPES_NUM "types_num"
#define MAGIC_RSTRUCT_FIELD_TYPES_NEXT_ID "types_next_id"
MAGIC_RSTRUCT_FIELD_ASR_HEAP_MAX_PADDING, \
MAGIC_RSTRUCT_FIELD_ASR_MAP_MAX_OFFSET_PAGES, \
MAGIC_RSTRUCT_FIELD_ASR_MAP_MAX_PADDING_PAGES, \
+ MAGIC_RSTRUCT_FIELD_NO_MEM_INST, \
MAGIC_RSTRUCT_FIELD_TYPES, \
MAGIC_RSTRUCT_FIELD_TYPES_NUM, \
MAGIC_RSTRUCT_FIELD_TYPES_NEXT_ID, \
int asr_map_max_offset_pages;
int asr_map_max_padding_pages;
+ /* Runtime flags. */
+ int no_mem_inst;
+
/* Magic type array. */
struct _magic_type *types;
int types_num;
ST_DECLARE_STD_PTRINT_TYPEDEFS(pxfer_);
#define ST_TYPENAME_STRUCT_TRANSFER_NAMES "sxfer_*"
#ifdef __MINIX
-#define ST_SENTRYNAME_NO_TRANSFER_NAMES "noxfer_*", "sef_*", "st_*", "_brksize", "etext"
+#define ST_SENTRYNAME_NO_TRANSFER_NAMES "noxfer_*", "sef_*", "st_*", "etext"
#else
-#define ST_SENTRYNAME_NO_TRANSFER_NAMES "noxfer_*", "st_*", "_brksize", "etext", "allocatedDescs*", "ep.*" /* nginx specific */
+#define ST_SENTRYNAME_NO_TRANSFER_NAMES "noxfer_*", "st_*", "etext", "allocatedDescs*", "ep.*" /* nginx specific */
#define ST_DSENTRYLIB_NO_TRANSFER_NAMES "*/libst.so", "*/libcommon.so", "*/libtaskctl.so"
#endif
+#define ST_SENTRYNAME_NO_TRANSFER_MEM_NAMES "_brksize"
#define ST_SENTRYNAME_IDENTITY_TRANSFER_NAMES "ixfer_*"
#define ST_SENTRYNAME_CIDENTITY_TRANSFER_NAMES "cixfer_*"
#define ST_SENTRYNAME_PTR_TRANSFER_NAMES "pxfer_*"
}
Instruction *magicArrayBuildFuncInst = magicDataInitFunc->back().getTerminator();
+ //look up pointer to magic memory instrumentation flag
+ Value* magicNoMemInst = MagicUtil::getMagicRStructFieldPtr(M, magicArrayBuildFuncInst, magicRootVar, MAGIC_RSTRUCT_FIELD_NO_MEM_INST);
+ if(!magicNoMemInst) {
+ magicPassErr("Error: no " << MAGIC_RSTRUCT_FIELD_NO_MEM_INST << " field found");
+ exit(1);
+ }
+
//look up pointer to magic array and magic struct type
Value* magicArrayPtr = MagicUtil::getMagicRStructFieldPtr(M, magicArrayBuildFuncInst, magicRootVar, MAGIC_RSTRUCT_FIELD_SENTRIES);
if(!magicArrayPtr) {
//set pointer to magic type array in build function
new StoreInst(MagicUtil::getArrayPtr(M, magicTypeArray), magicTypeArrayPtr, false, magicArrayBuildFuncInst);
+ // set runtime flags
+ new StoreInst(ConstantInt::get(M.getContext(), APInt(32, DisableMemFunctions ? 1 : 0)), magicNoMemInst, false, magicArrayBuildFuncInst);
+
//set magic type array size in build function
new StoreInst(ConstantInt::get(M.getContext(), APInt(32, globalTypeInfos.size())), magicTypeArraySize, false, magicArrayBuildFuncInst);
0, /* asr_map_max_offset_pages */
0, /* asr_map_max_padding_pages */
+ /* Runtime flags. */
+ 0, /* no_mem_inst */
+
/* Magic type array. */
NULL, /* types */
0, /* types_num */
#endif
#undef __X
NULL };
+char *st_sentryname_noxfers_mem[] = { ST_SENTRYNAME_NO_TRANSFER_MEM_NAMES, NULL };
/* Exclude the data segments of certain libs from state transfer. */
char *st_dsentry_lib_noxfer[] = {
return MAGIC_SENTRY_ANALYZE_SKIP_PATH;
}
+ /* Skip memory management related sentries only when memory functions have
+ * been instrumented (which is *not* the case for the MINIX3 VM service).
+ */
+ if (_magic_no_mem_inst == 0 && ST_SENTRY_NAME_MATCH_ANY(st_sentryname_noxfers_mem, sentry_name)) {
+ ST_CB_PRINT(ST_CB_DBG, "sentry name matches noxfer", selement, sel_analyzed, sel_stats, cb_info);
+ return MAGIC_SENTRY_ANALYZE_SKIP_PATH;
+ }
+
if (ST_SENTRY_NAME_MATCH_ANY(st_sentryname_pxfers, sentry_name)) {
ST_CB_PRINT(ST_CB_DBG, "sentry name matches pxfer", selement, sel_analyzed, sel_stats, cb_info);
return transfer_ptr_sel_cb(selement, sel_analyzed, sel_stats, cb_info);