forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit8984480
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 parent9033e70 commit8984480
1 file changed
+51
-22
lines changedLines changed: 51 additions & 22 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1835 | 1835 |
| |
1836 | 1836 |
| |
1837 | 1837 |
| |
| 1838 | + | |
1838 | 1839 |
| |
1839 | 1840 |
| |
1840 | 1841 |
| |
| |||
1900 | 1901 |
| |
1901 | 1902 |
| |
1902 | 1903 |
| |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
1903 | 1913 |
| |
1904 | 1914 |
| |
1905 | 1915 |
| |
| |||
1908 | 1918 |
| |
1909 | 1919 |
| |
1910 | 1920 |
| |
1911 |
| - | |
| 1921 | + | |
1912 | 1922 |
| |
1913 |
| - | |
1914 |
| - | |
1915 |
| - | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
1916 | 1926 |
| |
1917 | 1927 |
| |
1918 | 1928 |
| |
1919 | 1929 |
| |
1920 | 1930 |
| |
1921 |
| - | |
1922 |
| - | |
1923 |
| - | |
1924 |
| - | |
1925 |
| - | |
1926 |
| - | |
1927 |
| - | |
1928 |
| - | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
1929 | 1939 |
| |
1930 |
| - | |
1931 |
| - | |
1932 |
| - | |
| 1940 | + | |
1933 | 1941 |
| |
1934 | 1942 |
| |
1935 |
| - | |
1936 |
| - | |
1937 |
| - | |
1938 |
| - | |
1939 |
| - | |
1940 |
| - | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
1941 | 1949 |
| |
1942 | 1950 |
| |
1943 |
| - | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
1944 | 1973 |
| |
1945 | 1974 |
| |
1946 | 1975 |
| |
|
0 commit comments
Comments
(0)