Skip to content

Commit

Permalink
DAOS-15799 build: Add libsanitize
Browse files Browse the repository at this point in the history
Update default SCons options to generate RPMs with code instrumented
with libasan.
Miscellaneous fixes for building with CI.

Skip-test: true
Required-githooks: true

Signed-off-by: Cedric Koch-Hofer <cedric.koch-hofer@intel.com>
  • Loading branch information
kanard38 authored and knard-intel committed Jun 7, 2024
1 parent 855d80e commit 58ff43d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions site_scons/prereq_tools/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2023 Intel Corporation
# Copyright 2016-2024 Intel Corporation
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -445,7 +445,7 @@ def __init__(self, env, opts):
opts.Add(BoolVariable('FIRMWARE_MGMT', 'Build in device firmware management.', 0))
opts.Add(BoolVariable('STACK_MMAP', 'Allocate ABT ULTs stacks with mmap()', 0))
opts.Add(BoolVariable('ADDRESS_SANITIZER',
'Instrument C code with the Address Sanitizer library', 0))
'Instrument C code with the Address Sanitizer library', 1))
opts.Add(EnumVariable('BUILD_TYPE', "Set the build type", 'release',
['dev', 'debug', 'release'], ignorecase=1))
opts.Add(EnumVariable('TARGET_TYPE', "Set the prerequisite type", 'default',
Expand Down
2 changes: 1 addition & 1 deletion site_scons/site_tools/compiler_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'-Wno-gnu-zero-variadic-macro-arguments',
'-Wno-tautological-constant-out-of-range-compare',
'-Wno-unused-command-line-argument',
'-Wframe-larger-than=4096']
'-Wframe-larger-than=8182']

# Compiler flags to prevent optimizing out security checks
DESIRED_FLAGS.extend(['-fno-strict-overflow', '-fno-delete-null-pointer-checks',
Expand Down
14 changes: 9 additions & 5 deletions src/client/dfs/dfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@ print_stat(struct stat *stbuf)
}
#endif

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-truncation"

static inline bool
tspec_gt(struct timespec l, struct timespec r)
{
Expand Down Expand Up @@ -1775,7 +1778,7 @@ dfs_cont_create(daos_handle_t poh, uuid_t *cuuid, dfs_attr_t *attr,
dattr.da_chunk_size = DFS_DEFAULT_CHUNK_SIZE;

if (attr->da_hints[0] != 0) {
strncpy(dattr.da_hints, attr->da_hints, DAOS_CONT_HINT_MAX_LEN);
strncpy(dattr.da_hints, attr->da_hints, DAOS_CONT_HINT_MAX_LEN - 1);
dattr.da_hints[DAOS_CONT_HINT_MAX_LEN - 1] = '\0';
}
} else {
Expand Down Expand Up @@ -2917,7 +2920,7 @@ dfs_global2local_all(int flags, d_iov_t glob, dfs_t **_dfs)

ptr = (char *)glob.iov_buf;

strncpy(pool, ptr, DAOS_PROP_LABEL_MAX_LEN + 1);
strncpy(pool, ptr, DAOS_PROP_LABEL_MAX_LEN);
pool[DAOS_PROP_LABEL_MAX_LEN] = 0;
pool_len = strlen(pool) + 1;
ptr += pool_len;
Expand All @@ -2934,7 +2937,7 @@ dfs_global2local_all(int flags, d_iov_t glob, dfs_t **_dfs)
D_GOTO(err, rc);
pool_h_bump = true;

strncpy(cont, ptr, DAOS_PROP_LABEL_MAX_LEN + 1);
strncpy(cont, ptr, DAOS_PROP_LABEL_MAX_LEN);
cont[DAOS_PROP_LABEL_MAX_LEN] = 0;
cont_len = strlen(cont) + 1;
ptr += cont_len;
Expand Down Expand Up @@ -4537,7 +4540,7 @@ dfs_obj_local2global(dfs_t *dfs, dfs_obj_t *obj, d_iov_t *glob)
oid_cp(&obj_glob->parent_oid, obj->parent_oid);
uuid_copy(obj_glob->coh_uuid, coh_uuid);
uuid_copy(obj_glob->cont_uuid, cont_uuid);
strncpy(obj_glob->name, obj->name, DFS_MAX_NAME + 1);
strncpy(obj_glob->name, obj->name, DFS_MAX_NAME);
obj_glob->name[DFS_MAX_NAME] = 0;
rc = dfs_get_chunk_size(obj, &obj_glob->chunk_size);
if (rc)
Expand Down Expand Up @@ -4593,7 +4596,7 @@ dfs_obj_global2local(dfs_t *dfs, int flags, d_iov_t glob, dfs_obj_t **_obj)

oid_cp(&obj->oid, obj_glob->oid);
oid_cp(&obj->parent_oid, obj_glob->parent_oid);
strncpy(obj->name, obj_glob->name, DFS_MAX_NAME + 1);
strncpy(obj->name, obj_glob->name, DFS_MAX_NAME);
obj->name[DFS_MAX_NAME] = '\0';
obj->mode = obj_glob->mode;
obj->flags = flags ? flags : obj_glob->flags;
Expand Down Expand Up @@ -7428,3 +7431,4 @@ dfs_obj_fix_type(dfs_t *dfs, dfs_obj_t *parent, const char *name)
D_FREE(entry.value);
return rc;
}
#pragma GCC diagnostic pop

0 comments on commit 58ff43d

Please sign in to comment.