forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit09f680d
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 parent69a9134 commit09f680d
1 file changed
+51
-22
lines changedLines changed: 51 additions & 22 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1607 | 1607 |
| |
1608 | 1608 |
| |
1609 | 1609 |
| |
| 1610 | + | |
1610 | 1611 |
| |
1611 | 1612 |
| |
1612 | 1613 |
| |
| |||
1672 | 1673 |
| |
1673 | 1674 |
| |
1674 | 1675 |
| |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
1675 | 1685 |
| |
1676 | 1686 |
| |
1677 | 1687 |
| |
| |||
1680 | 1690 |
| |
1681 | 1691 |
| |
1682 | 1692 |
| |
1683 |
| - | |
| 1693 | + | |
1684 | 1694 |
| |
1685 |
| - | |
1686 |
| - | |
1687 |
| - | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
1688 | 1698 |
| |
1689 | 1699 |
| |
1690 | 1700 |
| |
1691 | 1701 |
| |
1692 | 1702 |
| |
1693 |
| - | |
1694 |
| - | |
1695 |
| - | |
1696 |
| - | |
1697 |
| - | |
1698 |
| - | |
1699 |
| - | |
1700 |
| - | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
1701 | 1711 |
| |
1702 |
| - | |
1703 |
| - | |
1704 |
| - | |
| 1712 | + | |
1705 | 1713 |
| |
1706 | 1714 |
| |
1707 |
| - | |
1708 |
| - | |
1709 |
| - | |
1710 |
| - | |
1711 |
| - | |
1712 |
| - | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
1713 | 1721 |
| |
1714 | 1722 |
| |
1715 |
| - | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
| 1744 | + | |
1716 | 1745 |
| |
1717 | 1746 |
| |
1718 | 1747 |
| |
|
0 commit comments
Comments
(0)