forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit0217a74
committed
Fix race condition with BIO methods initialization in libpq with threads
The libpq code in charge of creating per-connection SSL objects wasprone to a race condition when loading the custom BIO methods needed bymy_SSL_set_fd(). As BIO methods are stored as a static variable, theinitialization of a connection could fail because it could be possibleto have one thread refer to my_bio_methods while it is being manipulatedby a second concurrent thread.This error has been introduced by8bb14cd, that has removedssl_config_mutex around the call of my_SSL_set_fd(), that itself setsthe custom BIO methods used in libpq. Like previously, the BIO methodinitialization is now protected by the existing ssl_config_mutex, itselfinitialized earlier for WIN32.While on it, document that my_bio_methods is protected byssl_config_mutex, as this can be easy to miss.Reported-by: Willi MannAuthor: Willi Mann, Michael PaquierDiscussion:https://postgr.es/m/e77abc4c-4d03-4058-a9d7-ef0035657e04@celonis.comBackpatch-through: 121 parent450ad65 commit0217a74
1 file changed
+51
-22
lines changedLines changed: 51 additions & 22 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1496 | 1496 |
| |
1497 | 1497 |
| |
1498 | 1498 |
| |
| 1499 | + | |
1499 | 1500 |
| |
1500 | 1501 |
| |
1501 | 1502 |
| |
| |||
1561 | 1562 |
| |
1562 | 1563 |
| |
1563 | 1564 |
| |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
1564 | 1574 |
| |
1565 | 1575 |
| |
1566 | 1576 |
| |
| |||
1569 | 1579 |
| |
1570 | 1580 |
| |
1571 | 1581 |
| |
1572 |
| - | |
| 1582 | + | |
1573 | 1583 |
| |
1574 |
| - | |
1575 |
| - | |
1576 |
| - | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
1577 | 1587 |
| |
1578 | 1588 |
| |
1579 | 1589 |
| |
1580 | 1590 |
| |
1581 | 1591 |
| |
1582 |
| - | |
1583 |
| - | |
1584 |
| - | |
1585 |
| - | |
1586 |
| - | |
1587 |
| - | |
1588 |
| - | |
1589 |
| - | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
1590 | 1600 |
| |
1591 |
| - | |
1592 |
| - | |
1593 |
| - | |
| 1601 | + | |
1594 | 1602 |
| |
1595 | 1603 |
| |
1596 |
| - | |
1597 |
| - | |
1598 |
| - | |
1599 |
| - | |
1600 |
| - | |
1601 |
| - | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
1602 | 1610 |
| |
1603 | 1611 |
| |
1604 |
| - | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
1605 | 1634 |
| |
1606 | 1635 |
| |
1607 | 1636 |
| |
|
0 commit comments
Comments
(0)