Skip to content
Open
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
11 changes: 3 additions & 8 deletions rust/Cargo.lock.in

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions rust/suricatasc/Cargo.toml.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ serde_json = { version = "1.0.140", default-features = false, features = ["prese

# Pinned back to support Rust 1.75.0. Not used directly by us, but by rustyline.
home = { version = "=0.5.9" }

# Pinned back to support Rust 1.75.0. Not used directly by us, but by serde_json.
indexmap = { version = "=2.11.4" }
9 changes: 9 additions & 0 deletions src/detect-engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -2303,6 +2303,7 @@ static void InjectPackets(
*
* If called in unix socket mode, it's possible that we don't have
* detect threads yet.
* NOTE: master MUST be locked before calling this
*
* \retval -1 error
* \retval 0 no detection threads
Expand Down Expand Up @@ -3152,6 +3153,9 @@ static TmEcode DetectEngineThreadCtxInitForMT(ThreadVars *tv, DetectEngineThread
uint32_t max_tenant_id = 0;
DetectEngineCtx *list = master->list;

DEBUG_VALIDATE_BUG_ON(!SCMutexIsLocked(&master->lock));

/* coverity[missing_lock] */
if (master->tenant_selector == TENANT_SELECTOR_UNKNOWN) {
SCLogError("no tenant selector set: "
"set using multi-detect.selector");
Expand Down Expand Up @@ -4859,8 +4863,13 @@ int DetectEngineReload(const SCInstance *suri)
DetectEngineDeReference(&old_de_ctx);

SCLogDebug("going to reload the threads to use new_de_ctx %p", new_de_ctx);

DetectEngineMasterCtx *master = &g_master_de_ctx;
SCMutexLock(&master->lock);
/* update the threads */
DetectEngineReloadThreads(new_de_ctx);
SCMutexUnlock(&master->lock);

SCLogDebug("threads now run new_de_ctx %p", new_de_ctx);

/* walk free list, freeing the old_de_ctx */
Expand Down
1 change: 1 addition & 0 deletions src/threads-debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
#define SCMutexInit(mut, mutattrs) SCMutexInit_dbg(mut, mutattrs)
#define SCMutexLock(mut) SCMutexLock_dbg(mut)
#define SCMutexTrylock(mut) SCMutexTrylock_dbg(mut)
#define SCMutexIsLocked(mut) (SCMutexTrylock(mut) == EBUSY)
#define SCMutexUnlock(mut) SCMutexUnlock_dbg(mut)
#define SCMutexDestroy pthread_mutex_destroy
#define SCMUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
Expand Down
1 change: 1 addition & 0 deletions src/threads-profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ extern thread_local uint64_t mutex_lock_cnt;
#define SCMutexInit(mut, mutattr ) pthread_mutex_init(mut, mutattr)
#define SCMutexLock(mut) SCMutexLock_profile(mut)
#define SCMutexTrylock(mut) pthread_mutex_trylock(mut)
#define SCMutexIsLocked(mut) (SCMutexTrylock(mut) == EBUSY)
#define SCMutexUnlock(mut) pthread_mutex_unlock(mut)
#define SCMutexDestroy pthread_mutex_destroy
#define SCMUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
Expand Down
1 change: 1 addition & 0 deletions src/threads.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ static int ThreadMacrosTest01Mutex(void)
r |= SCMutexInit(&mut, NULL);
r |= SCMutexLock(&mut);
r |= (SCMutexTrylock(&mut) == EBUSY)? 0 : 1;
r |= SCMutexIsLocked(&mut) ? 0 : 1;
r |= SCMutexUnlock(&mut);
r |= SCMutexDestroy(&mut);

Expand Down
1 change: 1 addition & 0 deletions src/threads.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ enum {
#define SCMutexInit(mut, mutattr ) pthread_mutex_init(mut, mutattr)
#define SCMutexLock(mut) pthread_mutex_lock(mut)
#define SCMutexTrylock(mut) pthread_mutex_trylock(mut)
#define SCMutexIsLocked(mut) (SCMutexTrylock(mut) == EBUSY)
#define SCMutexUnlock(mut) pthread_mutex_unlock(mut)
#define SCMutexDestroy pthread_mutex_destroy
#define SCMUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
Expand Down
Loading