Skip to content

Incorrect log unlock #2464

@marcstern

Description

@marcstern

In modsecurity.c, line 143, a lock can fail:

rc = apr_global_mutex_create(&msce->auditlog_lock, auditlog_lock_name, APR_LOCK_DEFAULT, mp);
if (rc != APR_SUCCESS) {
    //ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, "mod_security: Could not create modsec_auditlog_lock");
    //return HTTP_INTERNAL_SERVER_ERROR;
    return -1;
}

In msc_logging.c, line1454, we always try to unlock it:
rc = apr_global_mutex_unlock(msr->modsecurity->auditlog_lock);
This leads to errors in the log.

We should add a watchdog:

+ msce->auditlog_lock = NULL;
rc = apr_global_mutex_create(&msce->auditlog_lock,...

+ if (msr->modsecurity->auditlog_lock) {
rc = apr_global_mutex_unlock(msr->modsecurity->auditlog_lock);
...
+ }

Metadata

Metadata

Assignees

Labels

2.xRelated to ModSecurity version 2.x

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions