Skip to content

An improper locking bug on the lock NewThread->StartMutex #167

@ryancaicse

Description

@ryancaicse

Hi, developers, thank you for your checking. It seems the lock NewThread->StartMutex is not released correctly when !KSUCCESS(KernelStatus)?

pthread_mutex_lock(&(NewThread->StartMutex));
//
// Block all possible signals in the new thread while it sets itself up,
// including the internal signals.
//
FILL_SIGNAL_SET(InternalSignals);
NewThread->SignalMask = OsSetSignalBehavior(SignalMaskBlocked,
SignalMaskOperationOverwrite,
&InternalSignals);
KernelStatus = OsCreateThread(NULL,
0,
ClpThreadStart,
NewThread,
NewThread->Attribute.StackBase,
NewThread->Attribute.StackSize,
NewThread->OsData,
&(NewThread->ThreadId));
OsSetSignalBehavior(SignalMaskBlocked,
SignalMaskOperationOverwrite,
&(NewThread->SignalMask));
if (!KSUCCESS(KernelStatus)) {
Status = ClConvertKstatusToErrorNumber(KernelStatus);
ClpDestroyThreadKeyData(NewThread);
ClpDestroyThread(NewThread);
return Status;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions