- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit01eca6a
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 parentbc3c8db commit01eca6a
1 file changed
+42
-22
lines changedLines changed: 42 additions & 22 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1820 | 1820 |
| |
1821 | 1821 |
| |
1822 | 1822 |
| |
| 1823 | + | |
1823 | 1824 |
| |
1824 | 1825 |
| |
1825 | 1826 |
| |
| |||
1885 | 1886 |
| |
1886 | 1887 |
| |
1887 | 1888 |
| |
| 1889 | + | |
| 1890 | + | |
| 1891 | + | |
| 1892 | + | |
| 1893 | + | |
| 1894 | + | |
| 1895 | + | |
1888 | 1896 |
| |
1889 | 1897 |
| |
1890 | 1898 |
| |
| |||
1893 | 1901 |
| |
1894 | 1902 |
| |
1895 | 1903 |
| |
1896 |
| - | |
| 1904 | + | |
1897 | 1905 |
| |
1898 |
| - | |
1899 |
| - | |
1900 |
| - | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
1901 | 1909 |
| |
1902 | 1910 |
| |
1903 | 1911 |
| |
1904 | 1912 |
| |
1905 | 1913 |
| |
1906 |
| - | |
1907 |
| - | |
1908 |
| - | |
1909 |
| - | |
1910 |
| - | |
1911 |
| - | |
1912 |
| - | |
1913 |
| - | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
1914 | 1922 |
| |
1915 |
| - | |
1916 |
| - | |
1917 |
| - | |
| 1923 | + | |
1918 | 1924 |
| |
1919 | 1925 |
| |
1920 |
| - | |
1921 |
| - | |
1922 |
| - | |
1923 |
| - | |
1924 |
| - | |
1925 |
| - | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
1926 | 1932 |
| |
1927 | 1933 |
| |
1928 |
| - | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
1929 | 1949 |
| |
1930 | 1950 |
| |
1931 | 1951 |
| |
|
0 commit comments
Comments
(0)