Add address sanitizer patch. sync
authorHussein Kasem <huss@pep-project.org>
Fri, 24 May 2019 20:10:37 +0200
branchsync
changeset 374237d915105396
parent 3741 6f92319aefbb
child 3744 2333b0b01c8c
child 3837 28c820987e41
Add address sanitizer patch.
build-android/enable_address_sanitizer.patch
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/build-android/enable_address_sanitizer.patch	Fri May 24 20:10:37 2019 +0200
     1.3 @@ -0,0 +1,92 @@
     1.4 +diff --git a/build-android/jni/Android.mk b/build-android/jni/Android.mk
     1.5 +--- a/build-android/jni/Android.mk
     1.6 ++++ b/build-android/jni/Android.mk
     1.7 +@@ -14,7 +14,9 @@
     1.8 + 
     1.9 + LOCAL_MODULE    := pEpEngine
    1.10 + LOCAL_CFLAGS    += -std=c99
    1.11 +-
    1.12 ++#LOCAL_CFLAGS    += -fsanitize=address -fno-omit-frame-pointer
    1.13 ++#LOCAL_LDFLAGS   += -fsanitize=address
    1.14 ++#LOCAL_ARM_MODE := arm
    1.15 + # from http://www.sqlite.org/android/finfo?name=jni/sqlite/Android.mk 
    1.16 + #      http://www.sqlite.org/android/artifact/e8ed354b3e58c835
    1.17 + 
    1.18 +@@ -28,6 +30,7 @@
    1.19 +                     $(GPGME_INCLUDE_PATH) \
    1.20 +                     $(LIBETPAN_PATH)/include
    1.21 + LOCAL_C_INCLUDES += $(GPGBUILD)/$(TARGET_ARCH_ABI)/app_opt/include
    1.22 ++LOCAL_C_INCLUDES += /home/huss/src/test/sequoia/openpgp-ffi/include
    1.23 + 
    1.24 + $(shell sh $(LOCAL_PATH)/../takeOutHeaderFiles.sh $(LOCAL_PATH)../../)
    1.25 + LOCAL_EXPORT_C_INCLUDES += $(LOCAL_PATH)../include
    1.26 +@@ -38,5 +41,6 @@
    1.27 + ASN1_SRC_FILES := $(wildcard $(LOCAL_PATH)/../../asn.1/*.c)
    1.28 + LOCAL_SRC_FILES := $(ENGINE_SRC_FILES:%=%)  $(ASN1_SRC_FILES:$(LOCAL_PATH)/%=%)
    1.29 + 
    1.30 ++#LOCAL_ADDRESS_SANITIZER:=true
    1.31 + 
    1.32 + include $(BUILD_STATIC_LIBRARY)
    1.33 +diff --git a/src/pEpEngine.c b/src/pEpEngine.c
    1.34 +--- a/src/pEpEngine.c
    1.35 ++++ b/src/pEpEngine.c
    1.36 +@@ -2015,7 +2015,7 @@
    1.37 + // N.B. If testing (so NDEBUG not defined) but this message is spam,
    1.38 + //      put -D_PEP_SERVICE_LOG_OFF into CFLAGS/CXXFLAGS     
    1.39 + #if !defined(NDEBUG) && !defined(_PEP_SERVICE_LOG_OFF)
    1.40 +-    fprintf(stdout, "\n*** %s %s %s %s\n", title, entity, description, comment);
    1.41 ++    __android_log_print(ANDROID_LOG_DEBUG, "pEpEngine", " %s :: %s :: %s :: %s ", title, entity, description, comment);
    1.42 +     session->service_log = true;
    1.43 + #endif
    1.44 + 
    1.45 +diff --git a/sync/gen_dot.ysl2 b/sync/gen_dot.ysl2
    1.46 +--- a/sync/gen_dot.ysl2
    1.47 ++++ b/sync/gen_dot.ysl2
    1.48 +@@ -9,7 +9,7 @@
    1.49 +     digraph finite_state_machine {
    1.50 +         rankdir=LR;
    1.51 +         node [shape = doublecircle];
    1.52 +-        `apply "state[@end='1']" mode=end`;
    1.53 ++        `apply "state[@timeout='off']" mode=end`;
    1.54 +         node [shape = circle];
    1.55 + 
    1.56 +         `` apply "state" mode=do
    1.57 +diff --git a/sync/sync.fsm b/sync/sync.fsm
    1.58 +--- a/sync/sync.fsm
    1.59 ++++ b/sync/sync.fsm
    1.60 +@@ -155,7 +155,7 @@
    1.61 +                 go HandshakingNewPhase2Second;
    1.62 +         }
    1.63 + 
    1.64 +-        state HandshakingNewPhase1First {
    1.65 ++        state HandshakingNewPhase1First timeout=300 {
    1.66 +             on Rollback if sameTransactionAndPartner {
    1.67 +                 do untrustThisKey;
    1.68 +                 go Sole;
    1.69 +@@ -172,7 +172,7 @@
    1.70 +             }
    1.71 +         }
    1.72 + 
    1.73 +-        state HandshakingNewPhase1Second {
    1.74 ++        state HandshakingNewPhase1Second timeout=300 {
    1.75 +             on Rollback if sameTransactionAndPartner {
    1.76 +                 do untrustThisKey;
    1.77 +                 go Sole;
    1.78 +@@ -189,7 +189,7 @@
    1.79 +             }
    1.80 +         }
    1.81 + 
    1.82 +-        state HandshakingNewPhase2First {
    1.83 ++        state HandshakingNewPhase2First timeout=300 {
    1.84 +             on Cancel {
    1.85 +                 send Rollback;
    1.86 +                 go Sole;
    1.87 +@@ -208,7 +208,7 @@
    1.88 +             }
    1.89 +         }
    1.90 + 
    1.91 +-        state HandshakingNewPhase2Second {
    1.92 ++        state HandshakingNewPhase2Second timeout=300 {
    1.93 +             on Cancel {
    1.94 +                 send Rollback;
    1.95 +                 go Sole;