Skip to content

Commit

Permalink
fixup! TLS: Drop messages associated with a closed endpoint in the pr…
Browse files Browse the repository at this point in the history
…ocesses
  • Loading branch information
Danielius1922 committed Sep 25, 2023
1 parent 40fbbd3 commit 0958984
Show file tree
Hide file tree
Showing 12 changed files with 80 additions and 33 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/cmake-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
- args: "-DOC_DYNAMIC_ALLOCATION_ENABLED=OFF -DOC_SECURITY_ENABLED=OFF -DOC_PKI_ENABLED=OFF -DOC_IDD_API_ENABLED=OFF -DOC_OSCORE_ENABLED=OFF -DOC_WKCORE_ENABLED=OFF -DOC_SOFTWARE_UPDATE_ENABLED=OFF -DOC_MNT_ENABLED=OFF -DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=OFF -DOC_PUSH_ENABLED=OFF -DPLGD_DEV_TIME_ENABLED=OFF -DOC_INTROSPECTION_ENABLED=OFF -DOC_ETAG_ENABLED=OFF"
uses: ./.github/workflows/unit-test-with-cfg.yml
with:
build_args: -DOC_LOG_MAXIMUM_LOG_LEVEL=INFO -DOC_WKCORE_ENABLED=ON -DOC_SOFTWARE_UPDATE_ENABLED=ON -DOC_MNT_ENABLED=ON -DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON -DOC_PUSH_ENABLED=ON -DPLGD_DEV_TIME_ENABLED=ON -DOC_ETAG_ENABLED=ON ${{ matrix.args }}
build_args: -DOC_LOG_MAXIMUM_LOG_LEVEL=INFO -DOC_WKCORE_ENABLED=ON -DOC_SOFTWARE_UPDATE_ENABLED=ON -DOC_MNT_ENABLED=ON -DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON -DOC_PUSH_ENABLED=ON -DPLGD_DEV_TIME_ENABLED=ON -DOC_ETAG_ENABLED=ON ${{ matrix.args }} -DOC_DYNAMIC_ALLOCATION_ENABLED=OFF
build_type: ${{ (github.event_name == 'workflow_dispatch' && inputs.build_type) || 'Debug' }}
clang: ${{ github.event_name == 'workflow_dispatch' && inputs.clang }}
coverage: false
Expand All @@ -85,7 +85,7 @@ jobs:
uses: ./.github/workflows/unit-test-with-cfg.yml
with:
# cloud on (ipv4+tcp on), collections create on, maintenance resource on, well-known core resource on, software update on, /oic/res observable on, push notification on, plgd-time on, etag on
build_args: -DOC_LOG_MAXIMUM_LOG_LEVEL=INFO -DOC_CLOUD_ENABLED=ON -DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_MNT_ENABLED=ON -DOC_WKCORE_ENABLED=ON -DOC_SOFTWARE_UPDATE_ENABLED=ON -DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON -DOC_PUSH_ENABLED=ON -DPLGD_DEV_TIME_ENABLED=ON -DOC_ETAG_ENABLED=ON
build_args: -DOC_LOG_MAXIMUM_LOG_LEVEL=INFO -DOC_CLOUD_ENABLED=ON -DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_MNT_ENABLED=ON -DOC_WKCORE_ENABLED=ON -DOC_SOFTWARE_UPDATE_ENABLED=ON -DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON -DOC_PUSH_ENABLED=ON -DPLGD_DEV_TIME_ENABLED=ON -DOC_ETAG_ENABLED=ON -DOC_DYNAMIC_ALLOCATION_ENABLED=OFF
build_type: ${{ (github.event_name == 'workflow_dispatch' && inputs.build_type) || 'Debug' }}
clang: ${{ github.event_name == 'workflow_dispatch' && inputs.clang }}
coverage: false
Expand All @@ -109,6 +109,11 @@ jobs:
# GCC thread-sanitizer keeps reporting false positives, so we use clang instead for tests with thread-sanitizer
clang: true
install_faketime: true
# static allocation requires additional thread synchronization
- args: -DOC_TSAN_ENABLED=ON -DOC_DYNAMIC_ALLOCATION_ENABLED=OFF
# GCC thread-sanitizer keeps reporting false positives, so we use clang instead for tests with thread-sanitizer
clang: true
install_faketime: true
# undefined behaviour sanitizer
- args: -DOC_UBSAN_ENABLED=ON
install_faketime: true
Expand All @@ -117,7 +122,7 @@ jobs:
# install_faketime: true
uses: ./.github/workflows/unit-test-with-cfg.yml
with:
build_args: -DOC_LOG_MAXIMUM_LOG_LEVEL=INFO -DOC_CLOUD_ENABLED=ON -DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_MNT_ENABLED=ON -DOC_WKCORE_ENABLED=ON -DOC_SOFTWARE_UPDATE_ENABLED=ON -DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON -DOC_PUSH_ENABLED=ON -DOC_RESOURCE_ACCESS_IN_RFOTM_ENABLED=ON -DPLGD_DEV_TIME_ENABLED=ON -DOC_ETAG_ENABLED=ON ${{ matrix.args }}
build_args: -DOC_LOG_MAXIMUM_LOG_LEVEL=INFO -DOC_CLOUD_ENABLED=ON -DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_MNT_ENABLED=ON -DOC_WKCORE_ENABLED=ON -DOC_SOFTWARE_UPDATE_ENABLED=ON -DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON -DOC_PUSH_ENABLED=ON -DOC_RESOURCE_ACCESS_IN_RFOTM_ENABLED=ON -DPLGD_DEV_TIME_ENABLED=ON -DOC_ETAG_ENABLED=ON ${{ matrix.args }} -DOC_DYNAMIC_ALLOCATION_ENABLED=OFF
build_type: ${{ (github.event_name == 'workflow_dispatch' && inputs.build_type) || 'Debug' }}
clang: ${{ ((github.event_name == 'workflow_dispatch' && inputs.clang) || matrix.clang) || false }}
coverage: false
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/plgd-device-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ jobs:
docker_file: docker/apps/Dockerfile.cloud-server-debug-clang

- name: cloud-server-release-discovery-resource-observable-access-in-RFOTM-rep-realloc
args: "-DOC_DEBUG_ENABLED=OFF -DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON -DOC_RESOURCE_ACCESS_IN_RFOTM_ENABLED=ON -DOC_REPRESENTATION_REALLOC_ENCODING_ENABLED=ON"
args: "-DOC_DEBUG_ENABLED=OFF -DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON -DOC_RESOURCE_ACCESS_IN_RFOTM_ENABLED=ON -DOC_REPRESENTATION_REALLOC_ENCODING_ENABLED=ON"
build_type: Release
docker_file: docker/apps/Dockerfile.cloud-server

uses: ./.github/workflows/plgd-device-test-with-cfg.yml
with:
name: ${{ matrix.name }}
build_args: -DOC_DEBUG_ENABLED=ON -DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_MNT_ENABLED=ON -DOC_OSCORE_ENABLED=OFF -DPLGD_DEV_TIME_ENABLED=ON -DOC_ETAG_ENABLED=ON ${{ matrix.args }}
build_args: -DOC_DEBUG_ENABLED=ON -DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_MNT_ENABLED=ON -DOC_OSCORE_ENABLED=OFF -DPLGD_DEV_TIME_ENABLED=ON -DOC_ETAG_ENABLED=ON ${{ matrix.args }} -DOC_DYNAMIC_ALLOCATION_ENABLED=OFF
build_type: ${{ (github.event_name == 'workflow_dispatch' && inputs.build_type) || (matrix.build_type || 'Debug') }}
cert_signature_algorithm: ${{ (github.event_name == 'workflow_dispatch' && inputs.cert_signature_algorithm) || 'ECDSA-SHA256' }}
cert_elliptic_curve: ${{ (github.event_name == 'workflow_dispatch' && inputs.cert_elliptic_curve) || 'P256' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/plgd-hub-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ jobs:
uses: ./.github/workflows/plgd-hub-test-with-cfg.yml
with:
name: ${{ matrix.name }}
build_args: -DOC_DEBUG_ENABLED=ON -DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_MNT_ENABLED=ON -DOC_OSCORE_ENABLED=OFF -DPLGD_DEV_TIME_ENABLED=ON -DOC_ETAG_ENABLED=ON ${{ matrix.build_args }}
build_args: -DOC_DEBUG_ENABLED=ON -DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_MNT_ENABLED=ON -DOC_OSCORE_ENABLED=OFF -DPLGD_DEV_TIME_ENABLED=ON -DOC_ETAG_ENABLED=ON ${{ matrix.build_args }} -DOC_DYNAMIC_ALLOCATION_ENABLED=OFF
build_type: ${{ (github.event_name == 'workflow_dispatch' && inputs.build_type) || (matrix.build_type || 'Debug') }}
hub_args: ${{ matrix.hub_args }}
args: ${{ matrix.args }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/sonar-cloud-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:

uses: ./.github/workflows/unit-test-with-cfg.yml
with:
build_args: "-DOC_MNT_ENABLED=ON -DOC_WKCORE_ENABLED=ON -DOC_SOFTWARE_UPDATE_ENABLED=ON -DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON -DPLGD_DEV_TIME_ENABLED=ON -DOC_ETAG_ENABLED=ON ${{ matrix.build_args }}"
build_args: "-DOC_MNT_ENABLED=ON -DOC_WKCORE_ENABLED=ON -DOC_SOFTWARE_UPDATE_ENABLED=ON -DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON -DPLGD_DEV_TIME_ENABLED=ON -DOC_ETAG_ENABLED=ON ${{ matrix.build_args }} -DOC_DYNAMIC_ALLOCATION_ENABLED=OFF"
build_type: Debug
coverage: true

Expand All @@ -59,7 +59,7 @@ jobs:
uses: ./.github/workflows/plgd-device-test-with-cfg.yml
with:
name: ${{ matrix.name }}
build_args: "-DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_MNT_ENABLED=ON -DOC_OSCORE_ENABLED=OFF -DPLGD_DEV_TIME_ENABLED=ON -DOC_ETAG_ENABLED=ON -DOC_COVERAGE_ENABLED=ON ${{ matrix.build_args }}"
build_args: "-DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_MNT_ENABLED=ON -DOC_OSCORE_ENABLED=OFF -DPLGD_DEV_TIME_ENABLED=ON -DOC_ETAG_ENABLED=ON -DOC_COVERAGE_ENABLED=ON ${{ matrix.build_args }} -DOC_DYNAMIC_ALLOCATION_ENABLED=OFF"
build_type: Debug
cert_signature_algorithm: ${{ matrix.cert_signature_algorithm }}
cert_elliptic_curve: ${{ matrix.cert_elliptic_curve }}
Expand All @@ -78,7 +78,7 @@ jobs:
uses: ./.github/workflows/plgd-hub-test-with-cfg.yml
with:
name: ${{ matrix.name }}
build_args: "-DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_MNT_ENABLED=ON -DOC_OSCORE_ENABLED=OFF -DPLGD_DEV_TIME_ENABLED=ON -DOC_ETAG_ENABLED=ON -DOC_COVERAGE_ENABLED=ON ${{ matrix.build_args }}"
build_args: "-DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_MNT_ENABLED=ON -DOC_OSCORE_ENABLED=OFF -DPLGD_DEV_TIME_ENABLED=ON -DOC_ETAG_ENABLED=ON -DOC_COVERAGE_ENABLED=ON ${{ matrix.build_args }} -DOC_DYNAMIC_ALLOCATION_ENABLED=OFF"
build_type: Debug
coverage: true
hub_args: ${{ matrix.hub_args }}
Expand All @@ -104,7 +104,7 @@ jobs:
mkdir build && cd build
# sonar-scanner currently cannot handle multi configuration configuration (ie. compilation of the same file with different defines),
# so we enable as many features as possible so we get max. amount of code analysis
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_VERBOSE_MAKEFILE=ON -DOC_CLOUD_ENABLED=ON -DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_MNT_ENABLED=ON -DOC_WKCORE_ENABLED=ON -DOC_SOFTWARE_UPDATE_ENABLED=ON -DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON -DOC_PUSH_ENABLED=ON -DOC_RESOURCE_ACCESS_IN_RFOTM_ENABLED=ON -DPLGD_DEV_TIME_ENABLED=ON -DOC_ETAG_ENABLED=ON -DBUILD_TESTING=ON ..
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_VERBOSE_MAKEFILE=ON -DOC_CLOUD_ENABLED=ON -DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_MNT_ENABLED=ON -DOC_WKCORE_ENABLED=ON -DOC_SOFTWARE_UPDATE_ENABLED=ON -DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON -DOC_PUSH_ENABLED=ON -DOC_RESOURCE_ACCESS_IN_RFOTM_ENABLED=ON -DPLGD_DEV_TIME_ENABLED=ON -DOC_ETAG_ENABLED=ON -DBUILD_TESTING=ON -DOC_DYNAMIC_ALLOCATION_ENABLED=OFF ..
cd ..
# for files defined in multiple cmake targets, sonar-scanner seems to take the configuration from the first compilation of the file,
# so we force client-server target to be compiled first so we get analysis of code with both OC_CLIENT and OC_SERVER enabled
Expand Down
47 changes: 39 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ if(UNIX)
message(STATUS "Address sanitizer enabled")
add_compile_options(${CMAKE_C_FLAGS_DEBUG} -fsanitize=address -fno-omit-frame-pointer)
add_link_options(-fsanitize=address)
set(OC_ASAN_OPTIONS "verbosity=1:debug=true:atexit=true:check_initialization_order=true:detect_stack_use_after_return=true:alloc_dealloc_mismatch=true:detect_invalid_pointer_pairs=2:strict_string_checks=true")
endif()

if(OC_LSAN_ENABLED)
Expand Down Expand Up @@ -956,34 +957,63 @@ if(BUILD_TESTING AND(UNIX OR MINGW))
if (OC_INTROSPECTION_ENABLED AND OC_IDD_API_ENABLED)
set(apitest_files ${PROJECT_SOURCE_DIR}/api/unittest/introspectiontest_IDD.cbor)
endif()
oc_package_add_test(TARGET apitest SOURCES ${COMMONTEST_SRC} ${APITEST_SRC} FILES ${apitest_files})
oc_package_add_test(
TARGET apitest
SOURCES ${COMMONTEST_SRC} ${APITEST_SRC}
FILES ${apitest_files}
ENVIRONMENT "ASAN_OPTIONS=${OC_ASAN_OPTIONS}"
)

file(GLOB TIMESTAMPTEST_SRC api/c-timestamp/unittest/*.cpp)
oc_package_add_test(TARGET timestamptest SOURCES ${TIMESTAMPTEST_SRC})
oc_package_add_test(
TARGET timestamptest
SOURCES ${TIMESTAMPTEST_SRC}
ENVIRONMENT "ASAN_OPTIONS=${OC_ASAN_OPTIONS}"
)

file(GLOB PLATFORMTEST_SRC port/unittest/*.cpp)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/storage_test)
oc_package_add_test(TARGET platformtest SOURCES ${COMMONTEST_SRC} ${PLATFORMTEST_SRC})
oc_package_add_test(
TARGET platformtest
SOURCES ${COMMONTEST_SRC} ${PLATFORMTEST_SRC}
ENVIRONMENT "ASAN_OPTIONS=${OC_ASAN_OPTIONS}"
)

file(GLOB MESSAGINGTEST_SRC messaging/coap/unittest/*.cpp)
oc_package_add_test(TARGET messagingtest SOURCES ${COMMONTEST_SRC} ${MESSAGINGTEST_SRC})
oc_package_add_test(
TARGET messagingtest
SOURCES ${COMMONTEST_SRC} ${MESSAGINGTEST_SRC}
ENVIRONMENT "ASAN_OPTIONS=${OC_ASAN_OPTIONS}"
)

if(OC_SECURITY_ENABLED)
file(GLOB SECURITYTEST_SRC security/unittest/*.cpp)
oc_package_add_test(TARGET securitytest SOURCES ${COMMONTEST_SRC} ${SECURITYTEST_SRC})
oc_package_add_test(
TARGET securitytest
SOURCES ${COMMONTEST_SRC} ${SECURITYTEST_SRC}
ENVIRONMENT "ASAN_OPTIONS=${OC_ASAN_OPTIONS}"
)

file(COPY ${PROJECT_SOURCE_DIR}/apps/pki_certs
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
)
endif()

file(GLOB UTILTEST_SRC util/unittest/*.cpp)
oc_package_add_test(TARGET utiltest SOURCES ${COMMONTEST_SRC} ${UTILTEST_SRC})
oc_package_add_test(
TARGET utiltest
SOURCES ${COMMONTEST_SRC} ${UTILTEST_SRC}
ENVIRONMENT "ASAN_OPTIONS=${OC_ASAN_OPTIONS}"
)

if(OC_CLOUD_ENABLED)
file(GLOB CLOUDTEST_SRC api/cloud/unittest/*.cpp)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/storage_cloud)
oc_package_add_test(TARGET cloudtest SOURCES ${COMMONTEST_SRC} ${CLOUDTEST_SRC})
oc_package_add_test(
TARGET cloudtest
SOURCES ${COMMONTEST_SRC} ${CLOUDTEST_SRC}
ENVIRONMENT "ASAN_OPTIONS=${OC_ASAN_OPTIONS}"
)
endif()

if(UNIX AND NOT OC_TSAN_ENABLED)
Expand All @@ -997,7 +1027,7 @@ if(BUILD_TESTING AND(UNIX OR MINGW))
oc_package_add_test(
TARGET faketimetest
SOURCES ${COMMONTEST_SRC} ${FAKETIMETEST_SRC}
ENVIRONMENT "ASAN_OPTIONS=verify_asan_link_order=0"
ENVIRONMENT "ASAN_OPTIONS=${OC_ASAN_OPTIONS}:verify_asan_link_order=0"
"LD_PRELOAD=/usr/local/lib/faketime/libfaketimeMT.so.1"
"FAKETIME_DONT_FAKE_MONOTONIC=1"
"FAKETIME_TIMESTAMP_FILE="
Expand All @@ -1015,6 +1045,7 @@ if(BUILD_TESTING AND(UNIX OR MINGW))
oc_package_add_test(
TARGET faketimetest
SOURCES ${COMMONTEST_SRC} ${FAKETIMETEST_SRC}
ENVIRONMENT "ASAN_OPTIONS=${OC_ASAN_OPTIONS}"
)
endif()

Expand Down
8 changes: 4 additions & 4 deletions api/oc_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@ message_deallocate(oc_message_t *message, struct oc_memb *pool)
#if defined(OC_DYNAMIC_ALLOCATION) && !defined(OC_INOUT_BUFFER_SIZE)
free(message->data);
#endif /* OC_DYNAMIC_ALLOCATION && !OC_INOUT_BUFFER_SIZE */
oc_network_event_handler_mutex_lock();
// oc_network_event_handler_mutex_lock();
oc_memb_free(pool, message);
oc_network_event_handler_mutex_unlock();
// oc_network_event_handler_mutex_unlock();
}

static oc_message_t *
message_allocate_with_size(struct oc_memb *pool, size_t size)
{
oc_network_event_handler_mutex_lock();
// oc_network_event_handler_mutex_lock();
oc_message_t *message = (oc_message_t *)oc_memb_alloc(pool);
oc_network_event_handler_mutex_unlock();
// oc_network_event_handler_mutex_unlock();
if (message == NULL) {
#if !defined(OC_DYNAMIC_ALLOCATION) || defined(OC_INOUT_BUFFER_SIZE)
OC_WRN("buffer: No free TX/RX buffers!");
Expand Down
10 changes: 8 additions & 2 deletions api/oc_endpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ oc_endpoint_t *
oc_new_endpoint(void)
{
#ifndef OC_DYNAMIC_ALLOCATION
oc_network_event_handler_mutex_lock();
// oc_network_event_handler_mutex_lock();
#endif /* !OC_DYNAMIC_ALLOCATION */
oc_endpoint_t *endpoint = (oc_endpoint_t *)oc_memb_alloc(&oc_endpoints_s);
#ifndef OC_DYNAMIC_ALLOCATION
oc_network_event_handler_mutex_unlock();
// oc_network_event_handler_mutex_unlock();
#endif /* !OC_DYNAMIC_ALLOCATION */
return endpoint;
}
Expand All @@ -57,7 +57,13 @@ void
oc_free_endpoint(oc_endpoint_t *endpoint)
{
if (endpoint) {
#ifndef OC_DYNAMIC_ALLOCATION
// oc_network_event_handler_mutex_lock();
#endif /* !OC_DYNAMIC_ALLOCATION */
oc_memb_free(&oc_endpoints_s, endpoint);
#ifndef OC_DYNAMIC_ALLOCATION
// oc_network_event_handler_mutex_unlock();
#endif /* !OC_DYNAMIC_ALLOCATION */
}
}

Expand Down
4 changes: 4 additions & 0 deletions api/oc_resource_factory_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#ifndef OC_RESOURCE_FACTORY_INTERNAL_H
#define OC_RESOURCE_FACTORY_INTERNAL_H

#if defined(OC_COLLECTIONS) && defined(OC_COLLECTIONS_IF_CREATE)

#include "oc_api.h"

#ifdef __cplusplus
Expand Down Expand Up @@ -62,4 +64,6 @@ void oc_fi_factory_free_all_created_resources(void);
}
#endif

#endif /* OC_COLLECTIONS && OC_COLLECTIONS_IF_CREATE */

#endif /* OC_RESOURCE_FACTORY_INTERNAL_H */
8 changes: 4 additions & 4 deletions api/oc_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ OC_MEMB(g_oc_tcp_on_connect_event_s, oc_tcp_on_connect_event_t,
static oc_tcp_on_connect_event_t *
oc_tcp_on_connect_event_allocate(void)
{
oc_network_event_handler_mutex_lock();
// oc_network_event_handler_mutex_lock();
oc_tcp_on_connect_event_t *event =
(oc_tcp_on_connect_event_t *)oc_memb_alloc(&g_oc_tcp_on_connect_event_s);
oc_network_event_handler_mutex_unlock();
// oc_network_event_handler_mutex_unlock();
return event;
}

Expand All @@ -71,9 +71,9 @@ oc_tcp_on_connect_event_free(oc_tcp_on_connect_event_t *event)
if (event == NULL) {
return;
}
oc_network_event_handler_mutex_lock();
// oc_network_event_handler_mutex_lock();
oc_memb_free(&g_oc_tcp_on_connect_event_s, event);
oc_network_event_handler_mutex_unlock();
// oc_network_event_handler_mutex_unlock();
}

#endif /* OC_HAS_FEATURE_TCP_ASYNC_CONNECT */
Expand Down
5 changes: 3 additions & 2 deletions docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ mkdir -p /tmp/logbt-coredumps
pids=()
echo "called_from_lib:libfaketimeMT.so.1" > /tmp/tsan.suppressions
for ((i=0;i<$NUM_DEVICES;i++)); do
export ASAN_OPTIONS="atexit=1:log_path=/tmp/${i}.asan.log:verify_asan_link_order=0"
# verify_asan_link_order=0 is needed when using libfaketimeMT.so.1
export ASAN_OPTIONS="verbosity=1:debug=true:atexit=true:check_initialization_order=true:detect_stack_use_after_return=true:alloc_dealloc_mismatch=true:detect_invalid_pointer_pairs=2:strict_string_checks=true:log_path=/tmp/${i}.asan.log:verify_asan_link_order=0"
# abort on first tsan problem found
export TSAN_OPTIONS="halt_on_error=1:abort_on_error=1:log_path=/tmp/${i}.tsan.log:suppressions=/tmp/tsan.suppressions"
export TSAN_OPTIONS="verbosity=1:halt_on_error=1:abort_on_error=1:log_path=/tmp/${i}.tsan.log:suppressions=/tmp/tsan.suppressions"
export LD_PRELOAD=/usr/local/lib/faketime/libfaketimeMT.so.1
${PREFIX_EXEC} /iotivity-lite/port/linux/service $@ > /tmp/$i.log 2>&1 &
pids+=($!)
Expand Down
4 changes: 2 additions & 2 deletions security/oc_pstat.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
#include "api/cloud/oc_cloud_internal.h"
#endif /* OC_CLOUD */

#ifdef OC_COLLECTIONS_IF_CREATE
#if defined(OC_COLLECTIONS) && defined(OC_COLLECTIONS_IF_CREATE)
#include "api/oc_resource_factory_internal.h"
#endif /* OC_COLLECTIONS_IF_CREATE */
#endif /* OC_COLLECTIONS && OC_COLLECTIONS_IF_CREATE */

#ifdef OC_SOFTWARE_UPDATE
#include "api/oc_swupdate_internal.h"
Expand Down
2 changes: 1 addition & 1 deletion security/oc_tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ tls_process_drop_event_for_removed_endpoint(oc_process_event_t ev,
static void
tls_drop_endpoint_events(const oc_endpoint_t *endpoint)
{
// oc_network_drop_receive_events(endpoint);
oc_network_drop_receive_events(endpoint);

oc_process_drop(&oc_tls_handler, tls_process_drop_event_for_removed_endpoint,
endpoint);
Expand Down

0 comments on commit 0958984

Please sign in to comment.