Fix QuicTraceRundown Race Condition (#2915)

This commit is contained in:
Nick Banks 2022-07-27 13:23:55 -05:00 коммит произвёл GitHub
Родитель 6583df53c0
Коммит d50ee4b831
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 12 добавлений и 6 удалений

Просмотреть файл

@ -65,6 +65,7 @@ MsQuicConnectionOpen(
QuicConnAlloc( QuicConnAlloc(
Registration, Registration,
NULL, NULL,
NULL,
&Connection); &Connection);
if (QUIC_FAILED(Status)) { if (QUIC_FAILED(Status)) {
goto Error; goto Error;
@ -73,8 +74,6 @@ MsQuicConnectionOpen(
Connection->ClientCallbackHandler = Handler; Connection->ClientCallbackHandler = Handler;
Connection->ClientContext = Context; Connection->ClientContext = Context;
QuicRegistrationQueueNewConnection(Registration, Connection);
*NewConnection = (HQUIC)Connection; *NewConnection = (HQUIC)Connection;
Status = QUIC_STATUS_SUCCESS; Status = QUIC_STATUS_SUCCESS;

Просмотреть файл

@ -1289,6 +1289,7 @@ QuicBindingCreateConnection(
QUIC_STATUS Status = QUIC_STATUS Status =
QuicConnAlloc( QuicConnAlloc(
MsQuicLib.StatelessRegistration, MsQuicLib.StatelessRegistration,
Worker,
Datagram, Datagram,
&NewConnection); &NewConnection);
if (QUIC_FAILED(Status)) { if (QUIC_FAILED(Status)) {
@ -1296,8 +1297,6 @@ QuicBindingCreateConnection(
return NULL; return NULL;
} }
QuicWorkerAssignConnection(Worker, NewConnection);
BOOLEAN BindingRefAdded = FALSE; BOOLEAN BindingRefAdded = FALSE;
CXPLAT_DBG_ASSERT(NewConnection->SourceCids.Next != NULL); CXPLAT_DBG_ASSERT(NewConnection->SourceCids.Next != NULL);
QUIC_CID_HASH_ENTRY* SourceCid = QUIC_CID_HASH_ENTRY* SourceCid =

Просмотреть файл

@ -57,6 +57,7 @@ _Success_(return == QUIC_STATUS_SUCCESS)
QUIC_STATUS QUIC_STATUS
QuicConnAlloc( QuicConnAlloc(
_In_ QUIC_REGISTRATION* Registration, _In_ QUIC_REGISTRATION* Registration,
_In_opt_ QUIC_WORKER* Worker,
_In_opt_ const CXPLAT_RECV_DATA* const Datagram, _In_opt_ const CXPLAT_RECV_DATA* const Datagram,
_Outptr_ _At_(*NewConnection, __drv_allocatesMem(Mem)) _Outptr_ _At_(*NewConnection, __drv_allocatesMem(Mem))
QUIC_CONNECTION** NewConnection QUIC_CONNECTION** NewConnection
@ -262,6 +263,9 @@ QuicConnAlloc(
} }
QuicPathValidate(Path); QuicPathValidate(Path);
if (Worker != NULL) {
QuicWorkerAssignConnection(Worker, Connection);
}
if (!QuicConnRegister(Connection, Registration)) { if (!QuicConnRegister(Connection, Registration)) {
Status = QUIC_STATUS_INVALID_STATE; Status = QUIC_STATUS_INVALID_STATE;
goto Error; goto Error;
@ -572,6 +576,9 @@ QuicConnRegister(
CxPlatDispatchLockAcquire(&Registration->ConnectionLock); CxPlatDispatchLockAcquire(&Registration->ConnectionLock);
RegistrationShuttingDown = Registration->ShuttingDown; RegistrationShuttingDown = Registration->ShuttingDown;
if (!RegistrationShuttingDown) { if (!RegistrationShuttingDown) {
if (Connection->Worker == NULL) {
QuicRegistrationQueueNewConnection(Registration, Connection);
}
CxPlatListInsertTail(&Registration->Connections, &Connection->RegistrationLink); CxPlatListInsertTail(&Registration->Connections, &Connection->RegistrationLink);
} }
CxPlatDispatchLockRelease(&Registration->ConnectionLock); CxPlatDispatchLockRelease(&Registration->ConnectionLock);

Просмотреть файл

@ -957,6 +957,7 @@ _Success_(return == QUIC_STATUS_SUCCESS)
QUIC_STATUS QUIC_STATUS
QuicConnAlloc( QuicConnAlloc(
_In_ QUIC_REGISTRATION* Registration, _In_ QUIC_REGISTRATION* Registration,
_In_opt_ QUIC_WORKER* Worker,
_In_opt_ const CXPLAT_RECV_DATA* const Datagram, _In_opt_ const CXPLAT_RECV_DATA* const Datagram,
_Outptr_ _At_(*NewConnection, __drv_allocatesMem(Mem)) _Outptr_ _At_(*NewConnection, __drv_allocatesMem(Mem))
QUIC_CONNECTION** NewConnection QUIC_CONNECTION** NewConnection

Просмотреть файл

@ -381,7 +381,7 @@ QuicRegistrationSettingsChanged(
CxPlatLockRelease(&Registration->ConfigLock); CxPlatLockRelease(&Registration->ConfigLock);
} }
_IRQL_requires_max_(PASSIVE_LEVEL) _IRQL_requires_max_(DISPATCH_LEVEL)
BOOLEAN BOOLEAN
QuicRegistrationAcceptConnection( QuicRegistrationAcceptConnection(
_In_ QUIC_REGISTRATION* Registration, _In_ QUIC_REGISTRATION* Registration,

Просмотреть файл

@ -136,7 +136,7 @@ QuicRegistrationSettingsChanged(
// Determines whether this new connection can be accepted by the registration // Determines whether this new connection can be accepted by the registration
// or not. // or not.
// //
_IRQL_requires_max_(PASSIVE_LEVEL) _IRQL_requires_max_(DISPATCH_LEVEL)
BOOLEAN BOOLEAN
QuicRegistrationAcceptConnection( QuicRegistrationAcceptConnection(
_In_ QUIC_REGISTRATION* Registration, _In_ QUIC_REGISTRATION* Registration,