diff --git a/src/lib/core/fiber.c b/src/lib/core/fiber.c index 03a2af4b4715d28dc79998ebc52ab5fc55bb6c16..d130e7dbe9c973661b1acd385c425e133f75625c 100644 --- a/src/lib/core/fiber.c +++ b/src/lib/core/fiber.c @@ -186,19 +186,27 @@ fiber_madvise(void *addr, size_t len, int advice) static inline int fiber_mprotect(void *addr, size_t len, int prot) { - int rc = 0; - + (void)addr; + (void)len; + (void)prot; struct errinj *inj = errinj(ERRINJ_FIBER_MPROTECT, ERRINJ_INT); if (inj != NULL && inj->iparam == prot) { errno = ENOMEM; - rc = -1; - } - - if (rc != 0 || mprotect(addr, len, prot) != 0) { - diag_set(SystemError, "fiber mprotect failed"); - return -1; + goto error; } +/* + * TODO(gh-8423) Disable mprotect temporarily. Leak sanitizer does not work + * well if memory is protected. We fail to remove protection due to the use of + * `cord_cancel_and_join` to cancel cords. + */ +#ifndef ENABLE_ASAN + if (mprotect(addr, len, prot) != 0) + goto error; +#endif return 0; +error: + diag_set(SystemError, "fiber mprotect failed"); + return -1; } /** diff --git a/test/unit/guard.cc b/test/unit/guard.cc index d04f22f6c4f6d55c908a38ab5df45c8117e914f5..14a4afc6a1afe70ad3416cbef4d40cf38223adda 100644 --- a/test/unit/guard.cc +++ b/test/unit/guard.cc @@ -1,5 +1,7 @@ #include "memory.h" #include "fiber.h" + +#define UNIT_TAP_COMPATIBLE 1 #include "unit.h" static struct fiber_attr default_attr; @@ -7,8 +9,9 @@ static struct fiber_attr default_attr; static void sigsegf_handler(int signo) { - note("signal handler called"); - exit(0); + ok(true); + footer(); + exit(check_plan()); } /* @@ -54,6 +57,10 @@ main_f(va_list ap) int main() { + plan(1); + header(); + +#ifndef ENABLE_ASAN memory_init(); fiber_init(fiber_cxx_invoke); fiber_attr_create(&default_attr); @@ -62,6 +69,10 @@ int main() ev_run(loop(), 0); fiber_free(); memory_free(); - fail("signal handler was not executed", ""); - return 0; +#else + ok(true); +#endif + + footer(); + return check_plan(); } diff --git a/test/unit/guard.result b/test/unit/guard.result deleted file mode 100644 index bc9889d425b6a79930a98b9e691bcabfaddd3690..0000000000000000000000000000000000000000 --- a/test/unit/guard.result +++ /dev/null @@ -1 +0,0 @@ -# signal handler called