forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitb972268
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 parentc7bd476 commitb972268
1 file changed
+51
-22
lines changedLines changed: 51 additions & 22 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1805 | 1805 |
| |
1806 | 1806 |
| |
1807 | 1807 |
| |
| 1808 | + | |
1808 | 1809 |
| |
1809 | 1810 |
| |
1810 | 1811 |
| |
| |||
1870 | 1871 |
| |
1871 | 1872 |
| |
1872 | 1873 |
| |
| 1874 | + | |
| 1875 | + | |
| 1876 | + | |
| 1877 | + | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
1873 | 1883 |
| |
1874 | 1884 |
| |
1875 | 1885 |
| |
| |||
1878 | 1888 |
| |
1879 | 1889 |
| |
1880 | 1890 |
| |
1881 |
| - | |
| 1891 | + | |
1882 | 1892 |
| |
1883 |
| - | |
1884 |
| - | |
1885 |
| - | |
| 1893 | + | |
| 1894 | + | |
| 1895 | + | |
1886 | 1896 |
| |
1887 | 1897 |
| |
1888 | 1898 |
| |
1889 | 1899 |
| |
1890 | 1900 |
| |
1891 |
| - | |
1892 |
| - | |
1893 |
| - | |
1894 |
| - | |
1895 |
| - | |
1896 |
| - | |
1897 |
| - | |
1898 |
| - | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
1899 | 1909 |
| |
1900 |
| - | |
1901 |
| - | |
1902 |
| - | |
| 1910 | + | |
1903 | 1911 |
| |
1904 | 1912 |
| |
1905 |
| - | |
1906 |
| - | |
1907 |
| - | |
1908 |
| - | |
1909 |
| - | |
1910 |
| - | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
1911 | 1919 |
| |
1912 | 1920 |
| |
1913 |
| - | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
1914 | 1943 |
| |
1915 | 1944 |
| |
1916 | 1945 |
| |
|
0 commit comments
Comments
(0)