aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/regexp.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-24 13:19:05 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-24 13:19:05 +0000
commitd7f2ae66c4598624ffec2713327749cd0760c206 (patch)
treecd3c2cd33ec157d5924db5d05cea5165ae55375b /src/libutil/regexp.c
parent42dde66aa6a2e3ef225af67676d0d728e8e9cdc4 (diff)
downloadrspamd-d7f2ae66c4598624ffec2713327749cd0760c206.tar.gz
rspamd-d7f2ae66c4598624ffec2713327749cd0760c206.zip
Temporary disable JIT when using valgrind
Diffstat (limited to 'src/libutil/regexp.c')
-rw-r--r--src/libutil/regexp.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/libutil/regexp.c b/src/libutil/regexp.c
index 02f734d66..b7d461b3e 100644
--- a/src/libutil/regexp.c
+++ b/src/libutil/regexp.c
@@ -601,7 +601,7 @@ rspamd_regexp_search (rspamd_regexp_t *re, const gchar *text, gsize len,
g_assert (remain > 0);
g_assert (mt != NULL);
- if (st != NULL && !(re->flags & RSPAMD_REGEXP_FLAG_DISABLE_JIT)) {
+ if (st != NULL && !(re->flags & RSPAMD_REGEXP_FLAG_DISABLE_JIT) && can_jit) {
rc = pcre_jit_exec (r, ext, mt, remain, 0, 0, ovec,
ncaptures, st);
}
@@ -713,7 +713,7 @@ rspamd_regexp_search (rspamd_regexp_t *re, const gchar *text, gsize len,
match_data = pcre2_match_data_create (re->ncaptures + 1, NULL);
#ifdef HAVE_PCRE_JIT
- if (!(re->flags & RSPAMD_REGEXP_FLAG_DISABLE_JIT)) {
+ if (!(re->flags & RSPAMD_REGEXP_FLAG_DISABLE_JIT) && can_jit) {
if (!g_utf8_validate (mt, remain, NULL)) {
msg_err ("bad utf8 input for JIT re");
return FALSE;
@@ -1089,7 +1089,13 @@ rspamd_regexp_library_init (void)
#endif /* WITH_PCRE2 */
- can_jit = TRUE;
+ if (getenv ("VALGRIND") == NULL) {
+ can_jit = TRUE;
+ }
+ else {
+ msg_info ("disabling PCRE jit as it does not play well with valgrind");
+ can_jit = FALSE;
+ }
}
else {
msg_info ("pcre is compiled without JIT support, so many optimizations"