Compare commits

...

3 Commits

Author SHA1 Message Date
e98aae7e7e Qutex:backoff: Fix use after free 2026-03-05 20:02:55 -04:00
dab5477249 Qutex: fix use after free 2026-03-05 19:53:21 -04:00
8af362c791 PuppetApp: exitAllThreads should call its own final segment
Previously it called the executeGenericOpOn which didn't call join()
on threads
2026-03-05 19:47:51 -04:00
2 changed files with 6 additions and 6 deletions

View File

@@ -197,7 +197,7 @@ void PuppetApplication::exitAllPuppetThreadsReq(
{ {
thread->exitThreadReq( thread->exitThreadReq(
{request, std::bind( {request, std::bind(
&PuppetThreadLifetimeMgmtOp::executeGenericOpOnAllPuppetThreadsReq1, &PuppetThreadLifetimeMgmtOp::exitAllPuppetThreadsReq1,
request.get(), request)}); request.get(), request)});
} }
} }

View File

@@ -253,7 +253,7 @@ void Qutex::backoff(
#ifdef CONFIG_ENABLE_DEBUG_LOCKS #ifdef CONFIG_ENABLE_DEBUG_LOCKS
currOwner = nullptr; currOwner = nullptr;
#endif #endif
LockerAndInvokerBase &newFront = *queue.front(); std::shared_ptr<LockerAndInvokerBase> newFront = queue.front();
lock.release(); lock.release();
@@ -268,7 +268,7 @@ void Qutex::backoff(
* Hence there ought to be no way for the failedAcquirer to be at the front * Hence there ought to be no way for the failedAcquirer to be at the front
* of the queue at this point UNLESS the queue has only one item in it. * of the queue at this point UNLESS the queue has only one item in it.
*/ */
if (newFront == failedAcquirer && nQItems > 1) if (*newFront == failedAcquirer && nQItems > 1)
{ {
throw std::runtime_error( throw std::runtime_error(
std::string(__func__) + std::string(__func__) +
@@ -304,7 +304,7 @@ void Qutex::backoff(
* is backing off of a qutex within which it's the only waiter. * is backing off of a qutex within which it's the only waiter.
*/ */
if (nQItems > 1) { if (nQItems > 1) {
newFront.awaken(); newFront->awaken();
} }
} }
@@ -370,11 +370,11 @@ void Qutex::release()
* *
* Therefore we must always awaken the front item when releas()ing. * Therefore we must always awaken the front item when releas()ing.
*/ */
LockerAndInvokerBase &front = *queue.front(); std::shared_ptr<LockerAndInvokerBase> front = queue.front();
lock.release(); lock.release();
front.awaken(); front->awaken();
} }
} // namespace sscl } // namespace sscl