forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitc3b7922
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 parent648fc6a commitc3b7922
1 file changed
+51
-22
lines changedLines changed: 51 additions & 22 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1666 | 1666 |
| |
1667 | 1667 |
| |
1668 | 1668 |
| |
| 1669 | + | |
1669 | 1670 |
| |
1670 | 1671 |
| |
1671 | 1672 |
| |
| |||
1731 | 1732 |
| |
1732 | 1733 |
| |
1733 | 1734 |
| |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
1734 | 1744 |
| |
1735 | 1745 |
| |
1736 | 1746 |
| |
| |||
1739 | 1749 |
| |
1740 | 1750 |
| |
1741 | 1751 |
| |
1742 |
| - | |
| 1752 | + | |
1743 | 1753 |
| |
1744 |
| - | |
1745 |
| - | |
1746 |
| - | |
| 1754 | + | |
| 1755 | + | |
| 1756 | + | |
1747 | 1757 |
| |
1748 | 1758 |
| |
1749 | 1759 |
| |
1750 | 1760 |
| |
1751 | 1761 |
| |
1752 |
| - | |
1753 |
| - | |
1754 |
| - | |
1755 |
| - | |
1756 |
| - | |
1757 |
| - | |
1758 |
| - | |
1759 |
| - | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
1760 | 1770 |
| |
1761 |
| - | |
1762 |
| - | |
1763 |
| - | |
| 1771 | + | |
1764 | 1772 |
| |
1765 | 1773 |
| |
1766 |
| - | |
1767 |
| - | |
1768 |
| - | |
1769 |
| - | |
1770 |
| - | |
1771 |
| - | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
1772 | 1780 |
| |
1773 | 1781 |
| |
1774 |
| - | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
1775 | 1804 |
| |
1776 | 1805 |
| |
1777 | 1806 |
| |
|
0 commit comments
Comments
(0)