From a1b650ad7be4f8ec2fb486244f2f303434d43dfc Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 21 Jun 2007 14:23:38 +0000 Subject: =?UTF-8?q?Gerrit=20Bruchh=E4user=20pointed=20out=20a=20warning=20?= =?UTF-8?q?that=20the=20Intel(R)=20Thread=20Checker=20tool=20reports=20and?= =?UTF-8?q?=20it=20was=20indeed=20a=20legitimate=20one=20and=20it=20is=20o?= =?UTF-8?q?ne=20fixed.=20It=20was=20a=20use=20of=20a=20share=20without=20d?= =?UTF-8?q?oing=20the=20proper=20locking=20first.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES | 5 ++++ RELEASE-NOTES | 4 +++- lib/url.c | 5 +++- tests/data/test506 | 68 +++++++++++++++++++++++++++++------------------------- 4 files changed, 49 insertions(+), 33 deletions(-) diff --git a/CHANGES b/CHANGES index 18bdd0102..38a734f02 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,11 @@ Changelog +Daniel S (21 June 2007) +- Gerrit Bruchhäuser pointed out a warning that the Intel(R) Thread Checker + tool reports and it was indeed a legitimate one and it is one fixed. It was + a use of a share without doing the proper locking first. + Daniel S (20 June 2007) - Adam Piggott filed bug report #1740263 (http://curl.haxx.se/bug/view.cgi?id=1740263). Adam discovered that when diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 21fa2b506..dc4b1f523 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -60,6 +60,7 @@ This release includes the following bugfixes: o multi interface HTTP CONNECT glitch o list FTP root directories when login dir is not root o no longer slows down when getting very many URLs on the same command line + o lock share before decreasing dirty counter This release includes the following known bugs: @@ -86,6 +87,7 @@ advice from friends like these: Frank Hempel, Michael Wallner, Jeff Pohlmeyer, Tobias Rundström, Anders Gustafsson, James Bursa, Kristian Gunstone, Feng Tu, Andre Guibert de Bruet, Rob Crittenden, Rich Rauenzahn, Tom Regner, - Dave Vasilevsky, Shmulik Regev, Robson Braga Araujo, Adam Piggott + Dave Vasilevsky, Shmulik Regev, Robson Braga Araujo, Adam Piggott, + Gerrit Bruchhäuser Thanks! (and sorry if I forgot to mention someone) diff --git a/lib/url.c b/lib/url.c index 8165c9298..789959762 100644 --- a/lib/url.c +++ b/lib/url.c @@ -378,8 +378,11 @@ CURLcode Curl_close(struct SessionHandle *data) #endif /* CURL_DOES_CONVERSIONS && HAVE_ICONV */ /* No longer a dirty share, if it exists */ - if (data->share) + if (data->share) { + Curl_share_lock(data, CURL_LOCK_DATA_SHARE, CURL_LOCK_ACCESS_SINGLE); data->share->dirty--; + Curl_share_unlock(data, CURL_LOCK_DATA_SHARE); + } free(data); return CURLE_OK; diff --git a/tests/data/test506 b/tests/data/test506 index 1d658f3fa..65a2758d5 100644 --- a/tests/data/test506 +++ b/tests/data/test506 @@ -90,60 +90,66 @@ lock: dns : 16 unlock: dns : 17 lock: cookie : 18 unlock: cookie : 19 -*** run 2 -CURLOPT_SHARE lock: share : 20 unlock: share : 21 +*** run 2 +CURLOPT_SHARE +lock: share : 22 +unlock: share : 23 PERFORM -lock: dns : 22 -unlock: dns : 23 lock: dns : 24 unlock: dns : 25 -lock: cookie : 26 -unlock: cookie : 27 +lock: dns : 26 +unlock: dns : 27 lock: cookie : 28 unlock: cookie : 29 lock: cookie : 30 unlock: cookie : 31 +lock: cookie : 32 +unlock: cookie : 33 run 2: set cookie 4 and 5 -lock: dns : 32 -unlock: dns : 33 -CLEANUP lock: dns : 34 unlock: dns : 35 -lock: cookie : 36 -unlock: cookie : 37 +CLEANUP +lock: dns : 36 +unlock: dns : 37 +lock: cookie : 38 +unlock: cookie : 39 +lock: share : 40 +unlock: share : 41 *** run 3 CURLOPT_SHARE -lock: share : 38 -unlock: share : 39 +lock: share : 42 +unlock: share : 43 CURLOPT_COOKIEJAR PERFORM -lock: dns : 40 -unlock: dns : 41 -lock: dns : 42 -unlock: dns : 43 -lock: cookie : 44 -unlock: cookie : 45 -lock: cookie : 46 -unlock: cookie : 47 +lock: dns : 44 +unlock: dns : 45 +lock: dns : 46 +unlock: dns : 47 lock: cookie : 48 unlock: cookie : 49 +lock: cookie : 50 +unlock: cookie : 51 +lock: cookie : 52 +unlock: cookie : 53 run 3: overwrite cookie 1 and 4 -lock: dns : 50 -unlock: dns : 51 +lock: dns : 54 +unlock: dns : 55 try SHARE_CLEANUP... -lock: share : 52 -unlock: share : 53 +lock: share : 56 +unlock: share : 57 SHARE_CLEANUP failed, correct CLEANUP -lock: dns : 54 -unlock: dns : 55 -lock: cookie : 56 -unlock: cookie : 57 +lock: dns : 58 +unlock: dns : 59 +lock: cookie : 60 +unlock: cookie : 61 +lock: share : 62 +unlock: share : 63 SHARE_CLEANUP -lock: share : 58 -unlock: share : 59 +lock: share : 64 +unlock: share : 65 GLOBAL_CLEANUP -- cgit v1.2.3