Skip to content

Removed unnecessary lock to call acmp_process_quick in Pm::evaluate #3227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -316,23 +316,6 @@ AC_ARG_ENABLE(parser-generation,
[buildParser=false]
)

# Mutex
AC_ARG_ENABLE(mutex-on-pm,
[AS_HELP_STRING([--enable-mutex-on-pm],[Treats pm operations as a critical section])],

[case "${enableval}" in
yes) mutexPm=true ;;
no) mutexPm=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-mutex-on-pm) ;;
esac],

[mutexPm=false]
)
if test "$mutexPm" == "true"; then
MODSEC_MUTEX_ON_PM="-DMUTEX_ON_PM=1"
AC_SUBST(MODSEC_MUTEX_ON_PM)
fi


if test $buildParser = true; then
AC_PROG_YACC
Expand Down
1 change: 0 additions & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@ libmodsecurity_la_CPPFLAGS = \
$(GEOIP_CFLAGS) \
$(GLOBAL_CPPFLAGS) \
$(MODSEC_NO_LOGS) \
$(MODSEC_MUTEX_ON_PM) \
$(YAJL_CFLAGS) \
$(LMDB_CFLAGS) \
$(PCRE_CFLAGS) \
Expand Down
7 changes: 0 additions & 7 deletions src/operators/pm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,7 @@ bool Pm::evaluate(Transaction *transaction, RuleWithActions *rule,
pt.parser = m_p;
pt.ptr = NULL;
const char *match = NULL;
#ifdef MODSEC_MUTEX_ON_PM
{
const std::lock_guard lock(m_mutex);
#endif
rc = acmp_process_quick(&pt, &match, input.c_str(), input.length());
#ifdef MODSEC_MUTEX_ON_PM
}
#endif

if (rc >= 0 && transaction) {
std::string match_(match?match:"");
Expand Down
6 changes: 0 additions & 6 deletions src/operators/pm.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@ class Pm : public Operator {

protected:
ACMP *m_p;

#ifdef MODSEC_MUTEX_ON_PM

private:
std::mutex m_mutex;
#endif
};


Expand Down
Loading