Sam Gross
1b2301c009
[3.13] gh-148820: Fix _PyRawMutex use-after-free on spurious semaphore wakeup (gh-148852) ( #148885 )
...
_PyRawMutex_UnlockSlow CAS-removes the waiter from the list and then
calls _PySemaphore_Wakeup, with no handshake. If _PySemaphore_Wait
returns Py_PARK_INTR, the waiter can destroy its stack-allocated
semaphore before the unlocker's Wakeup runs, causing a fatal error from
ReleaseSemaphore / sem_post.
Loop in _PyRawMutex_LockSlow until _PySemaphore_Wait returns Py_PARK_OK,
which is only signalled when a matching Wakeup has been observed.
Also include GetLastError() and the handle in the Windows fatal messages
in _PySemaphore_Init, _PySemaphore_Wait, and _PySemaphore_Wakeup to make
similar races easier to diagnose in the future.
(cherry picked from commit ad3c5b7958 )
2026-04-22 18:56:24 +00:00
..
2025-10-08 22:21:49 +05:30
2022-10-17 12:01:00 +02:00
2025-10-14 15:46:11 +00:00
2022-11-09 10:50:09 -08:00
2025-07-11 14:02:19 +00:00
2025-04-08 10:47:24 +02:00
2024-08-28 14:02:34 +00:00
2024-10-24 13:59:23 -04:00
2024-05-03 06:17:32 -07:00
2026-03-31 09:16:44 +00:00
2023-09-30 22:21:20 +00:00
2024-03-28 09:28:39 -04:00
2026-03-03 04:09:02 +08:00
2025-08-17 09:08:14 -07:00
2024-07-30 18:18:25 +00:00
2026-03-31 09:16:44 +00:00
2025-08-06 12:59:11 +00:00
2025-10-14 15:46:11 +00:00
2024-02-02 13:50:51 +00:00
2024-04-02 20:35:52 +00:00
2025-12-17 17:04:39 +00:00
2024-06-21 20:20:41 +00:00
2024-02-13 14:56:49 -07:00
2024-06-03 23:37:28 +00:00
2026-01-12 18:19:57 +02:00
2024-04-01 13:02:07 +00:00
2023-09-02 16:50:18 +02:00
2023-10-04 22:50:29 +00:00
2023-10-04 22:50:29 +00:00
2023-10-04 22:50:29 +00:00
2023-10-04 22:50:29 +00:00
2023-09-08 17:54:45 +01:00
2024-07-14 12:01:03 +02:00
2026-01-09 15:33:25 +00:00
2025-08-22 20:25:24 +08:00
2025-04-14 18:59:07 +00:00
2025-03-03 13:09:59 +01:00
2023-06-02 01:33:17 +02:00
2024-05-01 21:51:40 +01:00
2024-03-18 11:13:11 -07:00
2024-03-21 18:20:20 -06:00
2024-10-30 00:36:06 +00:00
2026-03-24 00:50:41 +01:00
2024-02-14 00:32:51 +00:00
2026-03-24 00:50:41 +01:00
2026-03-03 04:09:02 +08:00
2026-04-01 21:52:14 +00:00
2024-01-16 21:54:05 +01:00
2023-09-29 10:56:49 +02:00
2024-05-18 16:49:11 -04:00
2026-01-15 15:00:44 +00:00
2023-12-06 15:09:22 +01:00
2026-02-16 16:05:55 +00:00
2025-11-28 23:31:11 -08:00
2026-03-25 19:32:20 +00:00
2025-03-03 13:09:59 +01:00
2025-11-23 15:30:37 +00:00
2026-03-31 09:16:44 +00:00
2025-02-25 22:50:26 +00:00
2026-04-07 20:10:33 +02:00
2025-10-09 11:42:47 -04:00
2026-04-22 18:56:24 +00:00
2026-04-18 09:29:38 +00:00
2025-04-25 12:44:53 +00:00
2022-10-07 11:49:53 -07:00
2023-09-03 18:54:27 +02:00
2024-02-16 01:01:36 +00:00
2024-05-04 12:11:11 +01:00
2024-06-26 15:35:19 +02:00
2024-06-20 23:55:20 +08:00
2025-08-22 20:25:24 +08:00
2024-06-26 15:35:19 +02:00
2024-06-26 15:35:19 +02:00
2026-04-22 18:56:24 +00:00
2024-04-18 15:20:38 +02:00
2026-01-28 14:15:39 +00:00
2026-02-14 17:52:42 +00:00
2026-02-22 08:28:24 +00:00
2022-01-13 09:46:04 +01:00
2024-06-04 09:26:25 +02:00
2026-01-29 19:18:39 +00:00
2026-03-24 02:27:57 +01:00
2023-09-01 18:36:53 +02:00
2025-12-05 15:52:12 +00:00
2023-09-06 15:56:08 +02:00
2026-01-27 20:37:35 -08:00
2024-07-16 10:03:47 +00:00
2026-03-31 09:16:44 +00:00
2024-05-05 12:15:19 +02:00
2025-07-30 11:06:44 -07:00
2024-12-06 16:14:26 +00:00
2024-12-09 14:39:11 +08:00
2024-06-17 19:12:25 +00:00
2024-01-11 20:31:24 +02:00
2026-03-09 14:44:31 -07:00
2025-12-11 22:08:08 +00:00
2025-08-17 09:08:14 -07:00
2023-11-04 13:59:24 +00:00
2025-08-17 09:08:14 -07:00
2024-02-21 11:46:00 +01:00
2024-03-13 23:53:32 +01:00
2025-12-15 23:27:15 +00:00
2025-01-24 14:54:02 +01:00
2023-11-01 22:55:10 +00:00